If Java Is Dying, It Sure Looks Awfully Healthy 577
Hugh Pickens DOT Com writes "Andrew Binstock writes at Dr. Dobb's that a recurring prejudice in the forums where the cool kids hang out is against Java, often described as verbose and fading in popularity but Binstock sees little supporting evidence of Java being in some kind of long-term decline. While it is true that Java certainly can be verbose, several scripting languages have sprung up which are purpose-designed to spare developers from long syntactical passages to communicate a simple action, including NetRexx, Groovy, and Scala. As far as Java's popularity goes, normally, when technologies start their ultimate decline, tradeshows are the first to reflect the disintegrating community. But the recent JavaOne show was clearly larger and better attended than it has been in either of the last two years and vendors on the exhibiting floor were unanimous in saying that traffic, leads, and inquiries were up significantly over last year. Technically, the language continues to advance says Binstock. Java 8, expected in March, will add closures (that is, lambda expressions) that will reduce code, diminish the need for anonymous inner classes, and facilitate functional-like coding. Greater modularity which will be complete in Java 9 (due in 2016) will help efficient management of artifacts, as will several enhancements that simplify syntax in that release. 'When you add in the Android ecosystem, whose native development language is Java, it becomes very difficult to see how a language so widely used in so many areas — server, Web, desktop, mobile devices — is in some kind of decline,' concludes Binstock. 'What I'm seeing is a language that is under constant refinement and development, with a large and very active community, which enjoys a platform that is widely used for new languages. None of this looks to me like a language in decline.'"
Java already had closures (Score:3, Informative)
Java had closures in the form of Anonymous classes. While it is true that lamda expressions will be much more concise, it is not correct to suggest that closures are being added with Java 8.
I often hear that Java "doesn't have closures." Since anonymous methods can capture variables within the scope of their declaration, they are closures.
I also frequently hear that Java is "interpreted," but that's a whole 'nother discussion.
Re:Java already had closures (Score:5, Insightful)
That entirely misses the point. The conciseness is the entire point.
If I have a list of strings, and want to append ".txt" to each, using a for loop is just one more annoying piece of COBOLesque boilerplate.
fileNames = names.Map(n => n + ".txt");
That's what you want.
docFileNames = names.Where(n => n.StartsWith("Doc")).Map(n => n + ".txt");
You can understand what that does even though I just make up the methods. That's the damn point.
Re:Java already had closures (Score:5, Insightful)
I find the following easier to know whats going on:
I don't understand that. I do understand:
Arraylist docFileNames = new Arraylist();
for (String name:names)
docFileNames.add(name+".txt");
Re: (Score:3)
Java doesn't have closures and it won't have any in Java8 either. A closure isn't the same as a lambda. In a closure, free variables are stored by reference, and their changes are reflected in the closure. Java8 lambdas require all free variables to be final.
Scala is a scripting language? (Score:3, Insightful)
Re: (Score:3)
More to the point, it's not Java. It's Scala.
Re: (Score:3, Interesting)
Scala is basically C++ on the JVM.
It's what Java would be if the stewards of Java weren't so conservative (or lazy) about new features.
The powerful features of Scala tend to make code unreadable months down the road in my experience. :(
Re:Scala is a scripting language? (Score:5, Funny)
Java only promised write once and run anywhere. Nowhere in that promise was write once, be able to read it later. <<Takes cover>> :-D
Re:Scala is a scripting language? (Score:4, Insightful)
Java only promised write once and run anywhere. Nowhere in that promise was write once, be able to read it later.
Oh, you can read it later. It's just so damn verbose that you'd better set aside a long time for reading it...
Re:Scala is a scripting language? (Score:4, Informative)
Scala is basically C++ on the JVM.
No. Scala is a functional programming language, it's nothing like C++.
Re: (Score:3)
Then Perl is obviously not a scripting language.
Comment removed (Score:5, Funny)
Re:javas not dead! (Score:5, Insightful)
have other java applications that are designed to explore the limits of slab allocation and heap return in memory
You remind me of far to many C programmers I've met (and projects I've been on).
"Look I've reinvented that difficult plumbing built into C++ - my language is just as good as C++!"
"Yeah. How much time did that take? How many nightmarish bugs did you overcome?"
"Lots. And a few."
"Time well spent then, I'm sure, and my best wishes that there's not one last plumbing bug that you'll find in the field".
Different tools for different jobs. C++ isn't the right tool for much, but nothing else comes close for jobs that actually need the cruft that clutters C++. Taking over memory allocation is a perfect example. (Checking an object every time it's dereferenced to make sure it hasn't been freed or worse, re-used is another - man that's a stupid problem to solve in Java or C#.)
Re:javas not dead! (Score:4, Insightful)
Different people may look differently, but for me, all that means that Java is suboptimal for games or other heavily performance-oriented stuff, and this is the only kind of software I enjoy programming. Making performance-insensitive backends full of "business logic" is for someone who is in the software industry for money only...
The story, as visualized in Python (Score:5, Funny)
The Dead Collector: Bring out yer dead.
[a company puts COBOL on the cart]
Oracle Corporation with Dead Body: Here's one.
The Dead Collector: That'll be ninepence.
Java: I'm not dead.
The Dead Collector: What?
Oracle: Nothing. There's your ninepence.
Java: I'm not dead.
The Dead Collector: 'Ere, he says he's not dead.
Oracle: Yes he is.
Java: I'm not.
The Dead Collector: He isn't.
Oracle: Well, he will be soon, he's very ill.
Java: I'm getting better.
Oracle: No you're not, you'll be stone dead in a moment.
The Dead Collector: Well, I can't take him like that. It's against regulations.
Java: I don't want to go on the cart.
Oracle: Oh, don't be such a baby.
The Dead Collector: I can't take him.
Java: I feel fine.
Oracle: Oh, do me a favor.
The Dead Collector: I can't.
Oracle: Well, can you hang around for a couple of minutes? He won't be long.
The Dead Collector: I promised I'd be at Microsoft. They've lost nine today.
Oracle: Well, when's your next round?
The Dead Collector: Thursday.
Java: I think I'll go for a walk.
Oracle: You're not fooling anyone, you know. Isn't there anything you could do?
Java: I feel happy. I feel happy.
[The Dead Collector glances up and down the street furtively, then silences the Body with his a whack of his club]
Oracle: Ah, thank you very much.
The Dead Collector: Not at all. See you on Thursday.
Oracle: Right.
Java won't die. (Score:5, Insightful)
The reason Java is still alive and well is not because it's a good language. It's not because Oracle does a good job patching security faults with it. It's not because it may be able to run most of it's code on any given OS that can run its VM.
The reason Java is still alive and well is because it is the OO language most schools, universities and colleges teach in their CS classes.
Re:Java won't die. (Score:4, Insightful)
Uh huh. Maybe you're not old enough to remember PASCAL? Which was the overwhelming favorite of colleges and schools back in the late 80s and early 90s?
Re:Java won't die. (Score:5, Informative)
The reason Java is still alive and well is because it is the OO language most schools, universities and colleges teach in their CS classes.
Which is both a blessing and a curse. I went through my programming undergrad classes in the last round they offered C and C++. It worked out well because my employer needed those languages and for me to be able to learn others quickly, such as Java and C#. My experience with classes in C++ and lower level bit-bashing in C gave me the knowledge in being able to create custom libraries and handle oddly defined standard binary blobs, such as DTED data.
This same employer stopped looking at my school afterwards simply because Java was the dominant language. The graduates being churned out had knowledge of data structures and libraries, but knew very little of the ins and outs of binary data streams, binary blobs, memory management, and all those other things that you need in C and C++ that Java gives you for free.
Yes, it's good to have an approachable basis for such a complicated field as programming (computer science/software engineering/development/etc..). However, going from C/C++ to Java is a lot easier than the other way around. There's a reason my professor called Java a "Training Wheels Language"
Re: (Score:3)
Leaving aside its pros and cons, the biggest reason that Java initially caught on was Sun's marketing department.
Re:Java won't die. (Score:4, Insightful)
Nah, it caught on because you could do simple stuff simply without whacking away in C or C++ and that it was cross platform at a time when attempting to do cross platform development usually meant you had to shell out for proprietary pile of stuff which locked you in. Java was good for backends as well where you had a lot of horse power to apply to its programs. Java was also good for universities to use in teaching programming, not that it made for good teaching.
Sun had a marketing dept? What were they marketing?
Re: (Score:3)
I'm sorry to hear that the acquisition caused you to lose your job in the Sun marketing department. Based on the fantastic job you guys did though, you ought to able to find something else.
Re: (Score:3)
The reason Java is still alive and well is because it is the OO language most schools, universities and colleges teach in their CS classes.
I transferred and finished my degree at a different school than I started at. I knew they were a good school when they refused to transfer any credits for any class that was taught in Java.
Re: (Score:3)
Pointer arithmetic is missing (good).
Re: (Score:3)
What other language/platform is out there that could rival Java? AFAIK none!
Depending on what you're after, C# (yes, with Mono, it's actually pretty good) or D might work for you.
Re: (Score:3)
No, they started teaching Java before it became really big. It became really big because every student who graduated from uni had a Java hammer, so every problem looked like a nail to them. It was back when everyone was having orgasms over "write once, run everywhere" and it looked like Java was going to be the answer for making things happen on the web.
Intro programming languages were always "fad of the year" in CS departments. It used to be that students learned some random language, Fortran/Modula-2/Fort
Android, Objective-C and Tiobe Index (Score:3)
Outside of Android - I believe use and acceptance is waning heavily. As a client-side web tool (where it got most of it's early predominance) it has been cockblocked by iOS, and is becoming overshadowed by native HTML5 (JavaScript) stuff. As a server-side tool it has been getting taken over by Ruby/Rails, Python and the stuff mentioned in the OP.
Re:Android, Objective-C and Tiobe Index (Score:5, Insightful)
I don't think Java and Rails, Python, etc actually compete much. They're very different technologies.
Rails and Python are great when you don't have significant technical skills and just need to slap some shit together and throw in on a web server.
Java is better in areas where you need high performance and scalability, but it's also much more costly to do anything with it.
Re: (Score:3)
The smart thing to do is use Jython, JRuby, Groovy.
Then you can write in Java when the problem demands it, and in something more expressive when you're gluing it together. And you have access to all the thousands of libraries Java has.
I saw a JRuby presentation in which they said they expected JRuby to outperform native Ruby -- because the Ruby runtime is written by a few guys, whereas the JVM has half a campus full of incredibly clever people, just working on making it run Java Bytecode as fast as possible
Re:Android, Objective-C and Tiobe Index (Score:5, Insightful)
Rails and Python are great when you don't have significant technical skills and just need to slap some shit together and throw in on a web server.
I've seen this from the other side. Java is a *great* language for the middle of the normal distribution. I'm not going to name the languages on the left side of the curve, because the point of this isn't to start a flame war, but if you have a large number of averagely competent programmers, then Java lets you (as architect/manager/etc.) have those programmers be productive for you, produce code that can be read in the future by the same segment of the population, and be reasonably sure the language will prevent them from making hidden catastrophic mistakes. Also there are a large number of existing tools that let you scale their work out both in depth and in breadth.
The alpha geeks employing Ruby, Python, modern Perl, erlang, etc. are usually at the right side of the curve, doing very efficient, agile, but abstract and terse stuff that takes exceptional (not heroic, just unusual) sysadmin skills to get to work on a grand scale.
Due to the nature of the available talent pool, it's natural to see projects start with the advanced scripting languages among the startup crowd and then migrate to the Java environment over time. Twitter would be a good example of this.
Re:Android, Objective-C and Tiobe Index (Score:5, Informative)
Twitter didn't switch to Java to take advantage of the mediocre "kind of a programmer" Java talent pool.
They switched because their "alpha geeks" couldn't make Ruby/Rails perform adequately for the amount of traffic they get.
Re: (Score:3)
Why didn't they switch to C++ and do it properly!
Re: (Score:3)
Because they needed it to be fast AND secure AND fairly bug free.
Re:Android, Objective-C and Tiobe Index (Score:5, Insightful)
Because it would be a dozen times more efford in programming hours, because it lacks the relevant libraries, because the amount of capable C++ programmers is very low, because C++ is a dying language in the enterprise environment, because C++ is not truely portable across platforms, because in the end when it comes down to performance the C++ implementation (which costed you 5 times the money and 2 times the time to develop) will be only 5% faster than the Java implememtation.
And all arguments above will kill you when you plan to maintain it for the next 15 years.
Re:Android, Objective-C and Tiobe Index (Score:5, Interesting)
No, I've seen pretty much that dynamic happen at Google where we use a lot of C++ and Java.
There are some places Java just can't follow C++ ... the Google core web search serving system is mostly C++ because it involves decoding extremely compact data structures at insanely high speeds, to the extent that the verymost inner code has branch prediction hints in it. Java can't do that nor will it ever be extended to do so. Lots of servers at Google are written in C++ for the same reason. I don't believe it's only 5% faster, the rule of thumb I see is you lose about 2x the performance by using Java when all the costs are taken into account (like constantly re-compiling the same code over and over on the live servers, the GC costs, etc).
Despite that, lots more code is written in Java, because the cost of using C++ is so high. Sure, when the sailing is smooth there isn't a huge difference between them as long as your libraries and support infrastructure are good, but the moment someone slips up and accidentally double frees memory on an error path you've got a problem that can take an entire team a week or more to track down. I've seen it and partaken in such bug hunts. There's nothing quite like trying to find memory corruptions that only show up in the production environment once a day, when you have thousands of servers.
Basically any programmer can screw up that way. Java strikes a reasonable balance between safety and performance, which makes sense even when you are a company like Twitter or Google.
Re:Android, Objective-C and Tiobe Index (Score:4, Insightful)
I agree that Rails / Python are definitely the more small scale / personal project side projects type solutions out there. Yes they can scale, but I'd argue that they're not good at it.
Java SUCKS for small scale. EE containers are heavy and require a good set of knowledge to even take crack at a reasonable site, but once that painful layer has been passed, adding more and more to the service becomes as trivial as the business domain requires. The extra leveraging from well architected services and API's makes working on larger scale Java systems a dream in comparison to others (Currently working on a Java Web/Services project single deplyment EAR that's over 3 million source lines BEFORE all the libraries and server container features that we're also leveraging).
I'd also argue that outside of hosting, you can easily get Java based web service tools/servers/etc.. for 0 dollars. You can't find much Java hosting in the zero dollar number (Redhat's cloud Jboss 7 or the non-standard Google appengine being a notable exceptions) which may be an issue to some enthusiasts who don't do their own hosting.
Re: (Score:3)
As a server-side tool it has been getting taken over by Ruby/Rails, Python and the stuff mentioned in the OP.
I hope you are kidding here, because that is far from the case. Java is still the de-facto language for most server-side applications. RoR never outgrew it's hipster background. It has been 7 years since RoR had it's hype peak... The hype waned and RoR is still a rarity.
Java and the JVM (Score:5, Informative)
People don't understand the difference between Java the Language, Java the Virtual Machine (JVM) and Java the Browser Plug-in.
What do NetRexx, Groovy, and Scala have in common? They are all languages that are considered production stable running on top of the JVM. There are about a half dozen production ready languages that run on top of the JVM in fact. By running in the JVM these languages automatically pick up all sorts of performance and availability enhancements (JIT, Hotspoting, caching, etc.) the JVM offers. That's a lot of R&D the new languages don't have to invest in. It also allows new languages to be used in existing Java infrastructure with little to no change.
The reason this is all possible is because Java the language is just an abstraction that compiles to Java Op Code. Java Op Code is very stable. Since Java 1.0 all that's changed with the opcode is a couple new operations and couple deprecations. There's still around 100 codes total.
So why do people think Java is on the decline? Well the browser plug-in has been getting a bad name as of late. But that plug-in != Java. And frankly very few applications need a Java Plug-in. HTML5 and JS work just fine for the UI. It's not going to be a great loss if peopledisable it. You also get knee jerk reporting on this advising people to get all Java on their machines. Like it's somehow less secure than the VB runtime executors.
As far as jobs, I work in the java space. There's way more need than people to fill the need. I make extremely good money java programmer.
Re: (Score:3, Informative)
Java Op Code is very stable. Since Java 1.0 all that's changed with the opcode is a couple new operations and couple deprecations. There's still around 100 codes total.
This page [oracle.com] seems to indicate it's slightly over 200 in Java 7.
Which Java? (Score:5, Insightful)
The JVM or the language?
If there's such a market.. why the Ask toolbar?? (Score:5, Insightful)
It definitely doesn't help that the JRE installer tries to also install the Ask toolbar. Seriously? Even Microsoft doesn't try to install Bing with the .NET installers, and that's their own property they're desperately trying to push on everyone.
How am I supposed to take a platform seriously if the fundamental piece that has to be installed by all developers AND users to use it is doing the same sneaky things that half the crappy freeware on the internet is doing?
Just how much revenue does Oracle make from Ask anyway?
Have you seen how much those flying yachts cost? (Score:3)
Larry Ellison is just another borderline personality disorder businessman who doesn't give a fuck about anything besides making himself richer and self-aggrandizement.
He and Ballmer should go to some private island and never be seen again.
Re:If there's such a market.. why the Ask toolbar? (Score:5, Informative)
The Windows JRE installer is an obnoxious piece of crap. Fortunately modern JDKs ship with something called the JavaFX Bundler, which makes native installers (exe, msi, dmg, rpm, deb) for each platform that bundles a stripped down JRE with the app, so there is no need to install the JRE or keep it up to date. If you are distributing consumer software or don't want to handle the problem of keeping JREs up to date, it's useful.
There are also tools that can eliminate the need for the JVM entirely, for instance by ahead of time compiling entirely to native (Excelsior JET is one such program), or alternative JVMs that sacrifice some performance for code size, like Avian.
shipping java scientific software for 15 years (Score:5, Interesting)
Java allows seamless GUI front ends and web-service control.
The new features in Java-8 are very interesting.
Re: (Score:3)
Benchmarks?
I've heard the "Java can be faster than C/C++" many times, but have never seen benchmarks that back it up.
Re:shipping java scientific software for 15 years (Score:4, Interesting)
Re: (Score:3)
From your link:
The Mines Java Toolkit (JTK) is a set of Java packages and native (non-Java) code libraries for science and engineering.
In other words, there is C/C++ wrapped in Java. That may be a good idea for many applications, but it's not a measure of Java's speed.
Ye olde Computer Language Benchmarks Game [debian.org] has pure Java vs. pure C++. There is one test where Java is slightly faster than C++ (and even that advantage disappears depending on which of the four processors they tried). Otherwise C++ is up to 3x faster, and an average, from glancing at the graphs, of about 2x faster.
I tend to trust these benchmarks because anyone
Re:shipping java scientific software for 15 years (Score:5, Insightful)
Not just can be, it usually is faster. At least, once it's been JITed. We just ran some XML serialization/deserialization tests, and the java implementation was much faster than the C++ one...eventually. The first several hundred iterations it was slower, but after that the Just In Time compiler optimized it, and it easily won.
For long running computations, like scientific calculations for instance, Java is really good. The problem is we perceive how fast something is based on our wait time. Every time you boot a java applications it takes a long time for it to get started relative to a C++ applications. A quick command line java application might be orders of magnitude slower than a comparable C++ one. And that delay kind of permeates our intuitions about which is faster.
Re: (Score:3)
Some of the big banks have been putting Java on top of COBOL backends. You think I'm kidding, but I'm not.
Java's problem isn't verbosity (Score:5, Insightful)
Re:Java's problem isn't verbosity (Score:5, Funny)
There's certainly a lot of factory pattern stuff out there. But your comparison is a bit outdated. Now days development uses a lot of annotations, auto-wiring/dependency injection. If I need to roll out a web service that makes some DB calls it's not that big of a lift. Maybe a half a dozen classes to get the job done (including tests).
Re:Java's problem isn't verbosity (Score:4, Informative)
You know what's fun? When a so-called Java expert runs a PHP project...
Nothing but him bitching about how PHP sucks, and then discovering his code has factory factory factories in a central component that everything extended from (even when obviously unnecessary). And we wondered why we were having such performance issues.
Re:Java's problem isn't verbosity (Score:5, Insightful)
Nothing but him bitching about how PHP sucks...
To be fair, it does.
Re: (Score:3)
Especially when you try to make it operate like Java.
Hooray! (Score:4, Funny)
Re: (Score:3)
I worked in Rexx on MVS and OS/2 in the early 90s. I'm astonished it's not dead and buried.
It's shocking (Score:3)
Re:It's shocking (Score:4, Funny)
With Oracle doing everything possible to kill Java, it's shocking that Java serializes.
FTFY. :)
update nagging (Score:5, Insightful)
- the constant nagging from the java updater. (Although to be fair, the updater has been killed on any and all of my devices.)
- the braindead way of keeping old version of the jdk and jre around. Words can't describe how freaking lame this is. I only want one java directory, with one jre and one jdk in it. The new versions need to replace the old ones and provide backwards compatibility.
Java is the new COBOL (Score:5, Funny)
- Most CS programs train their graduates in Java.
- Java is pretty much the enterprisey middleware language these days. I've seen so many J2EE applications alive inside organizations doing mundane but vital tasks.
- Unless you're a web startup, Java is almost universally used for line-of-business application development. That ugly GUI that collects budget numbers from 500 databases and displays an "executive dashboard" was probably slapped together by an Accenture type outfit using offshore new grad coders and sold to companies for millions.
It's just too prevalent now for people to say, "Oracle sucks, we're porting everything to C#." I can definitely see a market for Java talent similar to the COBOL market 30 years down the road. People won't need millions of Java coders anymore, but they'll need older expert types to go untangle messes.
who it is popular with (Score:4, Interesting)
That's because the "cool kids" ignore servers (Score:4, Funny)
Java has had closures for years (Score:3)
Java has had closures, with all the stuff that does to local variable lifespan, since Java 7. Lambda expressions are just syntactic sugar for writing small closures.
Re:Wake me up... (Score:5, Insightful)
Wake me up when netcraft confirms it. Until then it's not dying.
Re: Wake me up... (Score:3)
Re: Wake me up... (Score:4, Informative)
Re: Wake me up... (Score:5, Informative)
Characters suck. C++ and Python both allow easy 32-bit characters, which at least allows you to store one Unicode codepoint per "char". But in non-Western languages there are still glyphs that must be composited from several codepoints.
But why would anyone care? UTF-8 works fine for sorting and comparing and so on, it's well designed that way.
Re: Wake me up... (Score:4, Insightful)
ISO-8859-1
The one with those funny marks on the letters? Bah. ASCII. The eighth bit is just a spare. If you can't do it in English, then it isn't worth doing.
Re:Wake me up... (Score:5, Informative)
http://docs.guava-libraries.googlecode.com/git/javadoc/com/google/common/primitives/UnsignedInteger.html [googlecode.com]
Re:Wake me up... (Score:5, Informative)
Python, Perl, and Ruby are examples of other languages that don't support unsigned integers. These languages are independent of the underlying hardware and automatically upsize the integer to handle larger value. You can always use the AND operator to convert to an unsigned integer for C calls. (e.g. var & 0x0FFFFFFFF).
You're not a real programmer if you can't adapt to the lack of unsigned variables.
Re:Wake me up... (Score:4, Insightful)
Re:Wake me up... (Score:5, Insightful)
You're not a real programmer if you can't adapt to the lack of unsigned variables.
Forget about being a "real programmer" and focus on being a "real developer.' There are functional requirements and then there are technical requirements. Functionally speaking, how important is it to have an unsigned data type rather than having the equivalent data type and enforcing a "no negative values" rule? I'm not sure I can think of any, aside from the case of being able to interpret unsigned data types for interoperability. But that says nothing about the need for the actual storage of that data.
I'm pretty sure that some respected Computer Scientist said something about premature optimization....... It's a good rule. Focus on meeting the functional requirements of the system you are developing, and then optimize where it makes sense. I don't think you are going to notice the lack of unsigned data types. But if you really need them, perhaps that should be a signal that a lower-level language is more appropriate for that particular component in the system.
Re:Wake me up... (Score:5, Insightful)
I'm pretty sure that some respected Computer Scientist said something about premature optimization
I think there is a balance to be struck, putting too much effort into optimising early on is a waste of time but that doesn't mean that languages that make inefficient soloutions easy and efficient soloutions painful are a good thing. Unsigned types are just one of many cases where java does this.
Unsigned types are a good thing for several reasons.
1: They are easier to bounds check. If you have an unsigned type you only have to worry about making sure it is not too large. If you only have a signed type then you either have to make sure all your bounds checks cover the negative case or be very careful not to accidently generate negative values.
2: They can store values twice as large. Sometimes that is the difference between fitting the number you want in one size of data element and being forced up to the next size (which is likely to double your memory requirements).
3: Some algorithms (particulally in crypto) are designed arround unsigned integers of a specific size.
4: the interoperability requirement you mention. Sometimes you have to work with another system where it has been decided by someone outside your project that say a 32-bit signed integer is sufficient.
Don't get me wrong all these things CAN be worked arround but those workarrounds mean lower efficiency AND more potential for mistakes.
P.S. Java does have an unsigned 16 bit integer type despite lacking unsigned 8 , 32 and 64 bit types. It calls that 16 bit unsigned type "char".
But if you really need them, perhaps that should be a signal that a lower-level language is more appropriate for that particular component in the system.
Mixing languages adds extra complexity, especially with stuff like java. So IMO a good critera for a language is what range of "levels" it can cover without having to resort to mixing languages.
Re:Wake me up... (Score:5, Insightful)
1: They are easier to bounds check. If you have an unsigned type you only have to worry about making sure it is not too large. If you only have a signed type then you either have to make sure all your bounds checks cover the negative case or be very careful not to accidently generate negative values.
So, what does your code do if an end-user passes -1 which would get stored in your unsigned value? And as a reminder, your argument is that you don't have to do bounds checking for the lower bound.
Re: (Score:3)
It would probably become UINT_MAX, then I suppose what the GP means is that the value would violate the upper bound check, and then implicitly and magically fail the validation without having to type an extra " || x 0".
Yep I think the argument is crazy, but at least the code works.
Re: (Score:3)
It would throw an exception at the site of the cast. Why do you think Java would be dumber than C with warnings turned off?
You apparently don't know the difference between something the VM should be doing and having to repeat stupid boilerplate like this a thousand times:
if (index < 0) throw new IllegalArgumentException()
On the verge of using a type twice as wide (Score:3)
Functionally speaking, how important is it to have an unsigned data type rather than having the equivalent data type and enforcing a "no negative values" rule?
If your application logic's requirements include being able to represent values between 2^((2^n) - 1) and (2^(2^n)) - 1, such as 128 through 255 or 32768 through 65535 or about 2.1 to 4.2 billion, in a cache-efficient array, you usually want to use an unsigned type. This often comes up when trying to represent the native unsigned data types of an emulated machine or the unsigned data types of various SQL databases. You could use a type twice as wide, but that'd fill L2 cache twice as fast, causing capacity
Native code produces a security exception (Score:4, Interesting)
But if you really need them, perhaps that should be a signal that a lower-level language is more appropriate for that particular component in the system.
Provided that the platform curator even allows the use of lower-level languages. For example, Java applets have to be written in Java, and Xbox Live Indie Games and Windows Phone 7 applications have to be written in C#.* An applet that attempts to use JNI or an XNA game for Xbox 360 or application for Windows Phone 7 that attempts to use P/Invoke will die with a security exception.
* Technically, XBLIG and WP7 allow the subset of verifiably type-safe CIL accepted by the .NET Compact Framework. But in practice, languages other than C# either aren't verifiably type-safe (such as standard C++ in C++/CLI) or require library facilities not present in the .NET Compact Framework (such as any DLR language).
Re: (Score:3)
Unsigned integers are not just for optimization.
I remember as a young pup writing a part of a program which suddenly crashed in certain circumstances but not on NT only in Win95.
Of course the problem was not detected until the program was out in the field because all the developers used NT.
I was using memory mapped IO. At one point I was reading from I something in an array of variable size. At the end I was supposed to determine how many there were. Simple enough calculate the length divide by the size.
So
Re: (Score:3)
So I cast the final address and the base address into an int and subtracted to get the length.
If you're ever, anywhere in your code, casting pointers to integers, and it's not because you're passing it to some low-level interface to hardware... you're almost certainly doing something wrong.
Re: (Score:3, Funny)
You're not a real programmer if you can't adapt to the lack of unsigned variables.
You're not a True Programmer unless you use Gamemaker! Return! Return! Return! Return!
Return...TO GAMEMAKERDOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOM!
Re:Wake me up... (Score:5, Informative)
"unsigned integers" are an artefact of "bit twiddling" programming languages. Bit twiddlers are essentially high-level assembly language.
Java is not an assembly language, it is an abstract language. It is intended to create write-once/run-anywhere code that isn't dependent on the CPU or OS, byte/bit orders or how many bits are in an "unsigned integer".
Most programmers actually use "unsigned integer" to refer to a collection of bits, not actually as a mathematical unsigned integer (cardinal number), just as they erroneously refer to characters interchangeably with "bytes".
If you really DO want to work with cardinal numbers in Java, just don't use negative values. A java int can hold a respectably large integer value. And if that's not big enough, there are special classes that are more or less open-ended.
If you absolutely positively must work with 100%-guaranteed cardinal numbers, use Ada, which allows user-defined types to contain user-defined ranges that will be checked at compile time and enforced at run time and that includes integers whose range is from 0..whatever. Of course, there's a price to be paid for that.
Re:Wake me up... (Score:4, Informative)
Yeah, no Java programmer needs unsigned ints. It's not as though they need to interface to code which does have unsigned ints, like calling C++ libraries, or reading data from files or databases created by C or C++ programs, or reading files in standard, language-agnostic formats which are packed full of bytes that you then have to process as 16-bit signed integers instead.
Lack of unsigned variables is one of the most braindead ideas in Java.
Re:Wake me up... (Score:4, Interesting)
You should tell John Carmack about your theory, I bet he'd be really interested:
https://twitter.com/ID_AA_Carmack/status/85734195644727297 [twitter.com]
Re:Wake me up... (Score:4, Interesting)
Wake me up when java supports unsigned integers. Until then it's not a real language.
While unsigned numbers are great for a few things, mixing them with signed numbers is a real pain. Just consider all the C functions, which take in unsigned but return signed, and casting galore that follows. Of course you can just disable relevant warnings entirely and blindly hope implicit casts anywhere will never overflow, but that is kind of sloppy, and just asking for someone to find a way to use it for an exploit. Which incidentally is what most C code does.
Re:Google Chrome is killing java (Score:5, Insightful)
Java is a lot bigger than Java Applets.
Java Applets fucking suck and deserve to die.
Re:Google Chrome is killing java (Score:5, Informative)
(chrome is 32 bit, and java 1.7 is 64 only.)
Total bollocks. Here's 32-bit Java for:
Windows [sun.com]
Linux (tarball) [sun.com]
Linux (RPM) [sun.com]
Re: (Score:3)
hmm, wordiness is irritating, I'll grant you, as is boilerplate. But, it just stops being irritating the moment that your IDE starts taking care of all of that for you. Writing Java from the command line is an exercise in extreme torture, but Eclipse makes it just fine. Liberal use of ctrl-1, ctrl-space, and the refactor functions on context menus and the actual menu make most of these annoyances trivial. Also, I have yet to see something that can refactor javascript as well as eclipse refactors java.
Al
Re: (Score:3)
It would be nice if java supported something like typedefs.
What for? Either you're doing it to name a type elegantly — except you don't need that in Java because classes already have reasonable names and you don't have a mess of structures as values plus pointers and references, as in C++ — or you're doing it to hide how complex the implementation of a data structure is — but there you're really encouraged to wrap a class around it and put an honest API in place — or you're doing something like aliasing. Aliasing isn't a great idea either; i
Re:A Man Can Dream (Score:5, Funny)
Yes, we can all dream of a day when Oracle is just ashes on the ground, and a footnote in corporate history.
Re: (Score:3)
It would have been better if Android supported Python instead of Java.
Re:Android is not always Java (Score:5, Informative)
https://ep2013.europython.eu/conference/talks/developing-android-apps-completely-in-python [europython.eu]
Re:Android is not always Java (Score:5, Informative)
NativeActivity doesn't support most of the Android APIs, including most obviously the widget toolkit. It's intended for games that just need an OpenGL context and raw input, all other kinds of apps still need to use Java.
And you know what? That's not such a bad thing. A few years ago I guess I was basically a C++ programmer who was in the "Java sucks" camp, and I came back to Java only because I wanted to write stuff for Android. Over time I've come to appreciate the whole platform and ecosystem more. Things I especially appreciate:
Re:Sudden death (Score:5, Informative)
I consult in a lot of sectors. Banking, Insurance, New Media, Old Media, Start-ups, etc. People who want to leave Java for some new language are doing it because of a set of features. I've yet to come across anyone, let alone an institution, that wanted to leave Java because of Oracles court proceedings (I would assume against Google for Android).
There was tons of talks on OpenJDK at JavaOne. If Oracle is the next Microsoft you would think they would have put the hammer down on that. I didn't see any of that happening. In fact Microsoft's cloud support of Java is based on OpenJDK and that was a keynote item.
On the other hand, I do hear a lot of dissatisfaction from the MySQL folks. They are moving to Maria (or other DBs). That has little to do with Java.
Re: (Score:3)
As if features are the only thing that makes a language a language. I'm not saying Lisp isn't nice, but which lisp? And, after you select which lisp, which library to do the thing you're trying to do? Oh wait, they often don't exist. So you hand roll your own, because it is easy in lisp, due to lisp's powerful nature. So now you can't hire people who know about the things you're doing right out of the gate because you choose a specific lisp and hand rolled a bunch of stuff. Need to integrate with xyz
Re: Keep it up - you might just invent assembly... (Score:5, Insightful)
Re: (Score:3)
I don't know what you are talking about, EF does support .Single() just as any other LINQ method works on an IEnumerable (here's a question about it [stackoverflow.com]). If it was throwing an exception, it's because you had more than 1 item meeting the criteria, and you don't know what you're doing. Try .FirstOrDefault(), which will not throw an exception.
As for why there is no Tree class in .NET, you can refer to this question [stackoverflow.com], where the answer is enumerated for you. Having worked with .NET since 2003 when it came out, and i
Re: (Score:3)
Re:Scripting / PowerShell (Score:4, Insightful)
The point was to list decent halfway-decent scripting languages.
Powershell is a batch file on steroids. It is good for automating system administration in a known environment, but not much else. While many Microsoft products do offer modules, there's still a lot of (especially older) ones that don't. Also, since much of the existing API is a direct port from Windows' internal structure, many of the designs are non-intuitive, like having IP addresses almost completely separate from NICs.
My biggest complain about PowerShell is what I now unaffectionately call "PHP syndrome": Extensible through modules, but there are no namespaces. As the system grows, the list of core commands grows as well, and there is no clear grouping available outside the documentation.
Yes, it is a nice enough replacement for the dozens of little VBScript files kicking around, because it offers easy access to WMI and .NET. Unfortunately, it also brings over a new "On Error Resume Next", in the form of silently continuing after each error.
Re: (Score:3)
Java: ~26.5%
C: ~20.0%
C++: ~14.0%
Visual Basic: ~8.0%
Now let's check out each of those language's current market share:
Java: 16.15%
C: 16.98%
C++: 8.66%
Visual Basic: 4.84%
Now we can look at the deltas, both in absolute terms and as a perc
Re:Dweebs hate Java because it is too easy (Score:5, Funny)