[PLUG] Why is java is evil ???? (was "new guy with questions" )

Ronald Chmara ron at Opus1.COM
Wed Jun 28 06:40:02 UTC 2006


On Jun 27, 2006, at 10:52 AM, Lancashire, Pete wrote:
> totally agree poor programming can be done in any lang.
> each instance took something like 32 or 64 MB, the server
> was fully loaded with 256 MB :)
> I cant remember what the (min/max was too long ago) just to load
> the VM. at times there would be 20 or so running. I did not
> know if you could have a vm shared or not, and it was back
> in the 1.2 days as well so performance was not as good as i
> have been told 1.4/5 is.
> but just to read 200K lines of 50 chars of EBCDIC, convert to
> ASCII, do a few if field x is not this or that, then write back
> out to another file, it just seemed too much in resources.
> i guess what got me the most was he got his 'religion' from
> school, that java was the answer to all solutions, but that
> is a whole other thread ..

<rant>

I think part of the problem is that the OO paradigm, as often being 
taught, actually supports and *encourages* poor coding practices (in 
terms of RAM and CPU load), in so many ways.

Rather than a developer being expected to be tightly coupled to the 
performance of the computer, and their program, programmers are 
encouraged to break tasks/jobs/data down into discrete, isolated, 
units, with their own protected memory spaces, in order to... well... 
do anything. Add in insane re-use models of using existing bloatware to 
avoid writing 10 lines (or less) of code ("load up a ginormous 128Kb 
library object to simply wrap an 6 letter XML tag around an item? Don't 
mind if I do!"), and it just gets uglier. (Sun/MS/Dell sells more 
hardware, yay!)

An example:....

What does good "religious" OO teach us? To use "nouns" (or members of a 
class), and to isolate those nouns! (I'm going to skip over this 
debate).

So, 200,000 lines... well, a line is one kind of noun, so maybe we need 
200,000 objects from our "line" class.

But then again, the pieces of *text* in those lines, if it represents 
something like a database field parameter, is another kind of noun, so 
if there are 10 different items in a line, that's then inherited (from 
line) class pieces, or 2,000,000 different objects to track in memory.

Since we don't want our properties for the first piece of a text 
object, as a child of a line object, at line 199,999, to interfere with 
any other lines or the existing line's text properties, we have to keep 
track of 2,000,000 different objects.

Of course, since each of those pieces of text may have any one of, oh, 
say, 10 properties, we need memory space for 20,000,000 variables. 
Assuming (LOL!) that each variable takes up *only* one 8-bit byte, 
that's 160,000,000 bits needed. 19531.25K. 19.07 *Megabytes*.

Now that we have our 20,000,000 object variables loaded in 19 Mb of 
RAM, cleanly isolated, we only need to test if one of the lines has a 
variable set to "foo".

*cough*

It may seem funny, but I have seen software written like this.  
Actually, is it fairly rare that I see OO software that *isn't* written 
like this, quite sadly. Maybe because the emphasis is on thinking about 
OO ideals (polymorphism, code maintenance), and not things endusers 
care about (speed, minimal footprints), I see it much more in lock-in 
industries, and code from the folks who never wrote to a target of 
256K(max) of RAM.

Please note that I did not say 256M.
</rant>

-Ifeelolderthandirtbop
--
4245 NE Alberta Ct.
Portland, OR 97218
503-282-1370




More information about the PLUG mailing list