This page contains an archived post to the Design Forum (formerly called the Flexible Java Forum) made prior to February 25, 2002.
If you wish to participate in discussions, please visit the new
Java really missed an opportunity here.
Posted by Sundar Narasimhan on 31 Oct 1998, 2:36 PM
There are really two (at least) orthogonal issues conflated in these
1. Empty constructors: Here I feel that Java missed an opportunity
here. If you look at Lisp and CLOS, you'll see that Java could very well
have "abolished" constructors with the same name as that of a class.
(i.e. why have Point(..) create instances of a point. Why not
make do with a "make-instance" class-name, and a variable list
of args?). i.e. whenever you want to create an object .. you always
have to do:
SomeObject f = Class.makeInstance("SomeObject", arglist);
This would have unified "bean" constructors and default constructors
and obviated half of the confusion.
2. Whether or not "all" objects should be serializable. I think
people who call for this are "bean bigots". In my experience they
tend to programmers who have never run across functional programming
concepts such as closures, continuations or infinite streams.
I'd suggest that if you read up on these concepts it will become
apparent why "serialization" of such objects/classes rarely makes
Regards, and thanks for a very useful discussion.