Preview of Java 1.5
gafter writes "An early access prototype implementation of
the proposed new J2SE 1.5 language features is
available. The prototype includes
generics (JSR 14),
typesafe enums, varargs,
autoboxing, foreach loops, and static import
(JSR 201). In other words, all the new language features
planned for 1.5 except
metadata (JSR 175). The
prototype includes full sources for the compiler,
written in the extended language. You can download the prototype from
java.sun.com.
It requires J2SE 1.4.1 and provides some examples of how to use the new language constructs. The prototype includes an experimental type
system (variant type parameters)
for Generic Java that is being considered
for Tiger (1.5) based on a paper by
Igarashi and
Viroli at ECOOP 2002 .
Comments and votes for the new type system are
being gathered at
bugParade."
Some of these things are certainly nice (typesafe enums...) - but wouldn't it be nice to try and keep the java language *simple*? There are iterators for doing stuff like foreach-looping ... varargs? Why? It is an object-oriented language - take use of that polymorphism!
! But, . And finally, .
Just had to get that trolling out of the way. Now let the educated and well-formulated arguments begin.
I think generics are one of the most promising additions. I used to work with them in Ada years ago and always thought they'd work well in Java, and perhaps help with a few common bugs.
Surprisingly (!!!) all the things C# had (or will have - generics) that made it superior. This is going to be fun seeing these two compete. So far I am on the C# side but who knows :) this is really fun.
For years java zealots have told us that features like automatic boxing and templates are dangerous because they hide what really happens.
Now that java has them too, they are suddenly the biggest thing since sliced bread. Most modern languages have had automatic boxing for ages, and never made a big deal about it.
And about the new templates: they are just syntactic sugar. For example if you have an ArrayList, the elements will still be stored on the heap as Integer objects. That is very inefficient.
And what about VM sharing? Will it be in java 1.5, or will we still have to wait 30 seconds for java programs to start up?
Private property is the central institution of a free society (David Friedman)
While, as a java developer, I'm looking forward to most of these changes, I'm a bit afraid that java may lose it's positions as simple OO language which can be used for teaching in schools. Java was originally built with idea that you can read every java program in the world without problems. A lot of expresive power was sacrificed because of that - most notable preprocessor (to avoid people designing their own 'languages' for each project and library, as it is done in C).
Anonymous inner classes was first major ugliness which came into language - not very clear, hard to explain to a newcomer. But with all these new proposals, significant complexity is added to code in terms of visual overview. This is not critical for developers - perl hackers are faring very well, despite of having language 10 times as complicated as java as far as syntax is concerned - but pure-OO, java-is-new-pascal-for-algorithms academic society will probably start looking for a new language soon... (ok, maybe not really 'academic', I'm thinking more about secondary-level school programming basics).
You could troll and say that Java has finally caught up with where C++ was better than a decade ago. .Net onslaught. Good luck, Java.
More constructively, maybe the implementation will improve on things from all that time and experience.
Java is the best defense against the
Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
Java can walk on water and I'm still not going to use it to develop anything I expect anyone to use. Give me a native optimizing compiler and I just might reconsider.
You mean like GNU gcj?
For languages that are intended for general purpose use and especially for situations where performance/efficiency is important they're just a BAD idea.
You seem to think that by compiling stuff to native code things magically run fast when the problems are actually library design, class loader design, bad memory management, and other issues. Java's JIT is about as fast as natively compiled C code and Java's lousy performance is living proof for the fact that making a great native code compiler is not sufficient for getting good performance.
Python and Perl programs often run rings around equivalent Java programs in terms of actual, end-user visible performance and memory usage, despite being interpreted. If anything, the compromises people need to make to make languages easily compilable into native code make it much harder to build efficient systems in them.
Of course, it's not like we needed any more proof of that: the inefficiency and bloat of systems like Windows, Gnome, and KDE demonstrate the same point, as did several generations of systems before them. And generation after generation of programmers repeats the same mistake you are making.
Native compilers have been available forever but they rarely gain you enough over JIT to justify the lack of crossplatform portability. If you are running a J2EE app as middleware for a huge ecomerce or CRM system, etc then sure recompile to native code, but for other things it doesn't make sense when the JIT compilers are 99% effective. The biggest thing slowing JAVA down is the lack of a decent GUI framework.
There are 4 boxes to use in the defense of liberty: soap, ballot, jury, ammo. Use in that order. Starting now.
I'm surprised to see that there are still people out there which use 'interpreter' argument...
Anyway, there is a plenty of native compilers for java. I'm not sure if you have heard about certain compiler from free software group called Antilope or something like this - I think it is called gcc. They have a frontend for java, gcj, which compiles java source/bytecode to same intermediate stage as other compilers, thus sharing optimizing backed. If you don't care about paying few bucks, JET is very good compiler, written specifically for java, supporting 1.4.1. There is also few others, but I can tell only about these two from my experience.
Both these compilers are available for few years now. Problem is not with lack of native compilers, or performance of java in mixed mode offerred by Sun hotspot - problem is with mindset of poster. If you are not willing to use java - no problem. But please say it is 'religious' - everybody will agree with you, as you can have any beliefs you want. But do not try to back up religious statements with fake arguments.
(Excuse my whoring, but Sun's link to GJ was 404.)
When I moderate, I only use "-1, Overrated". That way, I never get meta-moderated!
Glad to see that .Net seems to have a good side - it gives Java competition and we finally see some of the nessecary improvements.
Static Imports are especially nice - Instead of Math.abs() one can finally just use abs().
The only complaint I have is the new format for the for loop... for (int x : b) isnt really easy to read. foreach x in b or something like that, while a little more verbose would be a cleaner solution...
Why will this happen ?
The Java system is based on the cleaning of a partly object-orientated language: C++. I know C++ coders will hate me for this, but if you compare C++ to real object-orientated languages like Smalltalk or CLOS, you'll have to admit that it's the plain truth.
Java's goal where to simplify and objectize C++. However during this process some of the most promising parts of C++ where thrown out - operator overloading and generic programming. But this Java's power was seriously crippled and it will never reach the state-of-art level of academic theory of OO-languages.
Secondly the Java interpreter scheme was extremely promising, too. However, SUN fuck this advantage totally up by concentrating on their modified C++ clone. MS did recognize this potential much better with their
Some people will now protest that "There is this Gonzo++ implemenation of the Java VM." This is indeed true, people got stuff from C++ to Lisp running on the Java VM. But this argument is rather pointless: the power of a modern VM system does not lie alone in the interpreter, but in the system libraries, too. And SUN failed unlike MS to provide decent interoperability here, because their Java VM was never really meant to run with other languages.
Personally i think that these design flaws will kill Java in the long term. There might exist many apps with Java these days, but this holds for Cobol, too. Even people in the OSS community start to realize this and move the MS's .NET system with projects like MONO etc.
Owner of a Mensa membership card.
You are so flamebait.
A language is a language, none are 'perfect', and the only realistic benchmark of a language is the job to be done. Demanding a native compiler of Java negates the purpose and design of the language.
I have my favourites (go Python!), but languages have gone from machine code to assembly to C, and as great as C is, I hope we don't stop there.
"A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
With none of the performance.
Anyone still convinced that Java is neato needs another viewpoint; Paul Graham's is reasonable.
Anyone convinced that Sun is anything different than Microsoft, oh, except for being less successful, is delusional. How's that Java standard comin'?
Avoid this crap. Go C++, or better yet Eiffel with C, and stop kidding yourself that Java getting a shiny "for" syntax is a reason for celebration.
"What's that? Oh yes sir! I'll have those UML diagrams detailing the Bloggorgian-Rienmarch Reverse Upside-Down Cake Factory Singleton Dweeboid Pattern for you by next month! Then we can start coding!"
Chr0m0Dr0m!C
Yes, I noticed this as well. I found it pretty interesting, and it reminded me of the old IE/Netscape browser wars. One implements the new features of the other. Let's just hope they don't get too carried away and bloat the language. :-/
:-)
To me, Java was a lanaguage with a minimum of "redundant" features. You can write a "for" loop without using "foreach". You can use a class instead of a struct. And so on... I'm actually a bit surprised that Sun are throwing in features the language doesn't really always seem to need. I thought that was C#'s area.
Beware: In C++, your friends can see your privates!
This is good. The Java language evolves and becomes more powerful. Note that these features can be implemented in the source-to-bytecode compiler, resulting in backwards compatible bytecode, that can be run on older JVMs.
public class ConvertedJavaSoftwareEngineer extends SloppySoftwareEngineer extends LazySoftwareEngineer extends SoftwareEngineer
Click on the link!
I've pretty much stopped using Java. Sun has broken their promises when it comes to making Java an open standard (and, in fact, they have several patents on core Java technologies). And technically, even with these additions, Java 1.5 is still behind C# in several important areas (native code/data interfaces, genericity, support for numerical computations).
.NET, and Mono have a chance if Microsoft doesn't shoot themselves in the foot with stupid legal threats against open source projects. Otherwise, there are plenty of other languages; the choice isn't just between Java and C#, you know.
Also, after trying to live with it for years, I have concluded that "100% pure Java" just doesn't meet my needs. "99% pure" is good enough for me: it means that porting is easy, but the last 1% of platform specific code is what makes the difference between applications that merely run and applications that integrate well with each platform.
I expect Java will continue to survive in some niches (most notably, bloated web services implementations), but Sun has largely missed the boat when it comes to creating a general-purpose programming language: it's too little too late technically, and they have annoyed too many people. I think C#,
It seems to me that languages like Java and C# really don't need them.
...because there's nothing like running a 2kb calculator and a 2kb notepad and both have them run on separate 10-15mb VMs. That is a real drag for any non-monolithic use of Java (yes I do know of servlets etc.)
Kjella
Live today, because you never know what tomorrow brings
JSR 201 says nothing about "varargs".
After seeing many similar posts to this java and .net are so slow , use C++ for speed I figure that if it was realy about speed they'd use assembler, but mostly i think its just that OO makes the weekend script kiddies on here have to think to much.
Java for programmers that are knowledgeable .net for programmers that want MS to do it for them
I had a pet once
Oh for the good ol days when pascal was the teaching language
I had a pet once
I expect Java will continue to survive in some niches (most notably, bloated web services implementations)
I was about to install Java + JBoss + Tomcat + Apache httpd (and maybe Apache Cocoon) and see what I can do with it. I'm not a seasoned developer (just had a few classes a few years ago), so I'm trying to figure out the best way to offer a scalable web platfrom mainly for database entry and reporting without much custom programming. I'm also interested in application services, but that's more into the future.
If not Java, then what?
And what tools are currently available? (Preferably open source of course, but commercial options considered.)
JPanel jp = new JPanel();
JComponent jc = jp;
works just fine (just tested in 1.4.1). I imagine the same applies to the second one too. Also, if this wasn't the case generics wouldn't help in this code. Generics only remove the need to cast when extracting an object from a container, if I understand things correctly.
What you mean like in C# ?
The tail is wagging the dog here.
"It's not your information. It's information about you" - John Ford, Vice President, Equifax
Sounds like they are adding a lot of features that the Dylan programming language has had since it's release (approximately 1995).
But whereas the features were elegantly incorporated into Dylan since the beginning and are consistent and easy to use, I suspect that in Java they are a hack.
Wasn't Java designed to be a simple language?
Java changes every couple of months. No one can decide on a "standard," even though Java is supposed to be a STANDARD. An advancement in Java in one camp means nothing anywhere else, but in that camp. True, an advancement in Java is news, but for who? That camp?
Yah, mod me down as a troll. That doesn't mean what I say isn't true.
J2EE is the best chance against .net , as long as .net stays on the desktop and out of the enterprise its fine with me. While java and c# look similar its when you go to the distributed environment the main differences occur.
I had a pet once
I don't think it really has anything to do with what the language "needs". It has more to do with what the programmers want. I mean, if we didn't want these features that made programming easier, we'd all be coding in rule 110.
GCJ?
And as the 1.5 compiles to compatable byte code, can automaticly use the new 1.5 features (with the exeception of new classes.
Wow, I should not post when knackered.
Every Java programmer instantly recognizes the head of an "iterator for-loop". It's an idiom.
Personally I don't like for loops with Iterators, it just seems not quite right (I think it's a hang-over from my days as a Pascal programmer). I always use a while loop.
Suck figs.
Those two languages are far simpler, and let you really hammer the points about programming down without getting the kids confused about syntax rules.
Smalltalk has, essentially, only one operation: the message send. Send object X a message Y, and get Z back as a result. Even simple things like addition are implemented this way. While not blazingly fast (except in certain specialized implementations), the message-send semantic is surprisingly efficient: many complex real-world systems have been constructed using Smalltalk.
Scheme also enjoys the advantage of being small and simple, yet powerful. You don't need to know what the lambda calculus is to see how effective and intuitive Scheme's procedural semantics is. ("Lather, rinse, repeat." See? Tail recursion. It was there all along.)
Either way, it's better to use a simple language to teach students how to formulate plans for doing things (i.e., algorithms), and then hit them with fanciful syntax later rather than drop them into a popular, but bewildering for newcomers, language (which I consider C++ and Java to be).
N4st0r, trixx0r h0bb1tz0rz! Th3y st0l3 0ur pr3c10uzz!
These additions seems to put Java on par with C#, but to make a quantum leap in expressiveness you need a dynamically typed scripting language.
Most applications these days can be written in higher-level languages, resulting in 5-10 times less source code compared to Java/C#, and making them correspondingly simpler to code and maintain.
Java doesn't really have a kick-ass companion scripting language. In MS world, VB plays this role. VB is really popular, but (I think most people would agree) a crap language and not really that high level. JavaScript just doesn't seem to cut it (pretty much only used in browsers).
Why doesn't Sun take a hint and phase JavaScript out in favor of a powerful multi-purpose high-level language like Python or Ruby? That'll put them miles ahead of Microsoft in terms of increasing programmers' productivity... and programmers' quality of life.
If you write a template method, you don't know what kinds of objects you are really working with. It is not always bad, but one of the problems with that is that IDEs will not be able to assist you with code completion and misc. refactorings.
The other problem with templates is that (at least with the C++ implementation) to use them without getting Cobol fingers, one has to write lots of typedefs, and those typedefs do hide what's underneath.
The main advantage of templates is the additional compile-time type checking, which arguably is not really needed, if you write tests for the code.
(C++ also has operator overloading, which lets use templates (conveniently) to implement lamda expressions. But Java doesn't have operator overloading, so this bonus doesn't apply here.)
no!
because the JIT overhead is not re-occuring, it happens once.
(Click 'Reply to This' to comment about no/no open standards etc)
---
Hell is not other people; it is yourself. - Ludwig Wittgenstein
So does python
New things are always on the horizon
Ok, let's all try to see how Sun can be incredibly stupid. .NET was announced almost 3-3.5 years ago. Sun saw it coming and did nothing. Bitching about how MS products sucks is not the solution. You should have used your advantage and experience in the Enterprise instead of letting MS slowly steal it from you. If Sun could have cared for what the industry has been complaning about in their technology, and implemented the necessary changes, by the time .NET is out, it would be just a ripoff. But look what we have here now: Sun, is trying to catch up with MS in the field where it had for years. You have a huge user base, you have a mature technology, why do you wait for opponents to catch up ? Java is not dead yet, but it's not hard to see why it'll be dead at the end, when you look at what Sun is doing..
You have a company that has a strong position in the Enterprise, and you have a technology that is pretty much accepted. Meanwhile your opponent is busy with conquering the desktop since it can't provide solutions strong and stable enough for the enterprise. What in god's name did you think MS was going to do? Was Bill Gates supposed to turn the others in the room and say "hey this was fun, let's do it again!" after MS has owned the complete desktop ? OF COURSE they'll try to dominate the Enterprise too!!
A lot of the features added to 1.5 are syntactic sugar for laziness. I guess that means this is true progress, according to your signature.
Java isn't an interpreted language, in the traditional sense. Interpretation implies that the runtime environment interprets the source as it progresses, and e.g. that errors that would have been caught compiletime by others, are reported runtime.
When it comes to performance, it's about time to kill the old idea that java performs so incredibly bad. Look at e.g. this article for a measurement of how well java performed a few years ago. I didn't at first glance find any articles doing similar comparisions using the more recent VMs, but as vendors put effort into still more optimizations, I'd not expect the results to be worse now.
Another aspect of this that you might not have considered is how the JVM is at an advantage over static compilers, as it has the possibility to generate native code *runtime*, using real information on e.g. branching to generate native code which'll keep the CPU pipelines filled. A static compiler cannot do this to the same degree, so it is possible to construct scenarios where Java performs better than natively compiled binaries.
The next great MMORPG.
While reading some Java discussion forums, I came across a thread with someone reporting a new comment on the shared VM bug in bug parade. The comment indicated that Sun wasn ot going to plan on having shared-VM in the 1.5 release of Java.
This immediately sparked a campaign of, well... complaining. But it seems to have worked. In a matter of hours, the comment had disappeared.
Now, I still have no positive evidence that Sun WILL put shared-VM into 1.5, but at least subtle, but solid evidence that they definitely would NOT has been retacted.
haha, sure, you've got a point there :-)
But I still think one should carefully evaluate what kind of "programmer need" should be supported in the core language.
Sure, it is definitely more useful to program in an object-oriented language than to program a Universal Cellular Automaton, and that's a reason to why object-oriented languages exists. But is it really necessary to add stuff like foreach loops to the language? Or is that just a keyword most of the Java programmers out there could've been without?
I'm not saying that programming languages shouldn't have evolved from the previous millenium, but that it might not be such a good idea to add unnecessary complexity to the language.
Beware: In C++, your friends can see your privates!
Being interested in the generics from my C++ days, I've been readsing discussion forums covering this topic in detail. One of the prevalent themes is that Java 1.5 generics ARE NOT C++ templates. Can someone confirm the differences?
Even when I did C++, I rarely had to use templates. In fact, when I did use them it was just for fun (implementing simple collections that were already available in STL). Still, I don't remember syntax for handlign covariance, contravariance, invariance, etc. Was it there and I didn't see it, or are Java 1.5's generics truly different form C++ templates.
To be quite honest, I dont care at all if .net is better than Java. The point is that .net is controlled by Microsoft, and currently only runs (officially) on M$ products. Mono might be outlawed by Microsoft at any point. You are at their mercy.
.net, or nothing. Do not think this will not happen.
The ONLY reason that Sun hasn't relinquished control of Java, is that if they had done so, Microsoft would have been free to embrace/extend/ corner the market.... The same as what they did with Internet explorer.
So, how many non-geeks use anything but, or even know of anything but IE?
Businesses would standardise on MS java, and java on any other platform would become unuseable.. (just as there are web pages that are only useable in IE).
By stating "I'm using C# over Java" you are selling you sole to the devil...You wait till microsoft start extending DRM into the specification, therby relegating projects like Mono to the sidewalk, at this point it will be M$
So, Its your choice. Choose to go with the, arguabily faster/easier to code offering by our (sarcasm) good friends at Redmond, or choose to fight Microsoft by writing code that will run on all platforms from mobile phones to IBM mainframes. Believe me when I say we will all be better off in the long run.
Look here. Sun is certainly not setting still and will release a vb like rad ide to generate macro code to Java very soon.
http://saveie6.com/
foreach isn't really redundant. It just gets used a lot when it shouldn't be used. If a type can easily be iterated-over with a standard for loop (for(i=0; i < obj.count; i++) { }) then you shouldn't use foreach. In .Net, at least, the iterator version is somewhat slower.
foreach is designed for cases where you can't simply use an index (i.e. obj[i]), such as a hash table or a linked list. In these cases, you need some kind of state for your iteration -- hence, an iterator.
While you can implement some kind of iterator without language support, language support in this case helps simplify the code. Instead of implementing the iterator yourself in your way (how many ways can this problem be solved?), you use the language-supported way. Much cleaner.
Syntactic sugar is bad when it leads to many ways to do something, but good when it simplifies the common case. I think iterators do this as long as they aren't used inappropriately.
Time flies like an arrow. Fruit flies like a banana.
Whoops -- forgot to mention structs. Yeah, again, they provide additional stuff that isn't strictly needed. And it can confuse people who don't know when to use a class and when to use a struct. But there really is a clear line between appropriate uses of class (stored on heap) and struct (stored on stack unless boxed). For those who understand the difference, it is really nice to have both.
Time flies like an arrow. Fruit flies like a banana.
I program Java for several customers, from scientific to business apllications.
Autoboxing is yet another way of hiding overhead; the wrapper classes still exist, but are now a big "secret" masked by autoboxing.
Why add autoboxing to make containers look more "natural with POD types, then ignore the crying need to operator overloading in scientific and engineering applications? Why one piece of syntactic sugar as opposed to another?
Overall, I'm not terribly impressed. The new generics seem weak; I don't see an emphasis on fixing bugs, stability, or independent standardization. Much as I like Java, 1.5 does not address most of my needs.
All about me
I'm not talking about JIT, I'm talking about the standard Python package, it caches the compiled bytecode.
New things are always on the horizon
A language which tons of people use for real apps and business critical stuff might become slightly less useful for academia! Panic, panic!
Er. Or, not.
Teach basics in python, algorithms in ocaml, bit-grinding in C.
I am working with a large bank at the moment, one of the largest in the world and they have largely junked Java, except for running browser applets.
They liked Java, the class libraries were great but, sorry, it is too slow. I'm not talking about incompetent coders. They even had Sun in looking at some of the apps. The end result was a customised virtual machine - but it was still too slow and the incompatibilities were a killer. The VM had to work identically across the bank's generations of systems from different vendors. One gotcha, IIRC, was synchronisation, making it difficult to run a JVM across processors and to exploit them properly for performance.
End result was a switch back to C++ for back end apps. Java could still be used but only for non-critical front-end stuff. The bank may consider C#, but it seems that Java has had its day.
Maybe this sounds like a troll, but Sun should release their control of the Standard. This will slow things down, think how long it takes to get stuff into C++, but that stability gives everyone room to think as to whether a change is really necessary.
I don't like the idea of C# but at least MS handed it over to ECMA.
Shoot, my list of "things I would change about Java if I actually got off my ass and did something instead of complaining all the time" just got 1 entry shorter!
What am I going to bitch about now?!
In the future, I would want to not be isolated from my friends in the Space Station.
...for getting less simple, but it was never simple to begin with. Simple would be to use weak-vars-strong-values typing like python. Making everything an Object and using that plus typecasts to do generics is not "simple", it's a hack. It uglifies your code, makes it less efficient, and (ironically) breaks strong typing.
Generics are also a hack, but at least they are an overt, clean one.
Java rarely wins in any particular niche. Relatively simple GUIs and COM objects are owned by VB (and Delphi). C++, C, and assembly rule in performance. Perl rules text processing. Python rules in ease of reading. ANSI C, Perl, Python may be more portable. Smalltalk, Eiffel, Lisp, Ruby, ML, Haskel, Forth, and a variety of others are a lot more true to a pure language concept. However, Java does an adequate job in most cases, and when you start crossing boundaries, it'll often be easier to do so in Java-land.
Java isn't innovative. However, it's constantly being improved. Sure, things like JDBC, Collections, SWING, NIO (async I/O), generics, threads, and concurrent garbage collection were available in some form elsewhere previously. They're all packaged into nice, free, portable, well documented, easy to use parts of Java though, and I'm happy to have them.
Java isn't as free as Emacs. However, it's mostly free as in beer, and it doesn't force it's freedom on you. It's certainly a whole lot freer than most things from Redmond. I admit, I don't care if a language is handled by a standards body, unless the company in question holds other monopolies it can abuse. I seriously don't think Sun is going to do anything so wacky as polluting the language to make COM (*cough* MS) or Object Pascal integration (*cough* Borland) easier.
Java's support base and (free) developer tools are just plain great. I love Eclipse, and IDEA and recent JBuilders are pretty nice too. VS.NET is good stuff as well, but contenders like Python are sorely lacking in this arena.
I still write plenty in other languages, but every year the percentage I write in Java goes up.. They keep filling holes (soft references, regexes, async I/O, .1s GC pauses) that were keeping me out of Java. I'm happy to see some more syntatic sugar in Java.. The things they're addressing will make a whole lot of code more readable.
Mono is alpha ! and is not, will not and never be any kind of a dotNet on a non MS platform.
;-)
;)
Bill stated this clearly : "we will not port the platform to a non MS platform". This includes opening the code source or whatever that could their endanger captive user resources.
If you still think Java is a niche, is because since nearly 10 years you was sleepy
Java is not the "magic key" for "IT magic kingdom", it is real, effective, efficient and fit your need.
Java is real freedom. Because i can change my OS, the product i use, the business model i got without beeing linked to a provider.
For does who still see Sun as the "big bad wolf", i never pay Sun a buck and i did so in a legal way.
I run linux on clusers, with JBoss, a IBM VM on top of Dell machine (the only stuff i have to pay)! And the architecture i got could manage any kind of a load (as long as my ISP link will manage to pass it to me), because i can add whatever new machine i want (tnx to the multilevel clustering nature of the solution).
It is real, effective, efficient and fit my need
What MS fears the most is Linux + Java. Because it is a more powerfull that they can even provide.
If the Linux gurus where stoping the bashing against Java and looks at the marvelous project made from the opensource comunity they will understand that Java is realy an opportunity to strengthen Linux as an OS leader.
-SLK
My bet would be that C# was developed taken into consideration common complaints about Java - or things that were already planned to be added to Java 'some time in the future'.
;)
And hats off to Microsoft for doing so, C# is a nice language.
I agree, however, that the next release of Java will raise a few eyebrows wrt 'fixing' Java's current 'problems' (if you could call them that - they're more like syntactic unpleasantries).
Should be interesting
We used the Pizza generic Java extension about three years ago, in my second-semester CompSci class (The Professor was somehow affiliated to the Pizza project). I must say that it's really something Java was lacking, and their spec is very clean and statically typesafe (important feature of Java imo). Besides, compared to C++, it's free of unnecessary clutter (C++ templates are just a bit too complex and powerful). But using Vector instead of a Vector of Objects is a pretty neat feature that I could get used to. Back then we were told that the Generic extension was on track for Java 1.3. I really wonder what kept them -- it should've been there back then, and it would've ended up to be more of a success, I suppose.
Bad memory design? Wrong. Java's memory management is much better than C's, because Java can move objects in memory around at will, but heap data in C is fixed because of pointers.
Also wrong is the statement that Python and Perl are faster. Every metric I've ever seen shows that Python and Perl are significantly slower than Java. Python especially. If you have proof of your statements, though, I'd love to hear it.
I sure hope future languages aren't modeled on Java. That will retard language development like too much reliance on C has retarded it over the last couple of decades. But Java isn't even as original as C was. The language design is purely derivative, a cleaned-up, restricted C++ with some features added from other languages, according to Jim.
I'm not saying Java is a bad language, but that it would be a bad one to base others on.
Does anyone know if the new java will be using a higher v. of gcc? Right now, if I'm not mistaken, sun is using gcc 2.95. For the moz folks out there it means that java applets and moz don't get along (moz is using gcc3.2x). And what of the talk a year ago? two years ago? That sun would Open source java? Nothing came of that has it?
Please understand, this is from the perspective of a *user* of java based applications. In my setup, (dual AthlonMP,Ti4600) I can't use 1.4 because the primary application slows down to the point of being unusable. This does not happen with 1.3, and it runs best under the IBM version (who have yet to release a 1.4 for windoze). Lest you say it is just me, this same problem exists for a number of other users of the same applications running different hardware/OS configurations. Upon reverting back to 1.3, all is well. As a user, not developer, I find this unacceptable - I shouldn't have to worry about performance degredation when upgrading java. I seems the rush to add features before optimizing (and fixing) prior code is SOP for the software industry these day.
The Java system is based on the cleaning of a partly object-orientated language: C++. I know C++ coders will hate me for this, but if you compare C++ to real object-orientated languages like Smalltalk or CLOS, you'll have to admit that it's the plain truth.
C++ is fast and less OO, Smalltalk and CLOS are slow and more OO. Since both classes of languages exist, obviously each user has different requirements and choose their level of OO and performance accordingly.
Secondly the Java interpreter scheme was extremely promising, too. However, SUN fuck this advantage totally up ... MS did recognize this potential much better with their .NET system providing a platform for a huge range of languages ranging from C++, C#, Java, VB to even Eiffel.
What exactly is the failure of the Sun VM? It runs on different CPU's and OS's. It has a published VM language for which people can implement compilers. Oh your argument is that the system libraries are inadequate. In what way do you feel they are less in capability than .Net?
And SUN failed unlike MS to provide decent interoperability here, because their Java VM was never really meant to run with other languages.
The common definition of interoperability and MS Interoperability(tm) are slightly different. Essentially, the MS definition is a very small subset of the more common definition. As far as MS is concerned, Interoperability is the ability for MS programs and languages to speak with one another.
So let me ask you, what is the real benefit of the CLR? Do you find yourself writing a lot of C++ in the morning and extending it with VB in the afternoon? No you say, it's to allow multiple programmers to work on the same monolithic application in their language of choice? Oh so the ui guys can code in VB and the backend people can write in C++ or C#. Mmmm ... I've seen many languages interoperate in monolithic applications such as C, Fortran, Tcl, Java so I'm not exactly sure what MS has added as new. And if we're talking about most applications which are distributed (ie. non-monolithic) nowadays, then the point of a CLR becomes even less clear.
Mensa member, beware of the high IQ
I don't often pick on people, but I think the combination of this signature with the post forces my hand. A more apt signature for this post would have been: MS shill, beware of the FUD
Sure, if you're writing an operating system or a low-level code execution framework tied to a specific piece of hardware and operating system, use C or C++. If you're wanting to produce high-level code and you're not interested in spending ten times the effort to do it, use Java, or Python, or Perl, or whatever.
Not all languages are equally appropriate tools for every purpose. Java certainly isn't appropriate for everything, but people who believe that C or C++ are appropriate for everything are likewise fooling themselves.
- jon
Ganymede, a GPL'ed metadirectory for UNIX
I really don't see Java's place here. In the hands of a good programmer, Java isn't any more productive than C++. Python is an order of magnitude more productive than either, and IMO should replace both for application-level programming. But Java? I just don't see the benifet, aside from a smaller learning curve.
A deep unwavering belief is a sure sign you're missing something...
That "faster than C sometimes" statement is pure Sun marketer drivel. Think about it this way, if Java can be faster, why does when anyone want a highly optimized Java VM they write it in C?
this sig limit is too small to put anything good h
Let's just hope they don't get too carried away and bloat the language. :-/
Uh... you're talking about Java...
Another wonderful example of headline trolling. The generics implementation is very old news to the java developer community. It's just been under a lot of scrutiny before getting put into the language.
for (int i : C) {... }
also allow :
for (int i : C.iterator) { }
so that iterators other than the default (the SimpleIterator named "iterator") could be used.
This would not complicate the iterator syntax much and would make using different iterators easy - and thats something that is often needed.
Since the "C" above is an expression, it could be a function that returns an "Iterable" - allowing interesting hackery to provide alternate iterators using inner classes or other fun. However while I think this allows programmers to do about what they need, it does not make things exactly readable and that is a bit bothersome.
Another thing I'd like, and would like to have efficient and easy to use, is a way to iterate over the indexes of an array - in particular a multidimensional array. I get tired of doing things like the following (which I can't get to indent easily) :
It would be much easier to do something like
Well, I've written around 250,000 lines of Java code, and I can count on one hand the number of times I found it necessary to use a debugger. I can't conceive of anyone saying that about C++ with a straight face.
I mean, maybe you have a god-like impression of a good C++ programmer, but having Java's enforced encapsulation, top-to-bottom integrated exception mechanisms (i.e., even for a null pointer), powerful, consistent set of thread-safe libraries..
- jon
Ganymede, a GPL'ed metadirectory for UNIX
Sather had a mechanism to use constrained genericity to handle the problems that templates are used for - and it worked well.
Everything was an object and a member of a class - though there were two kinds of objects and that did introduce a bit of complexity.
Sather also had preconditions/postconditions/class invariants that did the "by contract" thing well and that I'll bet cut my debugging time by 75% or more - at the cost of a bit more up front thought time ("Just what is the class invariant here?")
Sather had a very, very, very nice iteration mechanism. A class could define multiple iterators (syntacticly they had to end in "!"). Since these were defined in the class they had access to class variables without any "friend" or "public"/"private" jiggery pokery. As an example, since an array was an object, it defined an iterator elts!. So if "a" represents an array the following does exactly what you'd expect :
would do the Right Thing.Sather also had operator overloading (rather limited and pythonesque "a + b" translated to "a.plus(b)"), ways to skip variable declarations in some cases, a very simple inheritance structure and some odd syntax.
Because there are so many bridges.
for (int i : C) {}
or more properly
for (CMemberType cMem: C) {}
is something that I have to scratch my head about. The fact that people conflate i with c_mem and confuse a collection member with a loop index tells me that the new construct is going to give problems.
Yeah, yeah, Law of Demeter and all that style stuff, you shouldn't be pulling values out of objects and doing logic on them, you should be telling an object what to do and have it do it. But you can take all this OO purity so far, and the first way is instantly recognized by every C, C++, Java, and C# programmer.
You take all this OO purity stuff so far and you have something that looks like Objective C, Smalltalk, (God forbid) Eiffel, or C++ STL on a bad hair day. I am a Pascal person myself, but as of 2003 I am willing to concede that C-style syntax has won: there is a huge "installed-base" of programmers familiar with it. I am all in favor of staying consistent with it instead of going of inventing all kinds of bizarro syntax.
That is impossible. Java has to do the same as the C code, plus the extra overhead of doing the JIT. There is no way Java can be "as fast".
Ah, the "impossible" word. ;-)
You're presuming that the ahead-of-time compiler can "know" everything that the JITC can. That isn't true, in many common cases.
Another point regarding JITC compilation is that it can be for the exact target processor, something not typically the case for traditionally compiled programs.
All that said, current JVM performance certainly varies between 'better than C++' and 'worse than C++', with pathological cases in both directions.
The current 1.4 JVMs actually took a hit on some math operations, though that is supposed to be fixed in 1.5.
I hope gcj gets to the point where it supports the latest language spec. The libraries are tougher, and many of them aren't needed for interesting projects. For certain applications, an ahead-of-time compiler is nice.
By the way, for a good example of a 'fast' Java program, check out Eclipse from www.eclipse.org.
Galileo: "The Earth revolves around the Sun!"
Score: -1 100% Flamebait
Lisp is certainly not slow, even when compared with C++. It can even do certain things faster than C++ with most tasks in a very acceptable range, including being much faster than java and having a much better and more stable garbage collector.
http://www.norvig.com/Lisp-retro.html
Also Java sucks when compared to Smalltalk in terms of productivity and ease of use. Smalltalk should be a mandatory first OO languages in universities especially for concepts. Java is more popular than Smalltalk and has a lot more libraries, standardization and available programmers, but it still sucks, albeit less than C++.
Everyone tries to defend languages that they're fond of and used to without getting out of their comfort zone and trying something that might be better. If someone claims that Java is better than Smalltalk or Lisp, then they have not worked with Smalltalk or Lisp.
There are a lot of good languages out there with useful features, nice libraries and support for different paradigms which are better. Take Objective Caml for instance, which is very fast, strongly typed, dialect of ML and is certainly a better language than many, but it is doomed to live in academia, because people from the industry (pointy haired bosses) are too dumb and scared to even know about these things.
However, I see these new additions to Java as a welcome change. Hopefully someday people would not have to use some other language in the JVM just to implement closures and hopefully Java will catch up with languages like Lisp and Smalltalk and Python and Ruby and Haskell and Perl and Scheme and Dylan after it finishes catching up with Objective C.
The changes mentioned in the other products have been integrated into JSR-14. So while it would appear that maybe nothing that big has happened, you in fact have a useful 1.5 preview.
Scout's honor.
And the most funny part is Static Imports: it is one of the Microsoft additions to Java back in time when there was no C#, and Microsoft shipped Visual J++. That time Sun sued Microsoft for adding Static Imports to J++ (among other enchancements). Now they are adding Static Imports themselves. They should sue themselves now.
MSDOS: 20+ years without remote hole in the default install
I just realized some time in the future that Visual J++ might become standard-compilant language (without any change, the only change will be in Jave specs). They are planning to add metadata (think attributes) to 1.6, so the only thing left is delegates.
MSDOS: 20+ years without remote hole in the default install
For example, when using the visitor pattern, you have have a signature that looks like this.This allows you to write one hook for visitors which could return several different kinds of objects, as well as being able to depend on getting the correct one out in whichever method invokes the accept(...) method.
You can also use generics in your own ways in your classes. There are several other powerful uses.
Hey, why bother with a for loop. Isn't that just compiler bloat? As Kernighan and Ritchie pointed out:
/* do something */ ;
/* do something */ ; ... is theoretically unnecessary.
for (i = 0 ; i < SOME_VALUE ; ++i)
{
}
is completely equivalent to
i = 0
while (i < SOME_VALUE)
{
++i
}
In fact everything beyond if (...) goto
All I want is a secure system where it's easy to do anything I want. Is that too much to ask ~~ Randall Munroe
A number of my former-coworkers and myself are starting a little buisness. I am goining to be the primary software architect. We are still selecting tools. I tend to be an agressive persuader, able to defend my position even if I'm wrong. I am pushing for using Python. Another developer likes Java, but I have effectivly convinced him to go with Python. Because of my agressive nature, I must be carfull to gather as much data a posible. Then I need to insure that I base my decisions on an unbiased evaluation of the data. I hate making decisions and cramming them down everyones throught only to find out a year later that the decisions were flawed. BTW, my Java friend uses the same techniques as me in achieving team concensis!
What's with the copy? Just curious.
irb(main):001:0>
Sure autoboxing is optional. If you write 1.4-style code there won't be any autoboxing.
look carefully, he created an NSMutableDictionary, not an NSDictionary (which can't have data added after initialization).
Do you even lift?
These aren't the 'roids you're looking for.
Hey, let's start an argument on statically typed vs dynamically typed langagues. That's never been done before.
You don't need a dynamically typed language to be expressive. Have you looked at ML code, or especially Haskell code?
When you have type inference, your code looks dynamically typed, but retains the protection of the type checker. (Of course you have to live within the type checker's rules, which may not be appropriate for all projects).
# (/.);;
- : float -> float -> float =
I've never heard of JBoss before, but it seems it will turn almost any J2SE into a J2EE. But where do I get my J2SE (a Java 2 Standard Edition, runtime environment, libraries, and compiler) so that it works correctly?
Right now, on my GNU/Linux system with a PowerPC CPU (a Macintosh), I'm running Blackdown Java (J2SE) 1.3.
Anonymous Coward wrote: It is real, effective, efficient and fit my need ;) In my case
I am watching potential sources of ports (Blackdown, GNU Classpath, GCJ, and Jikes RVM) for emerging Java 1.4 or 1.5 that actually works. Until then I won't have working Java.
Anonymous Coward wrote: What MS fears the most is Linux + Java. Because it is a more powerfull that they can even provide. However in my case, working Java is an incentive for me to switch to an x86 computer with Microsoft Windows, in order to run Windows + Java.
==========
There are two types of people: those who are in the world, and those who aren't.
I stand corrected. Sun appears to have stealthed the change on this one. Good find. I had the generic download a long time ago. This is an update of some sort. Thanks for the pointer!
I agree with Squeak one can teach some powerful ideas even to kids (which is one of Alan Kay's goals). You can just like Java run applets in your browser.
Java is real freedom. Because i can change my OS, the product i use, the business model i got without beeing linked to a provider.
You are "linked to a provider": Sun. You are linked to Sun as much as Windows programmers are linked to Microsoft.
If you still think Java is a niche, is because since nearly 10 years you was sleepy
Quite to the contrary. When I started out using Java in 1996, it had the promise of becoming a full cross-platform, general-purpose, open programming language. But Sun failed to follow on so many promises that today it is a niche programming language. Java is mostly used for certain server-side applications.
Java is not the "magic key" for "IT magic kingdom", it is real, effective, efficient and fit your need.
Maybe it fits your needs, it doesn't fit my needs: its awful toolkit, poor numerical support, proprietary runtime, flaky cross-platform behavior, and lack of third party implementations alone make it a poor choice for me.
If the Linux gurus where stoping the bashing against Java and looks at the marvelous project made from the opensource comunity they will understand that Java is realy an opportunity to strengthen Linux as an OS leader.
Open source users use open source software. Java isn't open source. It's free-as-in-beer, and that isn't good enough. All efforts to produce a complete, conforming open source Java implementation for Linux have failed, mostly because Sun, like Microsoft, keeps adding APIs faster than people can re-implement them, and because Sun's APIs are not very well suited to implementation on Linux.
Linux may need some improvements on the desktop/client side (but, then, so does Windows), but Java isn't providing them. In fact, even Sun is using Gnome/Gtk+/C++, not Swing/Java, as the desktop for their workstations.
I was trying to be funny :o)~~
What are "managed languages"? P-code interpreters/JITers and languages that target them have been available for decades. Neither Java nor C# "leading" in those areas.
Could it be that you're just inventing a new buzzword here? "C# is taking over the lead on byte-compiled languages" would make C# look less unique and suggest too many similarities to Lisp, Ocaml etc., so it has to be "managed languages", uh huh.
Btw, any turing-complete machine can express all C++ semantics.
Oh your argument is that the system libraries are inadequate. In what way do you feel they are less in capability than .Net?
C# lets me call system libraries directly, and it lets me access native data structures directly and efficiently. For Java, I have to write cumbersome and slow JNI wrappers to native libraries.
Furthermore, people are developing Linux-specific libraries for Mono at a rapid pace, while Java program on Linux mostly use Sun's WORA libraries, which aren't very good.
gets mapped to something like
Couldn't they just introduce a standardized macro processor/preprocessor and introduce such minor additions as part of a standard macro library (or let users write them themselves), instead of having everybody wait for new language versions?
> Still, I don't remember syntax for handlign
> covariance, contravariance, invariance, etc.
> Was it there and I didn't see it, or are Java
> 1.5's generics truly different form C++
> templates.
Java generics are fundamentally quite different
from C++ templates. There is nothing like
covariance etc in C++ templates.
If Java supported closures, the 'foreach' construct wouldn't have to be a special case. I think C# is going to have something that looks a lot like closures but for some reason, they are going to avoid providing general-purpose closure support (it's sad, really).
On the other hand, it looks like the value/class distinction in C# is going to help make its generics more efficient than Java's. It'll be like C++ except with runtime specialization when needed, so the disk image wont be bloated, just the memory image.
Why would any C++ programmer bother to do manual memory management? Try writing STL style code sometime. I managed to write an entire simulation once in C++ without using a single new/delete call. Between the STL's value semantics, the resource acquisition is initialization mechanism, and smart pointers (which implement reference-counted GC) C++ memory management is a whole lot more powerful and flexible than Java memory management. And if you want, you can always use a garbage collector, and many C++ applications use it to great effect. Now, you can get around all of these mechanisms in C++, while in Java, you can't. I consider this a strength, not a weakness. If I want to allow the saftey nets to work, I just write straight forward, safe code. If I don't want the saftey nets to work, I have to conciously work around it, at which point it becomes my responsibility to make sure n othing breaks.
There are lots of applications that don't require sandboxing, including most application development. And lack of static typing is a feature, not a bug. Python uses strong dynamic typing, like Smalltalk and Lisp. Meanwhile, Java, C++, ML, Haskell, and others use strong static typing. They are simply two different paradigms, and each has its attended benifets and limitations.
A deep unwavering belief is a sure sign you're missing something...
I don't like the idea of C# but at least MS handed it over to ECMA.
Microsoft has handed C# to the ECMA, not .NET.
The language is insignificant compared the the framework, that is the large set of APIs, libraries, documenation, and endorsements that come with the language.
C# being offered to the ECMA is a marketing ploy.
Look at ECMAScript. It's a standard isn't it? Now how come we still have to be careful which browser we're in when we write JavaScript/JScript for the web?
It does not matter what ECMA says. Microsoft will always have the de-facto standard on C#, because they produce the environment Visual Studio .NET used by most professionals, they distribute the most runtimes/CLR, they produce the documenation, they have the marketing muscle ( $40B in the bank ).
Don't fall for this cheap trick.
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
I don't see any performance issues in my J2EE apps.
Java is slow largely becuase of JVM startup and GUI framework. But J2EE Apps don't have to worry about either of these. The J2EE Server's JVM is started only on Application startup, which only happens when you need to restart your J2EE Server. And there's no GUI layer ( JSP for presentation ).
Truth is in large server-side apps, I'd expect J2EE with JSP to kick the crap out of PHP, PERL and others.
Based on upvotes, Ageism is the only "-ism" Slashdotters care about and think isn't SJW
You can already declare arrays in-line. So if they were to define an appropriate constructor, you could do List l = new ArrayList(new Object[] { "foo", "bar", "baz" }).
That is verbose of course. What they really should do is add collection manipulation stuff to the language, so you could go List l = ( "foo", "bar", "baz" ) and be done with it.
I believe that that scripting languages get most of their advantages (more functionality with less code, easy to develop in, etc) because they have collections as first-class entities. It's not as if it would be polluting the language... How often do you write code that doesn't use some kind of aggregate data type? For the language to not recognize that is just silly.
As I constantly bitch on my programming site, J2DK/RE 1.4 still hasn't been released for Linux on PowerPC. I love my iBook and plan to buy an iMac; if the two are left further behind for Java I just might abandon it. "Write once run anywhere." is meaningless if most platforms don't have new features for years.
I recently switched to C for a few projects; the speed is surreal by comparison
You can't judge a book by the way it wears its hair.
RandomArrayIterator(int a[])
with an iterator named iterator and then do something like :
for (int i : RandomArrayIterator(a) ) {
But the spec (yes, I did read it) implies that the result of RandomArrayIterator must be an object that defines iterator. so this is really shorthand for : ... }
for (SimpleIterator sit = RandomArrayIterator(a).iterator() ; sit.hasNext() ; )
{ int i = (int) sit.next() ;
I think two things about this make me uncomfortable. First is the fact that I need a class with the right type to return from "RandomArrayIterator" which defines "iterator()", (at least, this is the implication of section III "Semantics") then I need a class for the result of the "iterator()". (Yes, I do realize that these can indeed be the same class.) The second is the "specialness" of the defaults (which is actually the second call there "iterator()").
There's another way to structure the code that rearranges this to iterate over all the elements of g and then over every element in the associated c array. And then iterates in a double nested loop that didn't appear above.
There are a couple other ways to do it too, but they require substantially more code complexity and its not worth it here - there are a number of other things that currently dominate the runtime. So I'm using the simplest one to hand. If its a problem and this ends up the bottleneck I'll worry about it then.
"Premature optimization is the root of all evil."
I doubt that the MS JVM will ever become compliant. There was way too much MS proprietary stuff in there.
seSales, Point of Sale software for OS X.
I have little doubt the "metrics you've seen" are in fact very unrepresentative of real world apps. You should be looking at papers like this:
p df
http://www.ipd.uka.de/~prechelt/Biblio/jccpprtTR.
Now, the interesting thing about your post is that it sounds like (notice I say "sounds", not "is") you're a Java person, and you're more than a little threatened by Python. Sure, Python is faster for most things, requires less code to accomplish the same task, and is much easier to maintain, but Java still has it's place. You're safe.
The main reason that I did not go with OCaml is the size of the project. It has the potential of being rather big and might eventualy involve a diverse development community. I don't know how good OCaml is for large projects, or how easy OCaml code is to maintain. On the other hand, OCaml targets the problem space I am working in ( which I have'nt mentioned). At some point I will be writing a toy OOP OS in OCaml, Oh my.
I also like Common Lisp. I have never used it but I plan to. Unfortunatly, my plate is kinda full right now. Honestly, I never concidered using it for my current project. BTW, I do plan on writing an experimental 3D desktop in Lisp. Ok, so I'm sick.
Another poster mentioned Jython. Jython was one of the factors that helped me decide to use Python. Yet another mentioned Ant. Ant realy needs to leave the Java anthole. Why it has not gained more acceptance is beyond me. Ant can be more then "that build system for Java". Build, packaging, and distribution/installation issues are one of my specialities. I know more about "make" then is healthy. I have developed techniques to get around almost all the limitations of make ( without relying on ksh!). The problem is the obnoxious syntax that results. Even with the greatest care taken to maximize maintainibility, the resulting Makefiles are often downright Byzintine. For huge projects ( which are also the ones that require the most attention to maintainibility), make just falls apart. One point to make, both Ada and Python take care of a lot of the configuration managment taskes normaly delegated to make.
It also appears that using Java does not result in a potentaly abusive relationship with Sun. The fact that Sun owns Java still makes me a bit nervouse.
A final note, after 20 years, I am pretty fed up with fixing bad C code and I find C++ obnoxious. I do not plan on using either for any of my non-job-related projects, though I might make a acception for C in some very special circumstances.
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Confucius say, "Find worm in apple - bad. Find half a worm - worse."
Introductions are in order: Good day sig guy, I'm whiny grammar guy. I teach English as a second language (part time now, full time in 2001-2002).
:)
Believe me, the sig is wrong. It has nothing to do with "modding" being a verb. And as for grammar checkers, they're pretty awful, and make mistakes on even simple grammatical constructs. Run your sig through an English major and see if they come out as unscathed... Two possible correct versions are:
Modding This Comment Will Not Alter Its Accuracy or Its Insightfulness
or:
Modding This Comment Will Neither Alter Its Accuracy Nor Its Insightfulness
Honestly. If you don't believe me, drop by an English teacher at your local college/university and get a second opinion. Of course, if I'm gonna get picky the capitals should really go too...
Here we go again with this disguising argument. Name one vendor who implemented their application using J++ and then discovered after its release that it wouldn't run on anything but Windows. Most programmers who really cared about cross-platform development probably didn't use J++. Most of those who did use it were targeting Windows.
Doesn't this have a tiny bit to do with Java always running inside some minimal debugger? Imagine rigging C++ in such a way that it will always run through gdb and on error will provide you with a stacktrace. The stacktrace gives enough info for the majority of the bugs, but would you then with a straight face claim that you can program C++ without ever using a debugger?
Doesn't this have a tiny bit to do with Java always running inside some minimal debugger? Imagine rigging C++ in such a way that it will always run through gdb and on error will provide you with a stacktrace. The stacktrace gives enough info for the majority of the bugs, but would you then with a straight face claim that you can program C++ without ever using a debugger?
Well, could we also arrange it that C++ can run multithreaded in such a way that if any thread throws an exception (on an attempt to dereference a null pointer, say) the other threads can continue to function? And can we arrange things such that it is impossible for any piece of code to scribble over random pieces of memory? Can we also add on a wholly-integrated memory management system, supported by all C++ libraries?
I do claim that I can program Java without ever using a debugger, because Java's rules are stringent enough that silent corruption and delayed effects don't occur, and because the Java Runtime provides enough support in many cases to be able to diagnose things whenever an exception (_not_ a core dump) is thrown.
My whole argument is that Java really and truly is a significant increase in programmer productivity over C++. If you have this hypothetical super-C++ development environment to go along with your hypothetical super-C++ programmer, perhaps this wouldn't be true for your case.
- jon
Ganymede, a GPL'ed metadirectory for UNIX
You're claiming that reference counting is a whole lot more powerful and flexible than Java memory management?
Surely you're not claiming that there exists a garbage collector for C++ that can work with arbitrary C++ code? I'd hate to have to reimplement all the libraries I wished to use in order to make them work with a given garbage collector.
- jon
Ganymede, a GPL'ed metadirectory for UNIX
I'm claiming that C++'s memory management overall is more powerful and flexible, because you can tailor your memory management scheme to the task at hand, rather than being forced to work with the garbage collector. Right now, I'm using C++ in an OS kernel. Reference-counting smart pointers work very well in that environment, while a GC would cause latency unpredictibility.
C++ garbage collectors can work with almost arbitrary code. The basic requirement is that your code doesn't obfuscate pointers. Some C-style libraries do this, but you can hardly blame C++ for leftovers from a time before modern C++ design existed. More importantly, lots of C++ libraries are available that *don't* do screwy pointer tricks, so you have no excuse to complain if you use one that does. That said, garbage collection is not the optimal method to use for C++ code. C++ is explicitly designed to make garbage collection mostly unnecessary. A quote from Alexander Stepanov, designer of the STL:
"STL data structures will eliminate the majority of the needs for using new. Most people should not allocate arrays because STL does an effective job in doing so. I never need to use new in my code, and I pay great attention to efficiency. The code tends to be more efficient than if I were to use new. With the acceptance of STL, new will sort of fade away. STL also solves the problem of deleting because, for example, in the case of a vector, the destructor will destroy it on the exit from the block. You don't need to worry about releasing the storage as you do when you use new. STL can dramatically minimize the demand for garbage collection. Disciplined use of containers allows you to do whatever you need to do without automatic memory management. The STL constructors and destructors do allocation properly. "
He has a very good point. The first time I used the STL was on a scientific simulation. I did not know a whole lot about "proper STL design" or about modern C++ design in general. I wrote the code in a way that came naturally when using the STL. It was only after the fact that I realized that I had zero calls to new/delete in the entire codebase.
A deep unwavering belief is a sure sign you're missing something...
Interesting, thanks.
- jon
Ganymede, a GPL'ed metadirectory for UNIX
Ehrm. I have to tell you, I for one am not very happy with that paper. It is a comparison in certain aspects (by some metrics which you may or may not believe are the right ones) of several languages which are not all really geared to the same purposes. As a clear example of this, you might consider the start of the book "Learning Python" from the O'Reilly series where Python's place in the spectrum is indicated. This includes the question "how does it compare to Java" and the answer is flatly "It doesn't; Java and Python are meant for different things and complement eachother rather than compete". You can also see this in the abbreviated "problem statement" in that paper:
That's on page 8 -- and indicates that the "ease of use" metric will always be skewed since the problem is geared towards scripting languages more than system-level languages.
All that aside, it seems to me you are on very thin ice at best by referring to this paper for leads on what is "better" or "faster". The paper is some 3.5 years old -- that is a very long time with a lot of changes in between.
and you're more than a little threatened by PythonDon't see why he would be. They aren't aimed at the same problems. Hell, they are in such a level of non-competition that there is even a Python for the JVM (JPython) with integration into Java.
Python is faster for most thingsFor whatever that means. When it comes to perceptual speed, it happens often enough that I cannot tell the difference anymore. Like I said, times change.
and is much easier to maintainNow that I will outrightly contest.
You have to remember where the "faster than" comes from (and understand why it's sometimes): it's based on runtime optimisations to the program that a VM (any VM, not just Java) can do and a pur sang compiled system cannot (i.e. using the advantage of being able to rewrite code on the fly to optimise for the specific situation).
How often this occurs is anybodies guess. Whether it would be of any use in the JVM itself, I don't know. That trying to write a JVM in Java is inviting the chicken and the egg problem however, is obvious.
"Surely you're not claiming that there exists a garbage collector for C++ that can work with arbitrary C++ code?"
Of course there is.
The Boehm-Demers-Weiser conservative garbage collector works very well.
On multi-threaded systmes, it can outperform malloc/free based allocation because less locking of the heap is required.
With MoL, I can run OS X in realtime. It's a decent operating system, but Debian's package manager makes it a better choice for me.
Porting it from Linux/x86 or Linux/UltraSparc should be as simple as crosscompiling; nothing as complicated as the OS X port.
I use Kaffe, GCJ, and Blackdown's 1.3.1 java port on my PowerPC boxes. Wonka works well on my Zaurus. Sun's java seems to have a monopoly on Swing. IBM's seems interesting, but I haven't had the time to look into it yet.
If MoL has been ported to OS X, it would be a much faster alternative to VPC.
You can't judge a book by the way it wears its hair.
Ah, "the JIT knows better" argument.
In fact, in a C/C++ environment you can optimize a particular program knowing exactly which paths and variables it is going to use, this is called `profile-based optimization'. You can try this with the Intel C/C++ compiler or with a recent gcc.
Now you need a test sample of the data your application is going to work on, but then the optimizer will make use that data exactly as a JIT compiler would do.
If you try this with a realistic application (not a toy 10 liner) you will find that with few exceptions that super-duper optimization strategy does not do significantly better than normal optimization (it does get a few percent faster). What I mean is if you try this method on an already somewhat big, mature and tested application you will get few benefits.
This is because in a realistic application, things get optimized by the interaction between programmers and testers already. Often inefficient code will have been removed already, and what is left is there for a reason so there is not much to work on. Try it for yourself sometimes.
Sorry I should have made it clearer, that wasn't my point. Even if you run your path-optimized executable on the *test* data, which is basically the most advantageous figure case, you don't get that much of a speedup over a normally optimized executable, if the test case is sufficiently complex to represent reality (if it's a toy test case, then sure you do get some speedup, but who cares?).