Hello,
Modelling your implementation, hiding details is all that is behind the
separation between interface and implementation in Pascal Units and Ada
Modules. As such, it is still a great idea. In UML, this notion appears
as packages, still a very good idea for large size or maintainable software.
However, about inner classes and Java : it's a destructive construct in
Java for design, coming from the strange notion a type should be
equivalent to a module and be a unit of consistency and therefore of
compilation. From the very beginning, Java has not been able to keep
such an impossible promise and has added over time inner classes,
anonymous classes, etc. In fact, it's such a stupid idea Java is now
coming to the notion of namespaces (for the same reason as C++ in its
time). The result is that Java pollutes public classes with private
constructs and mixes everything in the declaration.
From a design point of view, the clear separation of interface and
implementation is blurred in Java and enhanced in Pascal.
In Pascal, the very easy way to implement private classes is simply to
declare them within the implementation part (as its name implies) of a
unit, or better still, with a private unit 'used' in the implementation
part. Same thing in Ada, of course. If it's tricky and makes the
developer think, then it's because the design is not clear and Pascal's
structure "forces" the developer to think better.
Modularity & OO are complementary, not synonymous.
Best regards,
Thierry
Tony Pelton a écrit :
On 6/15/06, [EMAIL PROTECTED]
<[EMAIL PROTECTED]> wrote:
...
> 6. "inline" code inside class (like in C++/Java).
Not recommended. Bad design.
hooey.
there is nothing "bad" about inner classes. this is like saying the
use of a "Type" that is private, but is intended to aggregate some
attributes is "bad design".
inner classes in Java are an awesome construct.
it allows you to model your implementation, using classes as required,
so that your implementation is robust, but where some of those classes
aren't useful outside of the implementation, you don't have to pollute
your namespace with classes that won't ever be used by other parts of
the application.
...
Tony
______________________________________________________________________
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email
______________________________________________________________________
_________________________________________________________________
To unsubscribe: mail [EMAIL PROTECTED] with
"unsubscribe" as the Subject
archives at http://www.lazarus.freepascal.org/mailarchives