[rescue] Sun memo regarding Java
Joshua D. Boyd
jdboyd at celestrion.celestrion.net
Tue Feb 11 08:57:23 CST 2003
On Tue, Feb 11, 2003 at 01:21:27AM -0500, Dave McGuire wrote:
> The threading is very useful, but as for the other stuff...no thanks,
> some of us have applications to write. It's all nice to read about,
> but in practice, where has fluff like that been used effectively? I'll
> bet it's been used in some of that bloated IBM eWhatever stuff that
> gives Jon so much heartburn. For some programmers, there's an
> inexplicable motivation to do things in the most complex way possible.
> I think it has something to do with people wanting to show off how
> clever they are or something. But in the end, it has to work, and it
> has to work well...that's what a lot of these kiddiez writing bad code
> lose sight of.
In theory, I find serialization usefull. I've only toyed with it in
Java, but the equivelent thing in Common Lisp and Scheme seem usefull
(I've played with them far more), and the equivelent thing in Python
(they call it pickleing) is very usefull. Assuming that you don't need
transactions or fancy data locking, it is a very nice way to be able to
save data to disk quickly (from the time spent programming point of view
at least). As to the lexical parsing, maybe people who really
understand lexx don't need/want what Java provides, but I don't really
understand lexx yet. I keep wanting to quickly get what I need done
rather than spend my time fighting with lexx.
And finally to introspective object systems (ie, being able to ask an
object what its methods are, then call them by name) and messenging, I
also find those handy, and have spent a lot of time trying to duplicate
that functionality. It's nice to be able to get a reference to a
generic object class, then ask it what sort of object it is, then based
on that call a method of the object that it's parent might not have.
An example of this is say I call a function that loads a bunch of
objects from a file into a tree (specifically, a function that loads a
3DS file into a tree of 3D objects preserving the heirarchy of objects
in the file). I then can ask this tree what objects it contains, and it
returns a list (perhaps Tank01, Bicycle, FrontWheel, Chain, etc). I
then can ask the tree to return a pointer to an object named such and
such (say Chain). This pointer that is returned is a pointer to a
GLObject, but I know that Chain is a PolygonMesh (a subclass of
GLObject), so I should be able to say
Tree->GetObjectReference("Chain")->GenerateVertexNormals(), however
GLObject doesn't have a GenerateVertexNormals method, so I have to cast
the reference returned by Tree::GetObjectRefernce to be a GLObject, and
C++ will do it, but it will also complain bitterly. In other languages
(I believe Java is one, but I'm not really sure), you could just ask the
object if it has a GenerateVertexNormal method, then only call it if it
does. In C++ I ended up asking the object for its type (which was a
method built into GLObject and returns a string, which is grossly
inefficient to execute, but easy to develop), and then I do a cast that
the compiler always complained about but would permit anyway.
> You mentioned above, surely in jest, about the "thousand and one
> things that Java comes with". In actuality, the Java 1.4 platform
> comes with more than four times that many classes. ;)
More information about the rescue
mailing list