Java 7: What's In It For Developers
GMGruman writes "After five years of a torturous political process and now under the new ownership of Oracle, Java SE 7 is finally out (and its initial bugs patched in the Update 1 release). So what does it actually offer? Paul Krill surveys the new capabilities that matter most for Java developers, from dynamic language support to an improved file system."
You can usually spot "likely to be baseless" criticisms on slashdot, even if youre not up to date on the particular topic. Usually they are made by ACs.
I assume the author meant, "... to improved file system access." See here.
If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
It's just improvements to the I/O API. Java has the New IO API for doing I/O. java 7 has extended it, hence NIO2. http://www.ibm.com/developerworks/java/library/j-nio2-1/?ca=drs-
Ah yes. The old "blame the language for the lack of a developer's skills" ploy. It's a sad carpenter who blames his tools for his incompetence. It's a sadder carpenter who blames a tool for other carpenters' incompetence.
Just curious: what do you think all those "Java weenies who couldn't code themselves out of a paper sack" would do if Java died. Would they magically become skilled code gurus because Java doesn't exist? Or would they be incompetent coders in a different language?
As Dilbert so succinctly put it: you're solving the wrong problem!
I don't know what you were voted up for, but it is kind of obvious that it means "an improved file system API".
Along with promoting an easier multithread API the artical also contain the paragraph:
Project Coin's diamond syntax for constructor calls lets the compiler infer type arguments, and the try-with-resources statement helps the compiler make reliable code by automatically closing files, sockets, and database connections when developers forget to do this, Ratcliff says: "That's something that's been tripping up developers -- especially young developers -- for years. That'll be a good productivity improvement and will reduce bugs."
This is almost like programming language lock in, once you have programed in Java for a few months you are incapable of writing functional C++ code and if you lean to program in java you have no idea why your non java programs fail.
...please don't let all these fancy tech buzzwords stop Minecraft from working.
While you are busy being a jackass and letting us all know you have never made a single mistake EVER with resource allocation, some of us have work to do and enjoy the fact that we will never have to type try{openFile}catch(DamnException){}finally{try{closeFile}catch(AotherDamnException){}} ever again.
Let me get this straight - you think that a harder programming language increases programmer competence. While I'm not defending Java, this logic is deeply flawed.
If you follow it to it's logical conclusion, the best programmer's flip the machine bits by hand...
If our elected representatives no longer represent us, do we still live in a Democracy?
Well since JDK downloaded, ant XML in my head,
jars, wars, and .class files all night with laptop by my bed,
well java you look so fine (look so fine)
for C++ errors took all my time,
for you to help me java
get Stroustrup outta my heart.
help me java, help help me java
help me java, help help me java
.........
help me java, yeah, get him outta my heart.
Bjarne was gonna be my god,
and we gonna be his bitches,
preprocessor bloat came between us,
patterns ruined by the glitches
How compatible is Java 7 with Java 6? Can I run the Andriod emulators? Is it more secure than java 6? I would like to use Chrome but it always runs Java by default and I got owned a month ago from this exploit. I hate using IE as it is the only browser I can disable Java from
http://saveie6.com/
Obligatory xkcd
If you follow it to it's logical conclusion, the best programmer's flip the machine bits by hand...
Correct: the best programmers can use machine code if needed. But the best programmers also don't abuse the apostrophe as much as you did...
Those who can make you believe absurdities can make you commit atrocities. - Voltaire
Well going by previous statements by Larry Ellison and Oracles actions in regards to Red Hat Linux. They'll wait until your stuff is popular and then just take it and start charging support fees for your stuff.
"If an open source product gets good enough, we'll simply take it" link
Arguments for slow Java are so 1990's. Every Java application, desktop or otherwise, I have written has been very snappy, very responsive. Swing has always had places where you can get caught making your own application slow to load or slow to respond. I believe that the community and Sun have really ushered in conventions to mitigate that. SwingWorker (part of core Java Swing), Timing Framework [java.net], JPA (especially our friends at Eclipse), and other community frameworks have really changed the way coders write Java desktop applications in ways that avoid a lot of the pitfalls that came with the 1.1, 1.2 and so on versions of Java.
I think this is the reason why Oracle really needs to embrace the community. It has been because of them that Java has gotten better and faster with each release. People who still talk about how slow Java is and how crappy Swing is, are still living in the past. Is it the perfect platform? No, but it has gotten multiple times better than where it was.
"...Paul Krill surveys the new capabilities that matter most for Java developers..."
Do these developers include Android developers? Well, that's the question. After all, Java code will run on Android's Dalvik VM without modification, right?
Ruby showed the value of this technique as well. The Java haters live in ignorance. Java is frequently used to solve difficult integration problems that require the use of diverse resources; database sessions, networks connections, file system resources, etc. Simplifying the code necessary to do this while reducing the chances for leaks is a genuine improvement.
It won't be jilted in Windows 8. Why you people keep perpetuating this myth? Just because C++ is making a comeback (it was about time) and JavaScript/HTML5 is finding a new home, doesn't mean that we throw away .NET Framework 4.5.
"Sum Ergo Cogito"
As a developer I could care less about Java itself. It's the new Cobol.
It's in an awkward spot. For anything high level I'd rather just use Python. And for the few cases where Python's not fast enough, it's easiest to jump down to C++ and write a module I can call from Python.
The best thing about this new release are JVM improvements for dynamic languages, which should help out projects like Jython, JRuby and Scala.
Maybe not
If you follow it to it's logical conclusion, the best programmer's flip the machine bits by hand...
Correct: the best programmers can use machine code if needed. But the best programmers also don't abuse the apostrophe as much as you did...
If I found out someone was manipulating code at the machine level - I'd definitely have issues with that. You lose portability and expose yourself to a nearly infinite amount of issues - there really aren't many cases left where this would even be remotely advisable.
:p
PS. Nitpicking grammar - that's nearly as bad as using machine code directly.
If our elected representatives no longer represent us, do we still live in a Democracy?
http://www.java.com/en/download/faq/java7.xml -- "Why is Java SE 7 not yet available on java.com?
Java SE 7 is the latest release for Java that contains many new features, enhancements and bug fixes to improve efficiency to develop and run Java programs.
Why is Java SE 7 not yet available on java.com?
The new release of Java is first made available to the developers to ensure no major problems are found before we make it available on the java.com website for end users to download the latest version. If you are interested in trying Java SE 7 it can be downloaded from Oracle.com..."
It sounds like even Oracle, itself, doesn't think Java 7 is ready for the public!
Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
Ah yes. The old "blame the language for the lack of a developer's skills" ploy. It's a sad carpenter who blames his tools for his incompetence. It's a sadder carpenter who blames a tool for other carpenters' incompetence.
I can't speak for other workplaces, but there are certain languages that people at my company develop in and you can get a pretty good idea of a programmer's skill level by what language he develops in. Anyone who develops in only one language is very good at that language. S/He can solve any problem you throw at him/her in that one language. There's nothing wrong with that per se, but demand is not constant. Sometimes, they need more people in a different department. If you are a one language programmer, you have very good odds of being let go when that happens. If you are competent in many, you can go far.
The hands down best programmer I ever worked with could code in anything from FORTRAN 77 through .NET and his code was always amazing. But, that's one out of hundreds.
LK
"Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
Among the delayed capabilities are adding Lambda expressions, or "closures," to Java for multicore programming, ...
Lambda expressions are not closures, and neither enable parallelization. Yes, the Wikipedia articles for both are dense swamps, but couldn't you have at least tried to ask someone? Please?
Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
You need serious attention of a psychotherapist. Hurry!
Can we get it reviewed by someone who isn't a fanboi and butt licker?
I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
I believe this is actually because the JVM for 7 hasn't made it to the Mac yet.
If you follow it to it's logical conclusion, the best programmer's flip the machine bits by hand...
Correct: the best programmers can use machine code if needed. But the best programmers also don't abuse the apostrophe as much as you did...
If I found out someone was manipulating code at the machine level - I'd definitely have issues with that. You lose portability and expose yourself to a nearly infinite amount of issues - there really aren't many cases left where this would even be remotely advisable.
Well, that's why I emphasized the "if needed" bit. I suspect that cases where a real need for machine code might arise are probably limited to embedded systems and other single-architecture real-time applications, where a complete re-write (from specs) would be needed for a change in architecture.
PS. Nitpicking grammar - that's nearly as bad as using machine code directly. :p
Hmm... now was I picking at a grammar nit or a spelling nit? Or were you suggesting that grammar related to a disgusting activity is nearly equivalent to direct use of machine laguage?
Those who can make you believe absurdities can make you commit atrocities. - Voltaire
1. C#'s 'using' block so I don't have to use try/finally everywhere.
That's in Java 7, in the form of the try-with-resources statement.
Why are you both confused/assuming? Too busy to read the article?
No sig today...
there is a difference between understanding how the computer does what it does (and a logical extension of that is knowing how to change it should that be required), and actually attempting to do something via machine code. but you're right, modern day programming is a different beast than old school logic gate manipulation.
Arguments for slow Java are so 1990's.
Nope, still as relevant as ever. Java simply doesn't scale. Try running your microbenchmarks with a million objects in memory...
No sig today...
It's really not that obvious in the summary.
To be fair here compared to other interpreted languages Java is still the king of the hill. By far.
Disclaimer: Yes, interpreted. Bytecode is interpreted, even with stuff like JIT.
I am not sure why people keep saying this even in the light that Microsoft has said that they are bringing .NET even closer to the core API here.
HTML 5/JS is just being added onto what is already there. The fact that no one has heard about Silverlight has made everyone worried. Microsoft has talked about Silverlight just not to the degree that everyone had hope for. So since no one likes waiting until September, we'll just spread rumors and make Microsoft pay for suddenly wanting to do things like Apple and keep quiet.
It sounds like even Oracle, itself, doesn't think Java 7 is ready for the public!
And they are right indeed...
Thats why the summary links to an article. You must be new here.... oh wait... You'll fit in great here. Carry on.
I want this account deleted.
If it is that bad, then don't release it!
Did update #1 even fix it?
Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
AFAIK it is planned to be fixed on update 2. Which is kinda retarded - even for Oracle standards.
You forgot "once upon a time" and "they all lived happily ever after."
Yeah. Basically it's this:
There were a number of proposals for how to improve Java. Some of them were controversial. The controversial ones got moved out to Java 8, and the ones that everyone agreed on made it in to Java 7.
In essence, this is a good, solid, incremental update.
My idea of a perfect programming language is somewhat different, but I can respect this as a solid improvement.
"First they came for the slanderers and i said nothing."
So, it's basically like C++'s ancient RAII...
You know what? Bjarne Stroustrup was right: The more useful Java becomes, the more it approaches what C++ already provides.
Wow, that is seriously messed up if it is true. I will stick with the older stable version (v6u27) that just got an update last week. ;)
Ant(Dude) @ Quality Foraged Links (AQFL.net) & The Ant Farm (antfarm.ma.cx / antfarm.home.dhs.org).
Java simply doesn't scale. Try running your microbenchmarks with a million objects in memory...
That sounds like EE development and not SE development. If that is the case:
That sounds like a problem with the design. Try using more lock free structures, you can use the java.util.concurrent package to find tools that will help you build these easier in Java 5 and better.
If your are indeed talking SE development, why is your desktop application using millions of objects in memory? I do not think it is wise to juggle that many objects in any desktop platform. Usually, and this is just me, I flush objects out of memory and to disk, network host, database file, or something other than memory once I hit over more than I could keep in my head. Pagination designs help smooth this out for users and using task workers keeps everything moving smoothly. For the curious the pagination design pattern in Java SE looks exactly the same using the QT toolkit (if you use that toolkit.)
I don't know your situation and I won't pretend that I do, but in most cases I find it is the developer just assumed Java would do this or they are still following an old convention that doesn't work well with today's JVM. Either way, EE or SE, if you are dealing with millions of objects in memory, there are ways of moving that data around to keep space on the stack for responsiveness in your application. Just having a million objects in memory just because is not a good idea.
Just curious what use case do you have that requires you to have that many objects in system memory at once? Are we talking simple objects or pretty complex ones?
Disclaimer: Yes, interpreted. Bytecode is interpreted, even with stuff like JIT.
Um, no, it is not. There really isn't much to debate here. This is like debating if JIT is the same thing as a compiler.
Bytecode IS interpreted (by the JVM), sorry. Jazelle was the only attempt of a hardware JVM implementation that i know of and even that was short lived.
Lolcode sucks, it just sucks in a fun way :/
Haha, if java doesn't scale why is it the defact standard for any large enterprise?
Probably not the best language to write a ray tracer or an on the fly 3D engine but the stuff I seen java do is pretty impressive. Go take a look at throughput of something like Websphere MQ.
Let's look at the fundamental differences here:
Interpreted code does the following: Bytecode is loaded by a native program into an Interpreter. The Interpreter reads the code and sends native code to the machine or to another piece of software that can do such.
JIT code does the following: Bytecode is loaded by a native program into a compiler. The bytecode is compiled into native code. The native code is sent to the machine.
The difference is the following, the bytecode in JIT eventually becomes the native code. Interpreted bytecode never makes it as native code. Both can be optimized by saving the bits of machine code that get generated, however JIT usually means that the native code follows closely what the original bytecode looked like. Interpreted usually has to make assumptions on how execution should happen and in what order.
I hope this means they will have basic functions like copy built-in. I was quite surprised when I took up Java on Android that such a function was simply not there. And that I basically had to add it myself (luckily code snippets all over the place, but still). The whole I/O felt very primitive to me - it may have its advantages to do it that way, but me coming from Python is used to being able to address files much easier.
The problem with Java is that the startup time is poor, which is often ignored by benchmarks.
First, for an apples-to-apples comparison, this is the startup of a typical installed .NET app:
* Operating system loads the cached, fully compiled EXE or DLL.
* Operating system loads the cached, fully compiled System library DLLs.
If the app is not cacheable (not signed, not properly installed, or whatever), then the process is almost the same, except that the first step changes to "Operating system loads the bytecode, and compiles it one method at a time on demand and runs it". All of the system libraries are always fully pre-compiled. No code ever runs in an interpreter.
Compare to Java:
* Decompress Application JAR files (this is a ZIP file internally) -- this is slow. At best, you get 30MB/sec for typical compression ratios.
* Decompress Java system JAR files -- this is also slow, and there's a lot of it to load. At this point, anyone without an SSD gets to twiddle their thumbs while the disk makes crunching sounds for a while.
* Start running application (including the system libraries) using an interpreter -- this is several times slower than compiler code.
* At some point, some of the code (usually not all of it) is compiled -- now your app is probably fast.
Even for server apps, this is bad. I've seen a large J2EE app thrash a server (100% CPU!) for tens of minutes before it settled down. Compare that to, say, ASP.NET, which if precompiled can launch in a few hundred milliseconds!
Sure, in long running benchmarks, Java is faster, but the user experience is less than stellar.
There's no good reason for this. Oracle could use a container format that's uncompressed by default, pre-compile, cache, etc... but they don't. I know there's third-party JVMs that do that kind of thing, but the majority of users stick to the "official" JVM.
There's also still this attitude of having "User" vs "Server" JVMs, as if people still had single-core PCs. My laptop has 8 logical 64-bit CPUs!
n my experience most of Java's performance improvements have had more to do with advances in hardware.
I can tell you that all compilers have advanced in step with hardware improvements. Also, I have easily ran Tomcat 6 and Linux on a Dell OptiPlex GX300. Trust me I have tons of 90's hardware that I am required to make work and enjoy hacking on. I still change DIP switches on ISA cards at my work place.
The difference is in the how. JIT gives huge improvements in stuff like loops and basic constructs because these are easily translated into machine code. But for Java bytecodes dealing with OOP constructs (new, for example) this basically means that the JIT has to embed a lot of machine code as an abstraction layer. The improvements there are minimal because this code is doing pretty much the same the JVM would do processing that bytecode on the fly.
Making a very loose comparison, i could easily bundle a JVM implementation and Java bytecode into an .EXE and call that "compiling". In fact, there's software that does exactly this. Quick Basic did it too back in the DOS days.
JIT is great, but it is not a compiling by any stretch. Is a hybrid approach that works pretty well, but every time you fire up your Java code the JVM will process it for you, interpret it and translate it, when possible, to native machine code on the fly. In fact, for big files this process can add a significant start up time penalty.
What are the prominent desktop applications written in Java? I'd say Azureus, Eclipse, and OpenOffice (and personally I'm using JDownloader, but that's a bit obscure) - all of which are dog slow (heck, every one needs a splash screen when starting). So you can't really blame people, for whom these applications are their only experience of Java, for perceiving Java as slow.
I am trolling
Once Java is launched, you are right. I have a Java program I use on a regular basis, and it is a fine program, which is why I use it, but I hate to launch that thing because it takes forever. Makes me want to rewrite it.
My biggest problem with Java isn't the language, which I have grown to respect, it's the Java programmers. They think they are using Java so they don't have to worry about memory, that things can't leak. No, you still can stick an object in a queue and forget about it. Or register a Swing listener and need to clean it up. If you aren't thinking about the lifecycle of resources, even in the back of your mind, you're probably leaking them all over the place.
"First they came for the slanderers and i said nothing."
Java simply doesn't scale. Try running your microbenchmarks with a million objects in memory...
Can you give an example of a managed, cross-platform, enterprise language for which the above statement is incorrect?
Google just needs to re-implement all their shit in C++ and we can get an "Oracle can Blow Me" congo line going. Having a native mode executable build down to 20 *kilobytes* and actually run in 20 kilobytes is freaking awesome. Having real system level control over your hardware, awesome. As long as you're not seduced by template fuckery (You know who you are, "lets factor prime numbers at compile time" template people!) or dynamic link libraries, it's a fine language!
I'm trying to teach myself to set people on fire with my mind... Is it hot in here?
The problem with Java is that the startup time is poor, which is often ignored by benchmarks.
I can understand this poorly written application usually have very long start up times. Usually if you need to yank in a ton of stuff you can do that at runtime in the background. Dynamic loading.
Compare that to, say, ASP.NET, which if precompiled can launch in a few hundred milliseconds!
You can precompile EE applications as well and have them start up in milliseconds. I think the PHP guys are the ones who came up with this in the first place but then of course I am sure that at some point Xerox came up with the idea first.
There's no good reason for this. Oracle could use a container format that's uncompressed by default, pre-compile, cache, etc...
As far as EE goes you are not required to use WAR or whatever they are called. In SE that is being addressed in Java 8, but you can already do some of it with dynamic loading. .NET is snazzy in the fact that the VM is loaded with the OS so you only incur the cost at startup and shutdown. Maybe that's why it seems to take ten minutes to turn off a Windows machine.
There's also still this attitude of having "User" vs "Server" JVMs
So does .NET, except it's not a switch away. Do you think they use the same .NET VM in Windows Server as they do in Windows Home whatever?
One could say the exact same thing about VTables in C++, lookup pointers in C or RT-Code in Objective-C. Which bring me back to my point we could debate this at about the same rate we could debate compiler vs JIT. Machines are state based, OOP is artificial no matter the platform, a CPU is not made to natively understand the concept of an object be it C++, C#, VB, or Java.
At some point a machine will not natively do everything a language requires and thus extra "fluff" will need to be added. That's why Interpreted vs JIT is defined as who sends the executed code to the machine and when, not what is executed or how it goes about it. C++ compilers add machine code abstraction layers for all kinds of stuff like virtual pointers and polymorphism, does this suddenly classify every C++ compiler as JIT?
In the 50s and 60s, programmers were skeptical of using a high-level programming language in place of assembly, but the productivity and understandability increase was too great to ignore. Today, using assembly is frowned upon expect in very specific situations. In fact, compilers are generally regarded as being capable of doing a better job than a human could.
The computer exists to do work for you, and that inevitably includes managing its own memory. Automatic memory management in some form is an inevitable future for most application programming.
No. C++ generates binary machine code. It is not portable. It is loaded directly into memory where it is executed directly by the CPU. There's no "just in time" there, at all.
Is that why Java installs so many "Quick Starters" as background processes and plug-ins in every nook and cranny it can?
Wow, so it's almost like lisp?
Don't complain about syntax, grammar, or spelling. There is no.hell like input on android.
Maybe king of the popularity hill. A lot of us still think that lisp is the king of elegance, and look, wow, java got some more lisp features.
Don't complain about syntax, grammar, or spelling. There is no.hell like input on android.
I was referring to speed alone, where Java runs circles around Lisp. But yes, if we're talking elegance Lisp makes Java look like Flavor Flav.
If I was doing this I would use an in memory database. I would talk to that database using Java.
I developed in C++ for 5 years, I have thanked Jesus and his angels every day since Java came to save me.
--------------------------------------------- "In the end, we're all just water and old stars."
There has got to be a performance hit for "extending" garbage collection to files, sockets, and databases.
No, there does not. All that is happening is the compiler is writing correct code for you that is commonly used, so that you don't have to try and get it right.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
The punchline being that C# has had "using" clauses (try-with-resources) since 1.0 and its compiler type inference (you know, the one it got in 3.0) wipes the floor with that cute diamond syntax thingie. Sorry for the trollish language, but you know I have a point...
I'm Rocco. I'm the +5 Funny man.
C# had it 10 years ago.
I'm Rocco. I'm the +5 Funny man.
I totally agree. Also, it's not about the noobs. I suspect most experienced java programmers cant' code the correct try/catch/finally/try/catch for a resource access without looking it up. Check http://stackoverflow.com/questions/4092914/java-try-catch-finally-best-practices-while-acquiring-closing-resources
Haha, if java doesn't scale why is it the defact standard for any large enterprise?
Because 10 years ago it was the best tool for the job.
I am trolling
Well it is. It has new asynchronous channel functionality and the FS stuff also allows Java to watch directories, walk through them, examine attributes and other stuff. Java is generally a good language but some stuff particularly Date & Time and IO have been pretty mouldy and long over due a revamp.
I mean if that doesn't say it all I don't know what does. Hmm Allocate a resource, Free a resource. I think they still teach that in CS-101, then again maybe not. I alloc() therefor I free() ?".
Maybe they do. Doesn't mean it's not a pain in the arse to get right ESPECIALLY in Java since a close() can throw an IOException and ESPECIALLY if you have more than one resource open, e.g. input & output file and you need to ensure both get closed in all normal and extraordinary circumstances.
Its still the best tool for the job, I agree that something like C++ has better scalability from a pure language perspective but java far more scalable from an environmental perspective.
.NET) nothing else even comes close.
There is no such things as a clustered app server in the C++ world, MQ servers that can push through millions of message a day within the bounds of a full XA transaction.You either build them yourself which would take years or you use Java.
And part from the 3 possible contenders to the enterprise crown (C++, java,
So does .NET, except it's not a switch away. Do you think they use the same .NET VM in Windows Server as they do in Windows Home whatever?
I dont know what he thinks, but you are quite clear about what you think and its wrong. The CLR is the same between Server and Home versions of windows. There simply is not differing branches of the CLR because that would defeat its purpose.
"His name was James Damore."
A bigger issue for Java is that it uses layout models extensively to ensure GUIs cope with differences in metrics, fonts etc. from one platform to the next. It can be a huge pain in the arse to program layout models. There are GUI editors (e.g. Window Builder, or Netbeans) and relative / group layouts but these editors never work 100% properly. Android inherits this same problem too but at least it's declarative. Java could really do with a standard declarative way to define layouts.
Yeah, and C++ had it since before Gosling decided C++ wasn't good enough for him.
Ever since its inception, Java has steadily acquired lame, non-generic, basically hacks of implementations for features in C++ which it strived so hard to shun. Mainly due to Gosling being not smart enough to really understand C++ in the first place. Honestly, read some interviews with him, he's just guts and bile about it, no logical arguments whatsoever, typical I-don't-get-it-therefore-it's-wrong, holier than thou attitude.
The tasteless, confused hamburger that Java is today is the result of its small minded creator and the barriers built in since the beginning. Doug Lea's work turned the crapfest Java was into a workable platform for serious applications, but that's about it.
Even Eclipse is fast unless you weigh it down with plugins. J2SE or J2EE Eclipse with a couple of plugins (e.g. Maven & source control) works perfectly well. IBM's WSAD (Eclipse + a massive amount of crap for websphere / rational / kitchen sink development)... not so much.
Because 10 years ago it was the best tool for the job.
It's still the best tool for the job. And it scales extremely well assuming you bother to write apps correctly to cope with the dataload.
I can understand this poorly written application usually have very long start up times.
Nothing to do with code quality, unless you consider "using the standard libraries" poor programming practice!
You can precompile EE applications as well and have them start up in milliseconds.
Maybe, with some containers. I said that. My point is that 90% of Java environments don't or can't do this. It's certainly not the default.
In SE that is being addressed in Java 8
That's my point! Java 7, which is now 16 years old, still doesn't have minor, unimportant features like... fast start time, even though, as you put it, other people have solved the problem decades ago.
Dot NET is snazzy in the fact that the VM is loaded with the OS so you only incur the cost at startup and shutdown
Not true! The VM is only loaded if an application needs it. The operating system doesn't -- Windows XP and 2003 certainly don't, and even newer versions usually don't load it. Heck, Server 2008 R2 doesn't even fully install it by default for security.
It's also another difference between .NET and Java -- automatic sharing of DLLs between running processes. On Citrix or Terminal Servers, this makes a massive difference to resource usage. Java reloads and recompiles everything for every user! On a 100 user server, that's about 50x the overhead of a comparable .NET app.
Do you think they use the same .NET VM in Windows Server
It's the same install package and binaries, but there are some small differences, like the default GC mode. You can override it if needed with a configuration entry. Not that I've ever seen anyone having to do this, because the defaults are fine, unlike the Java workstation VM, which is too slow to use for some workstation GUI apps! One of my tricks is to switch to a 64-bit server JVM to run IDEs because the speed boost is quite noticeable.
This new Java statement, C#'s blocks and C++'s destructors are all hacks that solve a problem that would not exist in the first place if those languages had lazy evaluation: the code that uses those resources could have been passed as a functor to another function that opened the resources, called the functor and then closed the resources.
It it amazing that in this day and age, language designers ignore language design and compiler basics this much.
Read the article? Do you know where you are?
Thanks for the object lesson dick.
You thank him for the lesson which is strange since you seemed to misunderstand it.
1. Raii gives you the -ability- to reclaim resources after a fault,
No, it automatically reclaims them. E.g.:
osfstream f("tile.txt");
throw "An error!";
now f is automatically flushed, closed and reclaimed.
2. If you mean writing a hell of a lot of useless boiler plate and trouble laden code
Well no, not really. In this case, the C++ version is shorter and therefore less error prone.
SJW n. One who posts facts.
A Language that gives you head? Where do I sign up?!
+1 IDisagreeSoHeMustBeATrollOrAnAstroturferOrAShill
Meh, not sure what you're used to but Eclipse is always slow, no matter how few plugins you use.
I don't disagree with the original comments- that Java being slow is a 90s argument, but Eclipse is a particularly poorly written piece of software that really doesn't demonstrate Java very well.
The GP pointed out why Eclipse is slow though, and why it's not a Java issue, but a poor design issue.
Compare Eclipse to other IDEs like NetBeans, JDeveloper, or Visual Studio and you can see how much of a joke it is. It's not even just initial boot up, even intellisense in it is too slow to be of much use a lot of the time really.
> I still change DIP switches on ISA cards at my work place.
Sheez, who do you work for ? The museum of retrocomputing ?
Unicode killed the ASCII-art *
>To be fair here compared to other interpreted languages Java is still the king of the hill. By far.
By what measurement ? Both python and ruby can outperform it in at least some situations, both are more advanced and powerful languages with better features and faster development cycles.
Or do you mean back-office market share ? I'll grant you that one...
Unicode killed the ASCII-art *
I don't find eclipse to be especially slow but it does everything it can to make software written under eclipse difficult to run outside eclipse. For example eclipse runs class files directly while deployments use jar files. Eclipse has its own classpath file format which is of no use in the outside world.
http://michaelsmith.id.au
I know that. But IIRC it announces in the splash screen that it's using Java, and so it's still one of the things I think of when I'm trying to think of "java desktop app". Seriously, if it's possible to write a snappy, performant desktop app in Java, why can't I think of any?
I am trolling
assuming you bother to write apps correctly.
Thats quite some assumption you have there. The problem with java IMHO is that it gives the bright young things a lot of fun toys to play with and opportunities to create write only source code.
http://michaelsmith.id.au
I still change DIP switches on ISA cards at my work place.
Hey I had to attack the backplane of a PDP 11/84 to install a SCSI card.
http://michaelsmith.id.au
I'd add that Eclipse and Netbeans aren't really that different at the low level. Both implement RCPs over modular frameworks. Eclipse uses OSGi, Netbeans has it's own framework with an OSGi bridge.
Thats quite some assumption you have there. The problem with java IMHO is that it gives the bright young things a lot of fun toys to play with and opportunities to create write only source code.
No, it's not an assumption, it's a requirement. If the requirement says "must scale", then you design and write your app to scale, depending on what that means in the circumstances. In many cases it just means being able to run extra instances of something in a cooperative fashion and externalizing settings for performance tweaking. In others it means using a scaling app server like Gigaspaces. I'm quite sure you can abuse Java in all sorts of perverse ways if you don't know what you're doing, but that isn't the point.
There are places where it's still very legitimate, like high performance crypto libraries, video processing, graphics engines, that sort of thing. Typically you have a reference implementation in C or some other portable language and the assembler is conditionally compiled in, so it works on other platforms but you only get the extra performance boost on that particular platform. It's a niche but so is kernel and driver development, it still makes sense to have some people specialize and do those specific tasks. I wouldn't go it as a career though, there's way, way too many developers from the "bad old days" who know all about shaving two bits and four instructions off a calculation.
Live today, because you never know what tomorrow brings
I don't really get why people emphasize to be able to program in assembler. Or machine code ...
Do you really believe a programmer who can program in Java or even Visual Basic is incapable of learning assembler?
For most programmers there likely never was a need to learn any assembler or more than 2 languages ... nevertheless assembler is easy to learn.
There is no magic about it.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
What do yu mean with Java does not scale ?
Do you even knwo what scale in IT means? It certaily has nothing to do with millions of objects in memory ...
You do know that many larg scale internet companies run their business on JVMs? (Not necessaryly on Java, but Scala or other languages)
You don't tackle slowness or speed in general by the language or platform but with architecture and design.
A straight forward written C++ program hardly will outperform a well thought out Java solution. Ephasizies on "straight forward" and "well thought out"!
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
throw "An error!";
That is great (really), but it does not support inheritance. The declared type must be the same as the actual type, which would render a similar construct in Java useless most of the time.
Nitpicking: in an interpreted language the language is interpreted. Java is not and never was an interpreted language. Its bytecode is interpreted, so: the bytecode is an interpreted language.
In a truely interpreted language (today we don't have many anymore as nearly everyone makes a small compile pass and creates some intermediate code) the programm is basically executed/interpreted line by line. That means the interpreter will stop with an error as soon as it finds something it can not interpret. So it is possible that programs only run half:
In this example line 10 is "interpreted" and that means executed, but line 30 is never reached. Java on the other hand is compiled and an error like line 20 would be discovered during the compile phase.
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
JPA has pretty much lazyness.
Also, you can pass "functors" with anonymous classes.
But anonymous classes is not a convenient way to do it. They require the definition of a super class or an interface, they require typing the super class or interface they implement, etc.
Cool! Can I use this C# language to create desktop apps that run without modification on Linux, Mac OS X and Windows? Is there a cross platform IDE for this C# language that allows me to develop in the same IDE on Linux as my colleagues do in Windows or OS X?
Shouldn't the implementation be in question, not the language as a whole? Javascript is usually interpreted, but I'm sure someone has written a Javascript compiler that emits executable machine code.
I was *almost* tempted to ask you to enlighten me there. Nice job! Now doze the fuck off please.
I don't think there's a single language today out there that isn't compiled to bytecode prior to execution on a VM. Even Perl does it AFAIK. The code is still being interpteted, just not from the text sourcecode directly.
FTA:
A key feature of Java SE 7 is its accommodations for dynamic languages, which are becoming prominent on the JVM lately, thanks to the emergence of languages such as JRuby and Scala.
Scala is _NOT_ a dynamic language!
Even Eclipse is fast unless you weigh it down with plugins.
The problem with that statement is: basically everyone who uses Eclipse seriously also uses a lot of plug-ins to provide all the functionality Eclipse doesn't out of the box.
In my career I've known over a hundred developers who used Eclipse as their major development tool, and not a one of them used less than three or four plug-ins with it.
Saying Eclipse doesn't run like a dog if you don't add plug-ins is like saying your car gets great gas mileage if you take the seats out and don't weigh it down with passengers or cargo: technically true and yet totally useless from a practical perspective.
The try-with-resources handles all this for you. declare both resources in the try (...). The auto-closing will be applied to all the resources you specify, and in the event of an exception being thrown in your try block, then any exception thrown by the closing of the resources will be ignored (although there is a means to access them if you so wish).
"Write once, run anywhere" was like communism -- an idea that sounds nice in theory in some ways but utterly fails to work in reality.
True, if you hardcode C:\something or /somethingelse in your app. I've never had cross-platform problems, either on big server side applications or trivial desktop ones. So I guess 'utterly failes to work in reality' is somewhat dependent on the developer.
I agree that something like C++ has better scalability from a pure language perspective but java far more scalable from an environmental perspective.
Threading and locking are far easier to implement in Java rather than C++, as they're built into the language and libraries. The concurrent add ons that came with Java 1.5 improved things as well.
(Andriod comes close if you could even call it Java still).
We don't. Its not.
Android's use of Java and UI's have absolutely nothing to do with the topic at hand. Your reference is neither applicable or relevant.
I love Python, don't get me wrong, but it is nowhere near Java regarding raw performance. Even the developers acknowledge this, with stuff like the Google sponsored Unladen swallow and PyPy.
Haven't toyed much with Ruby these days though. I should :)
>I love Python, don't get me wrong, but it is nowhere near Java regarding raw performance.
I did say in SOME situations, in most cases you are right. Ruby - particularly the RoR setup beats it hand's down though, and I honestly do believe that zope holds up well against glassfish in all but the most strenuous environments.
Unicode killed the ASCII-art *
No, but in practice Java never really lived up to that promise either, except for very trivial applications.
Bollocks. I've worked on at least three non-trivial systems that are written in Java and run on at least two platforms (Linux and Windows) without modification. The first is a warehouse management system for a multi-national publishing company, the second is the front end to a repo trading platform used by a dozen Wall St or City of London based banks and the last is a large suite of applications for a government organisation. The only way it can "fail to work in reality" is if you deliberately use classes you shouldn't (eg. those in the sun.com hierarchy) or ignore the few areas where you have to use the - well documented - portability features of the class library (an example is using File.separator when manually constructing filesystem paths).
Let me get this straight - you think that a harder programming language increases programmer competence. While I'm not defending Java, this logic is deeply flawed.
Glad to know you're here to fix the entire world's education system. Sorry, but YOUR logic is deeply flawed. With your logic, none of the "good schools" are actually any good. So yes, clearly those capable of mastering difficult tasks show they are better in any way.
I'm going to take a wild stab here and say, perhaps you are a Java programmer? And even if you are not, YOUR logic is dubious at best and in no way invalidates the line of thinking which spurred your initial response.
sigh - so 1990's.
http://www.brackeen.com/javagamebook/
Grab chapter 12 and build it. It's a 3D game using only the Java 2D APIs. Not OpenGL, No DirectX. It's under 200k JARed with the resources.
The fork-join framework pushed in Java 7 as the "way to parallelism for applications" is seriously flawed, http://coopsoft.com/ar/CalamityArticle.html
Its funny that Python has had this licked for some time now. In fact, they have an entire interface to allow for clean resource acquisition and release of any object and even added a statement to compliment.
Python's combination of, "with/as", context management, and, "try/except/else/finally", make error handling and recovery for even complex use cases fairly easy and extremely powerful.
Cool! Can I use this C# language to create desktop apps that run without modification on Linux, Mac OS X and Windows?
yes: http://www.mono-project.com/Main_Page.
You have a choice between Windows Forms or GTK as the widget toolkit. Both are supported on X11, Win32, and OSX.
Is there a cross platform IDE for this C# language that allows me to develop in the same IDE on Linux as my colleagues do in Windows or OS X?
yes: http://monodevelop.com/
Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
When I first started doing Java, I was shocked and amazed at how very shitty the entire IO model and APIs were for IO and Data/Time. Literally, doing it in C++ and especially Python would have been leaps about bounds faster, easier, and better. I quickly found my self wonderful why so many claim Java development is faster than C++ when in these areas, clearly it is not.
I don't really get why people emphasize to be able to program in assembler. Or machine code ...
Says a lot. There are still plenty of platforms where assembler is REQUIRED. Furthermore, on others, even where higher level languages, such as C, are available, to access certain hardware features are still only available via direct assemble and/or machine code.
Do you really believe a programmer who can program in Java or even Visual Basic is incapable of learning assembler?
Bit of a red herring there. Capable of learning? Probably they are capable of learning. Do they have a desire to learn it? Probably not. Are they capable of learning it well? Maybe. Are they capable of understand the overall implications of some of the code they may generate at this level? Its iffy if we're talking about the average Java coder.
nevertheless assembler is easy to learn.
Reading a dictionary is easy. Remembering the words and knowing how to put them together properly and concisely is an entirely different animal.
Arguments for slow Java are so 1990's. Every Java application, desktop or otherwise, I have written has been very snappy, very responsive.
Where do I find some of this snappy java?
Give me Classic Slashdot or give me death!
And of course, don't forget how try-with-resources fixes common bugs where an exception in closeFile gets swallowed, or overrides the original exception...
This is what I do these days to avoid these problems:
Handling exceptions this way has the advantage that I can see exactly what has happened even if statements in the finally clause throw an exception after another exception has been thrown. It also doesn't matter if many exceptions get thrown in the finally clause, they are all recorded in the stack trace. That is just the basics, helper classes can be created to make this even easier to write with fewer lines of code. Some exceptions may need to be caught and wrapped in another exception. For instance, SQLException has the SQLState and vendorCode properties which do not print in the stack trace. This means that another exception needs to be created to wrap SQLException and put these properties in its detail message.
Both python and ruby can outperform it in at least some situations
[Citation Needed]
C# had it 10 years ago.
Lisp had it 30 years ago. Go suck eggs.
I would just like to post a link to my other comment which shows the way I handle exceptions. I believe this is superior because I can see every exception that gets thrown in the one stack trace, and that all the exception logging can be handled in one area of the program. It has worked very well for me.
I've been considering using some free time to play around writing Android apps for fun (I have no ambitions of trying to make any money at it) but I'm really nervous about the time investment with all the uncertainty around java. I have literally zero experience programming in Java, but I've played with C++ a little bit and several other higher level object oriented languages.
Can anyone give me some advice here? Is my time better spent just brushing up on HTML5 and Python?
First example that comes to mind: a command-line only program, unix style with a lot of standard libraries pulled in. Both python and ruby would be faster there since execution time is a minimal aspect of the running time of the program - java's slower startup time would be a much larger percentage of the total run-time and the java program would thus perform slower over-all.
Hell.. a BASH script would outperform java in this scenario.
I never said in all cases or for all jobs - I said SOME scenarios. This is an example of such a scenario - and such programs are a very large subset of the software in the world.
The unix approach to design of building lots of small tools that can interoperate and do complex tasks by being plugged together differently is almost impossible to achieve in java development because startup times on individual programs is so much higher. It works well with native code, the difference with languages like python, ruby and even bash is so small that users never even notice.
I'll tell you this though - if you replicated the standard unix user-space in java it would be an absolute and unusable nightmare to work with, the same clearly doesn't apply to bash or python since large parts of the contemporary unix userspace stack is ALREADY written in them. This is even true of the much older perl.
In short - there are use-cases where java performs worse than even wholy interpreted scripting languages, I've shown you own, that's enough.
Unicode killed the ASCII-art *
That is great (really), but it does not support inheritance.
Huh?
If you want inheritence, you have to do it with pointers.
auto_ptr p(get_from_factory());
throw "An error!\n";
Is that what you meant? It still works...
SJW n. One who posts facts.
Not speaking for the GP, but my take is that the harder the language, the less incompetent programmers it will attract.
Think about it this way: if any idiot can do VB then every idiot will do VB (in preference of other languages).
That said, if a language is merely hard, with no added benefits in power, expressiveness, etc., it will also fail to attract the competent programmers.
Date & time is a particular bug bear because I had to write an embedded system which dealt with time dependent data, had to cope with local time zones, daylight savings changes and data which was based off UTC. I think I did a pretty good job in the end but it sure as hell wasn't helped by the system libraries. The trick is to use time in millis from the epoch and never attempt to convert to / from local date at all except to present the data to the user. It's still a pain though. I would have used Joda time but it was too big and bloaty for embedding properly.
,fter it's all beautiful an working properly you can throw in all your declarations to get performance on par or greater than C. I think most ppeople just don't learn that part, somethings still slower though. I'd rather the tradeoff of elegance with.the ability to get performance than having to write it ugly to begin with.Actually
Don't complain about syntax, grammar, or spelling. There is no.hell like input on android.
Java the language is dead to me. I could care less. What I do care about are JVM improvements that speed execution of the alternate JVM based languages: Scala, Rhino, jRuby, Clojure, Groovy, and to a much lesser degree Jython. The alternate languages are where all the action will be over the next ten years.
If you're a Java-only guy and haven't looked at Scala, run don't walk! You will love it, especially if you've played with any of the functional languages at Uni or on your own time.
I can only hope that someone will do a JVM Haskell and that the OCaml-Java project will mature into a stable platform.
"Liechtenstein is the world's largest producer of sausage casings, potassium storage units, and false teeth."
Other things you talked about don't have anything to do with performance, so you haven't talked about use-cases in plural but only about the small amount of startup time difference.
I think that the best programmers learn the hardest and most difficult languages in order to improve their skill, and then actually program in the simplest language that meets the criteria for the task.
I don't like Java much, but it has a purpose, and good code can be written in it. Heck, old VB had it's purpose, and a niche where it was far superior for development purposes than C++.
Now that Apple is moving away from Java and we dont have Java SE 7 downloads from Apple I do not see Java SE 7 downloads on Oracle's page as well. Is building OpenJDK on mac the only option left?
What happens if, say, a close() fails during the destructor call?
HAND.
Now take your python script and stick 100 include lines on top. The use 100 standard libraries in your Java app. No need to do anything. Just call them and compare the results. Java startup times increase exponentially the more libraries it calls. Python has no such issues. Bet its user noticeable now.
The Unix style of design is just as useful and powerfull in application development. Building a complex app out of lots of small specialized little apps makes your app much more powerful and scalable. If those little tools are executable program s then that itself is a feature. Users can plug them together in ways you could never have thought off or provided. That entire design philosophy and the myriad programs that use it is ruled out in Java. Even a 5% increase in startup times add up to an unacceptable load when normal operation will start hundreds of apps in unpredictable order. Especially if they can't share resources like Library memory or fully benefit from copy on write like.
program
Unicode killed the ASCII-art *
One tool is better than another when it helps you accomplish the same task with less effort.
An intermediate representation is being interpreted.
HAND.
simply scoped resources that is.
HAND.
Did you really choose Perl as your unsafe language? I thought you were going to describe C. Perl copies lists and strings by default because it's the safe thing to do, even though it is inefficient. Perl added "use strict" and it is widely encouraged and used. Perl doesn't enforce public and private because it is a dynamic language derived from shell programming, and its object-oriented features were tacked on with superglue.
Perl does have a lot of crazy magic and syntax, but that's just a reflection of the designer. Lots of good programmers don't like it, and hence Python was born.
The reason you have more bad Java developers is because that's the language business gravitated to after tons of bad developers were making a mess in other languages, like C and C++. As another example, PHP, has a lot of confusing design choices and lots of ways to screw up, but tons of programmers use it, bad ones included, because it's a very popular language on the Web.
The correct use of apostrophe is grammar, not spelling, as it concerns syntax.
Lazy evaluation has nothing to do with it.
Not even lambdas are needed, nor anonymous classes. All you need is the ability to instantiate objects (with state) dynamically (aka. "new").
Of course anonymous classes and (especially) lambdas make such an API much nicer to use.
HAND.
You never owned a mac, right? PowerPC, not Intel. All kinds of fun with not working, on MacOS, OS X, and GNU/Linux.
Pardon me for remembering more than the last decade of my life.
If opportunity came disguised as temptation, one knock would be enough.
3^2 * 67^1 * 977^1
Alternatively, why are bloated apps written in C++ just as slow to load?
I did say in SOME situations
I've never heard of Ruby or Python outperforming Java, Rails included. Do you have a cite?
I didn't describe Perl as unsafe, but as difficult to use for bad programmers, and requiring skill to be used properly. That's also the case with C, but for historical reasons and because C is closer to the hardware. Perl was designed that way.
The rest of your message is rephrasing what I meant, so I agree... but maybe I wasn't very clear in my post.
its compiler type inference (you know, the one it got in 3.0) wipes the floor with that cute diamond syntax thingie.
For the most part this is true, but C# "var" is only usable for local variables, whereas Java diamond inference can also be used with fields.
I don't really get why people emphasize to be able to program in assembler. Or machine code ...
Says a lot.
says nothing at all. using C++ or C# or Java is a conceptual skill quite apart from machine level programming. Everything from threading to object/data maintenance to looping is different in a fundamental way.
I'm one of those "uneducated" (my background is Electronics, not CompSci) java programmers doing mostly business applications. I would only assert my competence. I also entered machine code in Heathkit ET3400 as well as C= Vic20/128. I repaired arcade video games like Defender and MsPackman also.
People learn what they're interested by and what they are required. The "average" anybody is not going to excite... talk about red-herring...
Do you really believe a programmer who can program in Java or even Visual Basic is incapable of learning assembler?
Bit of a red herring there. Capable of learning? Probably they are capable of learning. Do they have a desire to learn it? Probably not. Are they capable of learning it well? Maybe. Are they capable of understand the overall implications of some of the code they may generate at this level? Its iffy if we're talking about the average Java coder.
The truth of the matter is that C and below programming is really not necessary to the majority of today's programmers. I also modified xmodem on a coherent system where I had dial up. I did that to skip the 64, 128, 256 progression it did to bring up to speed. most of my transfers were 1k or greater and starting at 1024 made a huge difference in the kind of quick transfers I needed to do. I got my first job in software programming by showing the place in that C source code that I modified... why and how.
Even today I think the better, elegant solution eluded me at the time. But it worked; both in a pragmatic and preparatory sense.
That's all starkly irrelevant to job-health today for me though.
The point is that the only difference here is whether the compilation happens "ahead of time" or "just in time". End result is still the same.
Note that, in case of Java, the actual story is more complicated, since it also does have a true bytecode interpreter (as in, a loop that processes opcodes one by one and performs the corresponding operation), and switches from that to JIT only for "hot" methods. This is because JIT-compiling itself is not free, esp. if you do advanced optimizations, and for a method that's only called once or twice, you waste more time JIT-compiling than you gain from its faster execution.
This new Java statement, C#'s blocks and C++'s destructors are all hacks that solve a problem that would not exist in the first place if those languages had lazy evaluation: the code that uses those resources could have been passed as a functor to another function that opened the resources, called the functor and then closed the resources.
It seems that by "lazy evaluation" here you mean closures/lambdas. C# has them for 6 years now, and there are libraries that do precisely as you want, i.e.:
There are two basic reasons why IDisposable/"using" is still preferred. The first one is perf - calling a lambda is a virtual call, and any local variables captured are lifted onto the heap. This is theoretically fixable by a better optimizer with escape analysis. The second problem is that many language features do not work across the boundary of the lambda - e.g. you can't goto into or out of it; if it's in a loop, you can't break/continue; and you can't immediately return from the enclosing function.
The other reason is that the wrapper-with-lambda approach can only handle the same as "using", but there are more cases than that. In particular, the case when one object owns another, and they should be freed together. You have to do this manually in C# (by implementing Dispose in owner, and calling the same on the owned object), but at least you can do it. If the only way to clean up the owned object is with a wrapper, you can't do that.
C++ can clean up owned objects fully automatically, so there's even less reason for using that pattern there (though in C++11, with its lambdas, you can if you want to).
No. Fork/join is a higher-level thing that still (usually) works on top of threads, and usually helps you avoid fragile explicit locking.
Your question is, basically, akin to "is there something you can't do with assembler that you can do with C"? The point of C is to be a convenient higher-level abstraction, not to provide completely new functionality.
What you described as features for bad programmers in Java were safety features. The only really valid claim you'd have for Perl was the horrid syntax and abundant magic, but you didn't mention those. You also can't explain why PHP is so popular and full of mediocre programmers when it's essentially Perl for the Web.
I can only hope that someone will do a JVM Haskell
No can do. JVM doesn't guarantee tail call optimization for method calls, which is a must for Haskell (and most other FP languages). It's why Clojure has that ugly explicit "recur" hack.
Unfortunately, JVM wasn't really originally designed for languages other than Java, and it shows. They're trying to patch it up now with things like invokedynamic, but it needs far more than that.
It's just scoping, really. You can do it in C++ if you like, here's one way to DIY (without the error checking):
Note that C++ only guarantees destructors are not run before something goes out of scope; exactly when after is Implementation Defined. So if a file MUST be closed (say, because you just wrote it and want to pass it to another program), you still need to invoke the close method explicitly.
Perl does much the same thing when a reference to an IO::File class or a filehandle gets garbage-collected. This Java feature just makes it part of the language syntax, rather than having to glom on yet another library.
Not speaking for the GP, but my take is that the harder the language, the less incompetent programmers it will attract.
Surely the harder the language, the less programmers it will attract. There will be a similar proportion of incompetent ones in that language.
Think about it this way: if any idiot can do VB then every idiot will do VB (in preference of other languages).
Then why don't the programming Gods use VB? I'm pretty sure they can all code VB if they wanted.
Ah, the impetuousness of youth. All of those "alternate languages where all the action is" are great toys ... until you need to get a job (or leave academia).
PS - Java ain't dead til netcraft says so!
Slashdot: come for the pedantry, stay for the condescension.
There's not differing branches of the CLR proper, but there is a Client Profile version of the framework which omits some of the standard libraries.
Benford's Corollary to Clarke's Law: "Any technology distinguishable from magic is insufficiently advanced."
The problem with java IMHO is that it gives the bright young things a lot of fun toys to play with and opportunities to create write only source code.
Exactly wrong. The big (in fact almost the only) thing java has going for it is that its strong typing and verbose, rigid syntax limit how clever you can be, and mean the structure of any piece of java code remains clear. You can do a much better job of write only source in either C++ (operator overloading, unmanaged memory) or dynamic languages (reuse the same variable for different types, play with all the funny-looking operators in the syntax).
I am trolling
> Surely the harder the language, the less programmers it will attract. There will be a similar proportion of incompetent ones in that language.
Not so, the incompetent one will choose easier languages instead, ones that mask their incompetence.
> Then why don't the programming Gods use VB? I'm pretty sure they can all code VB if they wanted.
I knew at least one that did.
He used VBA for MS-Office macros and straight VB for prototypes.
> Arguments for slow Java are so 1990's.
Which is why it is such a shame that they are still true. In fact Java 1.0 would start in 3 seconds on my PC back then when it is up to date. Java 1.6 takes 10 seconds to start...
> Every Java application, desktop or otherwise, I have written has been very snappy, very responsive.
Once they are up and running that may be. But the start-up time is always terrible, and it seems to be getting worse with every new version of Java, even the ones that promise more speed.
Sorry, that si completely incorrect. Everything I can do with assembler, I as well can do with C/C++ or Modula 2 even. Except emitting the INT xyz opcode which is *perhaps* required for something.
I'm not really sure people know the difference between assembler and machine code ... there are far to many strange posts using the words ;D
I saw a post on stackoverflow lately where people talked about displaying java byte code operations by reading the class file and showing its opcodes. Some guy strongly argumented this was not "disassembling" as it only translated a byte into a mnemonic ;D
Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.
This is your sense of humor calling to tell you -- calm down, its just a joke. Jeez-luise.
OK this is not fanboi spew it is succinct and informative and told me what I'd want to know. It's not the masturbatory glee of the article that tried to slather me with vapid goo.
Thank you.
I'd go on a Vegan diet but the delivery time from Vega is too long. --brownkitty
The new Java 7 resource statement does something more useful here. It catches the exception and attaches the stack trace to the original exception (if there was one). If there wasn't a pending exception when the close failed, it actually throws.
That's not something which can be done in C++ because destructors (as you say, and of course, I knew before asking :)) cannot throw. ... but this also means that if a file fails to close() during normal RAII (perhaps because of a failing flush), there is absolutely no way to tell the user code. So you end up with subtly broken behavior.
In Java (7 or earlier) your code WILL get an exception and won't fail silently. ... and that is why RAII is broken (in C++ at least).
HAND.
I gave two examples in other posts replying to this one. Read more.
Unicode killed the ASCII-art *
I guess you think it stylish to use profanity, but since you are posting as AC I suppose you can get away with that.
Advancements in given programming language are great, advancements that encourage both laziness and a lack of attention to detail are worthless.
Is this what we have come to? Writing languages where programmer laziness and lack of attention to detail is heralded as the next great thing?
Someone mentioned programmers saying "High Level Languages" replacing assembler is bad? No that is not bad, it is a better means of programming when absolute metal level control is not required.
NO STATEMENT I MADE even attempted to assign any attribute to myself resembling anything like or even alluding to perfection.
Was it a true error of units that sent a billion dollar spacecraft into the surface of mars or was it someone who replied on the framework or the RTL working all that out for them? Could one ascribe that oversight as a lack of attention to detail? I think so, but that is just my opinion for whatever someone else things its worth.
It wasn't as if moving from assembler to C required less attention to detail, it simply made writing the code easier to understand 6 months later and took care of the really really love level things for you.
I have found many many bugs in my own code where I forgot to close a file before exiting and have lost data because the files contents were not flushed to disk and then properly closed and I found those bugs and fixed them before the code went out my door.
How much more will we push Moore's Law by adding yet more and more and more code to do things we as programmers should just remember to do? At what point will it take a machine with two quad core processors and 12 gigs of ram to run a simple program? Is there no limit to the lengths that we will go to take up the slack for basic laziness and lack of attention to detail so that some slack jaw can write code that will work to say nothing of having excellent performance?
Vernon D. Buerg (rip) wrote fast tiny programs that did big jobs and he did it elegantly. I shudder to think what kind of monster it would take to duplicate even LIST in Java.
M point is this. Programming takes attention to detail, it takes concentration, it takes keeping track of what you use and giving it back when you are done with it, not just skipping on to the next thing and saying "The RTL will take care of that, no need to waist my time on doing things like that.".
And yeah I have been around for a long time and I can tell by some of the low ID's replying that some of you have been around for a while as well and could see where you want to forget as many of the details as you can because of deadlines and this that or the other. Yet at the same time I see those same low ID numbers bitch and moan about bad code, programs that just blow up when you least expect it. When you bitch about that look in the mirror and tell yourself that you asked for it because you did when you advocate for things that are just automatic because really when you think about it there is not much in this world that works well 100% of the time automatically.
Hey KID! Yeah you, get the fuck off my lawn!
If programming were easy everyone could do it. Well it is... Sorta... and everyone can sorta do it they all just can't do it correctly and well.
Yup dealing with those is a PITA but you knew the job was dangerous when you took it aye?
For years I have used the same bit of code to open and close files, streams, etc. One function to open one function to close and they have yet to fail me. The logic for opening is pretty simple, if you can't open it you report back and in certain very specific instances you have to bail out with a meaningful error message. Closing is pretty straight forward as well. If you cant release a resource ( close a file or what not ) then something is pretty drastically wrong and again time to bail out meaningful error message instead of a couple hundred lines of java stack trace which is practically meaningless to the end user.
Hey KID! Yeah you, get the fuck off my lawn!
You talked about command line apps, and that's only one example, unless you are talking about "particularly the RoR setup beats it hand's down though", which I find unbelievable unless you've got a cite.
As for the Unix command line, I'm willing to bet Java would do fine. Files are all cached in memory these days.
And if you think file access time has anything to do with java's slower startup times you are an idiot not worth debating with. File access is handled by the OS, whether the intermediary layer is a python interpreter or a JVM will make no difference to the time it takes too access files (the only thing affected by caching) - since neither does it (indeed neither CAN do it - it's a kernel-space activity).
The reasons why java slows down with library loads is completely unrelated to file caching - and has been clearly spelled out by other posters, it relates to how java loads the libraries into the JVM's memory base.
I also pointed out another problem - JVM's cannot share resources very efficiently with one another - notably two java apps that load the same library cannot gain full effect of copy-on-write. This means the library must be copied into memory TWICE, always. Both compiled and interpreted languages however do get copy-on-write and the library once loaded is already loaded for ALL programs that need access to it, only in the event that a program changes something in the library's own memory space does that chunk get copied into private memory and even then it's a memory-to-memory copy.
This is one reason why java is among the worst memory hogs around. I know it's become fashionable to treat ram as infinite and not part of performance but this is false - memory is always constrained - and java uses up more of it.
Even high-level enterprise systems have a limit of memory and it's often the first resource constraint reached. Long before CPU runs out even big iron servers are pushing RAM usage limits. I speak as somebody whose job i involves working on just that problem.
On a server with maxed out ram, I can show how 9/10 times 95% of the ram is tied up by the java portions of our stack - not the mod_perl or python parts (and this while java is the smallest part of the stack - even if you include glassfish as part of the java stack).
In any environment where the task of the applications require significant amounts of memory to be allocated, Java will perform worse than any other language because it will start swapping out first.
In benchmark tests where all things are optimal and all you measure is CPU times of execution and such - yes java outperforms python or RoR. In the REAL world where even 32 gigabytes of memory gets used up by big database apps during normal operation sometimes, java is frequently slower.
It's just a fact - first to swap out = last to finish.
Now I just hope I explained it in simple enough terms for somebody who thinks disk-caching has anything to do with why java has a slower start time than python apps. And even if it had you're wrong. File caching makes disk access more efficient, it sure as hell doesn't make it unimportant. At best it makes the files that are used the most accessed faster, it will never be so perfect that you can completely ignore seek times when building high-performance applications, and no programmer who does that for a living ever would.
Unicode killed the ASCII-art *
And if you think file access time has anything to do with java's slower startup times you are an idiot not worth debating with.
http://en.wikipedia.org/wiki/Java_performance#Startup_time
"It seems that much of the startup time is due to IO-bound operations rather than JVM initialization or class loading (the rt.jar class data file alone is 40 MB and the JVM must seek a lot of data in this huge file).[25] Some tests showed that although the new Split bytecode verification technique improved class loading by roughly 40%, it only translated to about 5% startup improvement for large programs.[58]
Albeit a small improvement it is more visible in small programs that perform a simple operation and then exit, because the Java platform data loading can represent many times the load of the actual program's operation.
Beginning with Java SE 6 Update 10, the Sun JRE comes with a Quick Starter that preloads class data at OS startup to get data from the disk cache rather than from the disk."
[25]: ""At the OS level, all of these megabytes have to be read from disk, which is a very slow operation. Actually, it's the seek time of the disk that's the killer; reading large files sequentially is relatively fast, but seeking the bits that we actually need is not. So even though we only need a small fraction of the data in these large files for any particular application, the fact that we're seeking all over within the files means that there is plenty of disk activity. "
Both compiled and interpreted languages however do get copy-on-write and the library once loaded is already loaded for ALL programs that need access to it, only in the event that a program changes something in the library's own memory space does that chunk get copied into private memory and even then it's a memory-to-memory copy.
You must be speaking of mod_perl in particular, because by default if you run two separate interpreters in two separate processes they will not share libraries unless they are native .so libraries.
And if it's a server you're talking about, then there's only one JVM anyways running multiple threads.
On a server with maxed out ram, I can show how 9/10 times 95% of the ram is tied up by the java portions of our stack - not the mod_perl or python parts (and this while java is the smallest part of the stack - even if you include glassfish as part of the java stack).
Java EE servers aren't designed to run as a small footprint because it takes an "everything and the kitchen sink" design. That said, if you are eating up all the ram on the server it's because of your app code, not Java.
At best it makes the files that are used the most accessed faster, it will never be so perfect that you can completely ignore seek times when building high-performance applications, and no programmer who does that for a living ever would.
Only if your "high performance application" entails starting up a new process every time that won't be in the cache.
You do realize that the cache is in MEMORY right ? The SAME memory where applications and data has to live ? So you realize that the first thing the OS does when memory use gets high is to shrink the cache ?
When the load on your apps from having ten-thousand concurrent connections each doing heavy-load transactions is pushing a 32Gb ram server to 95% memory use, for all matter of practice there IS no cache. This is why programmers who write the kind of software that has to perform under these kinds of loads and don't get the benefit of running on large clusters (and that is how it is in some fields) actually don't count on caching. In fact they base their performance metrics on worst-case-scenario (that would be zero cache and the highest possible seek and read times for the hardware types).
Since many of these servers also need 3-5 year uptimes hardware upgrades are infrequent and that means they are not reading from SSD's.
That's the real industry world - both my previous and current employer are in business that has to design around those kinds of constraints. In both cases java is very powerful and useful in many ways but it's the biggest single performance problem because these assumptions that other programmers can make don't apply in the world of high-vollume enterprise management systems.
So now I've given you TWO use-cases where java is not the optimal performing tool. That doesn't mean it's not powerful or useful, in both cases it gets used DESPITE that because the overall software stack is better with it than it would be without it and you can design around the performance issues, but make no mistake what I DO for a living is design server and OS platforms for high-vollume, heavy load applications to operate in. I know from daily experience what resources get used first, and I've done this on multiple stacks by different teams in different companies so I know that the problem exists across many types of applications.
You can argue theory as much as you want - I am telling you in the real world, it doesn't work that way. In the real world uptime requirements beat upgrade requirements EVERY TIME. Performance bottlenecks need to be dealt with and memory is ALWAYS the first to go and even when only 5% of the stack is written in java it's always chewing 85% or more of the memory.
None of this is meant to say java is bad, it's an excellent platform for many things - but to just blatantly assume that it will always outperform every other non-compiled language in every use-case is thoroughly naive.
I'm not talking from education, generic benchmarks or all-things-equal studies here. I am talking about what I get paid to find sollutions to in the real world every day for the past 5 years.
Making java not kill servers practically IS the job I get paid very handsomely for because it's a bloody hard job.
Unicode killed the ASCII-art *
I wish i could use lisp for my day job. Unfortunately I can't.
The Grey Goo disaster happened 3 billion years ago. This rock is covered in self replicating machines!
Have you tried using Mono on Mac OS X? I have, and it's alpha quality. Also, Windows Forms has been superseded by WPF - which is far less painful to use than Forms - but isn't supported by Mono.
It's not a case of "if programming was easy...". Programming is already hard enough without a language throwing spanners at your head all the time. Java is a good language but it has some well publicized annoyances, long winded syntax and pitfalls. Anything that reduces bloat & boiler plate and reduces causes of bugs is a good thing. The problem is that Java the language isn't developing fast enough and Sun / Oracle have been loathe in many instances to implement things as best they could, e.g. generics.
Preventing mistakes is nice, but the best reason to delegate resource control is code clarity. Allocating and freeing resources is something that has to be done all the time, like moving data in and out of registers in a CPU. We didn't move from ASM to C just to save us from mistakes in register allocation. We did it to save us from tedium and allow us to focus on new problems once we'd figured out how to generalize the old ones enough to hand them off to compilers. Memory and handle allocation is a solved problem. There are multiple competing solutions (reference counting, mark and sweep, etc), but it doesn't matter much which one your compiler/library/interpreter uses because unless you're writing a compiler/library/interpreter, that's not what your project is about.
So yes, humans are fallible, but taking control out of their hands is not the greatest benefit of higher level languages. The greatest benefit is increases in expressiveness.
You do realize that the cache is in MEMORY right ? The SAME memory where applications and data has to live ? So you realize that the first thing the OS does when memory use gets high is to shrink the cache ?
When the load on your apps from having ten-thousand concurrent connections each doing heavy-load transactions is pushing a 32Gb ram server to 95% memory use, for all matter of practice there IS no cache.
That's quite ridiculous. Nobody with a clue runs their server to 95% memory capacity, and even if they did, the cache required for a single JVM is going to be on the order of 100MB, not gigs.
And if you're talking 10,000 concurrent connections, startup time and caches are not the issue. This isn't a problem with Java, it's a problem with your app. You're not going to magically shrink the memory requirements where you are pushing the limits of 32 gigs by switching from Java to Perl.
but make no mistake what I DO for a living is design server and OS platforms for high-vollume, heavy load applications to operate in
So you say, but it doesn't mean you actually are an expert at it. Everything you've said so far leads me to believe the opposite.
>That's quite ridiculous. Nobody with a clue runs their server to 95% memory capacity, and even if they did, the cache required for a single JVM is going to be on the order of 100MB, not gigs.
Oh I agree, but if the customers want a system that can handle connections from 10000 users at a time - who am I to tell them they can't do it ? My job is to make sure it doesn't fall over, and since it never does - that's why I get called an expert.
>So you say, but it doesn't mean you actually are an expert at it. Everything you've said so far leads me to believe the opposite.
That's because your experience is obviously ... a bit more limited. When your customers are mostly the world's largest telcos - that's what you're dealing with. A server gets put down and is expected to stay stable even if it's pushed to 100% memory at times, and not upgraded for 3 to 5 years. That's the reality of the business. I don't like it, I would LOVE to agree with you - I don't get to say that.
At least in my new job those servers are running linux, the previous job had an overlapping customer base - but those servers were mostly running 10 year old versions of Unix, hell I actually had to maintain two original 30 year old DEC Alpha's - indeed being run to maximum capacity.
These people don't overbuy, if they need 8Gb of ram for a machine, they expect it to be using 8Gb. They will not buy 10. It's not how they operate. There's good money in making things work despite that.
I'm tired of arguing with somebody whose view is so limited. You know one side of IT and don't realize how truly pervasive it is - it operates in many places and a lot of us deal with worlds where we don't get ideal setups to support us. We cope with the shortcomings and make things work anyway. I would love to put 64Gb of ram in a server if I know the average use will be 30Gb. The reality is that the only reason my customers even gives me the 2Gb buffer is because 32Gb is the LOWEST you can go over 30Gb.
Get real dude, we don't all get to design hardware around software requirements. Many of us are designing software and OS configurations around hardware limitations.
Unicode killed the ASCII-art *
Oh I agree, but if the customers want a system that can handle connections from 10000 users at a time - who am I to tell them they can't do it ?
Who said not to? That doesn't mean you push the server to 95% memory capacity where a small amount of variation will put you over 100%. Either get more memory, another server, or figure out why you are using so much memory. Blaming the JVM footprint when you've got 32GB while also talking about Perl tells me that you just don't know what you are talking about.
A server gets put down and is expected to stay stable even if it's pushed to 100% memory at times
This is truly idiotic. Even the kernel has variable memory usage. Once you go over 100% your machine is going to start thrashing and your performance is going to go all to hell.
That's because your experience is obviously ... a bit more limited.
Why, because I'm not huffing and puffing like you are? I judge you on your technical statements, not some e-peen Slashdot resume.
I noticed the same thing. According to http://blogs.oracle.com/java/entry/java_7_questions_answers, the fix is only in "current builds of JDK 7 Update 1". I imagine you can download it from the OpenJDK site somehow, but it does not seem that JDK 7 Update 1 has actually been released yet.