logo       

RE: How do you choose your programming language ?: msg#00094

culture.hackers.israel

Subject: RE: How do you choose your programming language ?


> -----Original Message-----
> From: hackers-il-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx
> [mailto:hackers-il-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx] On Behalf Of
> Nadav Har'El
> Sent: Thursday, November 24, 2005 12:53 AM
> To: hackers-il-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx
> Subject: Re: [hackers-il] How do you choose your programming
> language ?
>
> On Wed, Nov 23, 2005, Tzahi Fadida wrote about "RE:
> [hackers-il] How do you choose your programming language ?":
> > I am not sure you are correct. I believe that in latest
> java there is a trick with
> > the classloader that you can allocate and free objects,
> however I heard
> > that it can lead to memory leak (whats new).
>
> Any language is Turing-complete, and if you realy try very
> hard, you CAN
> allocate and free memory, perhaps by using class-loaders, or
> perhaps by
> using JNI (i.e., C code). But doing this is extremely
> complex, and goes
> against the entire design of the language. It's almost like
> buying a plane,
> and then taking off its wings and trying to modify its engine
> to be more
> fuel-efficient - why don't you buy a car instead?
> Nobody programs the way you describe in Java, except perhaps
> as an excercise.
> If someone wants to write this way, they just switch to C or whatever.

I didn't claim to program like that. Just said its possible if so insistant.

>
> > I also heard that there are alternative
> > GC and that there are calls that can expedite GC.
>
> For the object creation patterns that are common in Java
> (myriads of short-
> lived objects, Java's current GC ("hotspot") is extremely
> efficient in speed,
> because allocations are extremely quick (no need to "search
> the heap" for
> holes like in C, just increment the pointer), even in a multi-threaded
> program, and free doesn't take any time (the time of GC is
> not proportional
> to the number of dead objects, but rather to the number of
> living objects).
>
> I wonder, though, if anybody attempted to do a
> reference-counting GC for
> Java (do you know of such a thing?). It would have been much
> slower than the
> current GC, but perhaps waste much less memory. For many applications,
> this could have been a win.
>
> > Anyway, as I mentioned before there are native compilers
> that makes all these
> > a mute discussion, e.g. GCJ. And, its FOSS.
>
> I completely fail to understand this statement. Please enlighten me.
> Even if gcj compiles codes, it still has to use garbage
> collection, because
> in Java all parameters are "passed by reference" (except for
> primitive types
> like "int"), and anybody can save these references and use
> them later, and
> stop using them much later. Except a few optimizations (like
> immediately
> freeing an object which was never passed anywhere), I don't
> see what you
> can do to improve memory waste by dead objects. And these
> optimizations
> are not specific to a compiler, anyway.

At least in my weak understanding of the matter, when you don't use
JVM you don't need to allocate in advance the memory and thus
when it is free, it is freed back to the os. So it is not a memory hog
when used like that.

>
> > Personally the most important reason I like JAVA is that
> you can find the bugs quickly
> > and develop quickly using Jbuilder which is the best
> (although you have to pay).
>
> I use eclipse, which is probably the most convenient
> development environment
> I've seen. I agree, it's much more fun to program in Java
> than in C or C++.
> BUT, the sad truth is that often when you finish the project
> and see how
> the result behaves, you wish you spent the time on writing
> the project in
> a different language :(

I was working the last week on an experiment (hence why I didn't reply sooner),
and I am writing the experiment in C for the last few months. The experiment
uses the hd as a storage device for temporary data.

Another small and very simple experiment was done on parrallel, in fact I had no
knowledge of it till a month ago, using java and uses only main memory.

My C program took it with ease, while the java program got nowhere even when
we traded secrets. So I can understand your point indeed!

Another example are those design programs written in java lately, compared to
the fast rational rose. So this kind of program I wouldn't write in java.

However, forms to databases and tasks that require less efficiency are better
written
in a more bug proof enviroment than C, which I understand you agree with me.

Another advantage with C is the compiler. While utilizing the compiler options
I manage
to shave off a few secs from the run of the experiment, which I doubt I could
have done using java.
But again, efficiency is not my point.

>
> Ok, that has been the end of my gripes about Java for today. Sorry :-)
>
>
> --
> Nadav Har'El | Thursday, Nov 24
> 2005, 22 Heshvan 5766
> nyh-TS7m/3hpY0sOpacJJkBjfT4kX+cae0hd@xxxxxxxxxxxxxxxx
> |-----------------------------------------
> Phone +972-523-790466, ICQ 13349191 |Time is the best
> teacher. Unfortunately
> http://nadav.harel.org.il |it kills all its students.
>
>
> ------------------------ Yahoo! Groups Sponsor
> --------------------~-->
> Get fast access to your favorite Yahoo! Groups. Make Yahoo!
> your home page
> http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM
> --------------------------------------------------------------
> ------~->
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>




------------------------ Yahoo! Groups Sponsor --------------------~-->
Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page
http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/saFolB/TM
--------------------------------------------------------------------~->


Yahoo! Groups Links

<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/hackers-il/

<*> To unsubscribe from this group, send an email to:
hackers-il-unsubscribe-hHKSG33TihhbjbujkaE4pw@xxxxxxxxxxxxxxxx

<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/






<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise