Packages as first class entities

[email protected] Fri, 3 Jun 2005 18:19:21 +0200
Newsgroups gmane.comp.lang.nice.general
Message-ID <[email protected]>
Hi all.
I was reading this page

http://www.nakedobjects.org/book/section5.html

and I noticed this sentence

"Drawing an analogy from microbiology, Kay argued that the only way that
software could scale up in complexity by a factor of a billion would be if
the software was self-similar at all scales: that the most elementary software
building blocks were, in effect, complete miniature computers - in other
words, 'objects'."

Then I jumped back to nice (I'm dreaming about a ruby on rails in nice ;)
) and started to think to the role that packages have in nice.
If I understood correctly, nice packages are more important entities than
java packages, they are bigger and more "concrete".
In some book I do not remember (Wirfs-Brock?) there was something like this
"you should consider a group of classes as the minimal element of design,
the single class is not enough".

Ok, I come to the point. I was thinking if packages could be real entities
of the language, with a well defined interface and behavior.
Suppose you was to use/embed another program in your code, something like
hsql for example.
You have to write something like this

com.xyz.App app = new com.xyz.App(new AppConfig("configFile"));
app.start();

In this example App is just one class of the package, it have nothing special,
but it's clear that it's what keep together all the other classes.
So I'm thinking to something like this

com.xyz app = new com.xyz("configFile");
app.start();

internally the "package constructor" will use the same code of the previous
example.
I think the difference here is that the idea of an higer level of aggregation
is explicit, is not something that come from the docs, and that you need
to be careful to follow. The package is seen as a bigger block, whose interface
has to be defined explicitly, package encapsulation can be stronger, and
compiler can "check" you are working at the level of abstraction you have
chosen.
You do not need an external "descriptor" to define aggregate/components.
The language itself suggest you to try to build higer level of abstraction.

I've written too much. Any thoughts?

Bye

Lorenzo




-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005