Re: subclassing and generics



Hendrik Maryns wrote:

I am very surprised nobody gave the advise to not use inheritance at
all.

+1. Including the surprise ;-)

It /might/ be that the OP's uses of FooClass should also "know" that the
objects are Maps (or even TreeMaps), but -- like you -- I doubt it.


Delegation is
the better option, and it also makes the generics issue easier.

Sometimes having a difficulty with generics can indicate a flawed design.
Essentially the Java compiler is telling you "your design sucks" (of course,
/I/ would never be that rude ;-).

Unfortunately, it can be difficult to tell whether a generics problem is
actually caused by iffy design, or whether it's just another flaw in generics
themselves. But they can help diagnose an unclean design, or promote a clean
one.

(There now, I've gone and said something positive about generics! I promise
it won't soon happen again ;-)

-- chris




.



Relevant Pages

  • Re: Generics vs Constants - what criteria do you use to choose between these?
    ... constants/lower level generics. ... On the subject of design reuse, say I'm reusing a module in an upgrade ... There are many reasons to have different configurations for simulation ...
    (comp.lang.vhdl)
  • Re: Generics vs Constants - what criteria do you use to choose between these?
    ... With generics, the parameters must be passed through every level, from ... In a large, complex design, ... If naming collisions between record elements get to be a problem, ... parameter management, preferring to manage the parameters at the point ...
    (comp.lang.vhdl)
  • Re: Generics for Delphi
    ... "time saving approaches" end up costing more time in the long run. ... Does that make the language design "poorly designed"? ... generics, then they close the door on generics to you with that class. ... "Sequences" I think is the name.... ...
    (borland.public.delphi.non-technical)
  • Re: Generics vs Constants - what criteria do you use to choose between these?
    ... I prefer to put the constants in the top level of the design itself. ... I realize I could pull those constants out and make them generics as ... hit the "threshold of pain" yet where this management hurts. ... modification you would need to not change the name of that record type. ...
    (comp.lang.vhdl)
  • Re: Generics vs Constants - what criteria do you use to choose between these?
    ... Constants can be defined in a global package for the project, ... Generics are not locally static, and must be passed down through the ... By defining a record type in a global ... flexibility of design, ease of understanding the design, and ease of ...
    (comp.lang.vhdl)