ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kurt Huwig <k...@iku-netz.de>
Subject Re: Ant2 suggestions
Date Tue, 17 Jul 2001 09:07:08 GMT
Maurice le Rutte wrote:
> > Inheritance of fields is a Bad Thing (tm) IMHO.
> 
> I've always thought that inheritance of fields was one of the core things of
> OO...

Certainly, OO means inheritance of fields and methods, but some things are
not recommended. 'Best practice' as recommended by a lot of people in the
software design field

public:
 - methods that are part of the public API; as few as possible
 - fields in value objects only (classes that just hold several values and
have no methods)
 - classes

protected:
 - other methods

"package":
 - evil, just use it for examples

private:
 - fields; supply public set/get methods
 - don't use it for methods as these methods cannot be overwritten or used
in subclasses

If you use a tool like Together(tm), there are several wizards that check
code style and complain if you break these rules. There are some other
tools, that can do this stuff, but I don't remember the names. It was
something like 'JMetric' or so.

The philosophy behind this is to keep the classes as much separated from
each other as possible. Some say, you should use a lot of interfaces and
only these form the public api, but I think this is a bit extreme.

As soon as you hand over references from one class to another, e.g.

	o.doSomething( this );

you create dependencies between these two classes. If you change something
in this class, you also have at least to check the other class if you broke
something.

Kurt
-- 
---------------------------------------------------------------
If DOS means "Denial Of Service" what means MS-DOS?
                            And why should I tell it to "win"?

Mime
View raw message