Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Closed Thread
 
Thread Tools Display Modes
Old Nov 26th, 2008, 12:58 AM   #1
mrynit
Hobbyist Programmer
 
mrynit's Avatar
 
Join Date: Mar 2006
Location: WA, USA
Posts: 348
Rep Power: 12 mrynit is on a distinguished road
Send a message via MSN to mrynit Send a message via Yahoo to mrynit Send a message via Skype™ to mrynit
why do people hate java

Nearly everone I talk to in non-java IRC channels says java is terrible. The people i have talk to in real life about java also hate java. Everyone thinks its slow, takes up too much system resources, the language is bloated and unorganized, you cant do enough things in it, cant make games. Every school i konw of teaches java. I know NASA uses java for the mars robots. Java is used frequently in server programming. If java was so terrible would'nt people not use it?
__________________
i dont know much about programming but i try to help
mrynit is offline  
Old Nov 26th, 2008, 1:20 AM   #2
Grich
Professional Programmer
 
Grich's Avatar
 
Join Date: Sep 2007
Location: Sydney - Australia
Posts: 424
Rep Power: 11 Grich is on a distinguished road
Re: why do people hate java

Quote:
Originally Posted by mrynit View Post
Nearly everone I talk to in non-java IRC channels says java is terrible
Don't you mean C++ programmers!

How I see it this like this: Every language has its place.

I code in C++ and Java, personally, Java is my favourite. It is alot easier to code something in Java than C++ at times (in particular, GUI development).

I have used Java to make Graphics before and found it not as slow as some programmers claim. I haven't made a game in Java yet, so I cannot critque the performance of games prorgammed in Java ( I am making a cool dominos game right now, but have a few bugs in the code!)
__________________
SYNTAX ERROR ...
Grich is offline  
Old Nov 26th, 2008, 2:46 AM   #3
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 14 lectricpharaoh will become famous soon enough
Re: why do people hate java

People hate Java because it sucks. It doesn't just suck in the regular sense either; instead, it supplies some serious capillary-bursting oral action to a donkey's private places.
Quote:
Originally Posted by mrynit
Nearly everone I talk to in non-java IRC channels says java is terrible. The people i have talk to in real life about java also hate java.
See above.
Quote:
Originally Posted by mrynit
Everyone thinks its slow, takes up too much system resources, the language is bloated and unorganized, you cant do enough things in it, cant make games. Every school i konw of teaches java. I know NASA uses java for the mars robots. Java is used frequently in server programming. If java was so terrible would'nt people not use it?
Actually, in all fairness, Java's not that bad. It's a pretty robust language, which is why it's popular for mission-critical applications (Mars probe, etc). It's also popular in academia; exactly why, I'm not sure, but possible reasons may include its free nature, broad support (students aren't tied to a particular platform), and the slow rate at which new features are added (while this can be a disadvantage, it can also be seen as stability of the feature set over time).

I don't particularly like certain syntactic elements of the language (lack of operator overloading, properties, etc) and language design choices (generics implemented with type erasure, lack of pointers, lack of pass-by-reference, lack of true multidimensional array support, to name a few), but it is a successful language and it does have its strong points. Compiled Java code is more portable than most other compiled code, but by no means the holy grail its often made out to be, and source-level portability (which is what languages like C and C++ aim for) offers its own set of advantages and disadvantages. Java also has a strong presence in the enterprise server market; a lot of businesses use it for their server-side coding. Applets are also a strong point of Java, but this niche is being contested by other technologies, such as Adobe's Flash and AIR, and Microsoft's Silverlight.

As far as performance goes, pretty much every concern that can be applied to Java can be applied to other virtual machine-based technologies (such as Microsoft's .NET). There will be a performance hit by running under a VM, but this is often much less than people think. Something that's not commonly known (or at least not commonly discussed) is that a VM-based technology that uses just-in-time compilation (translating the bytecode into native machine code at runtime) can actually offer performance gains; this is because it can determine the exact processor type, etc at run time, and thus perform very specific optimization, rather than general optimizations aimed at a broad processor range. Obviously, this only offers a performance advantage if the code runs long enough to make up for the overhead of the JIT compilation, but it's a possibility. This is something that's simply not possible with traditional compilation to native code.

Really, like any other issue in programming, it depends a lot on what you're trying to do. For many things, Java is a perfectly sensible choice ...

... unless, of course, you're a programmer.
Quote:
Originally Posted by Grich
Don't you mean C++ programmers!
He means real programmers.
Quote:
Originally Posted by Grich
How I see it this like this: Every language has its place.
Yeah, and Java's place is in the TR_SH. I'd like to buy a vowel.. Yes, an 'A'.
Quote:
Originally Posted by Grich
I code in C++ and Java, personally, Java is my favourite. It is alot easier to code something in Java than C++ at times (in particular, GUI development).
You ought to try C# for GUI programs then (assuming you're on Windows). Way easier, and the event/delegate model means you don't have to fart around with 'listeners' and this and that.
__________________
My microwave has settings for snake, gremlin, and puppy.
lectricpharaoh is offline  
Old Nov 26th, 2008, 3:38 AM   #4
Grich
Professional Programmer
 
Grich's Avatar
 
Join Date: Sep 2007
Location: Sydney - Australia
Posts: 424
Rep Power: 11 Grich is on a distinguished road
Re: why do people hate java

Quote:
Originally Posted by lectricpharaoh View Post
You ought to try C# for GUI programs then (assuming you're on Windows). Way easier, and the event/delegate model means you don't have to fart around with 'listeners' and this and that.
Being there done that. When it comes to the .NET framework and visual studio I use Visual Basic.
Why I do not want to use C++ in my spare time:
  • I do not want to worry about pointers.
  • I want something a bit more structured.
  • I am not a geek.
C# is the love child of Java and VB.NET. An attempt for Microsoft to dip further into the pot of RAD.
__________________
SYNTAX ERROR ...
Grich is offline  
Old Nov 26th, 2008, 4:24 AM   #5
titaniumdecoy
Programming Guru

 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Location: California
Posts: 1,535
Rep Power: 14 titaniumdecoy will become famous soon enoughtitaniumdecoy will become famous soon enough
Send a message via AIM to titaniumdecoy
Re: why do people hate java

lectricpharaoh, all your gripes about Java seem fairly trivial to me. Java was the first programming language I learned and I am still quite fond of it. It makes things simple; you don't have to worry about the stack, heap, pointers, memory management, etc. You can master the language in a relatively short time unlike C++.

In addition, I don't understand your complaint about Java's lack of pass-by-reference and lack of pointers. Since all objects are references there is never any reason not to pass-by-value, and all objects are essentially pointers.
titaniumdecoy is offline  
Old Nov 26th, 2008, 4:51 AM   #6
Grich
Professional Programmer
 
Grich's Avatar
 
Join Date: Sep 2007
Location: Sydney - Australia
Posts: 424
Rep Power: 11 Grich is on a distinguished road
Re: why do people hate java

I want to be able to make applications without worrying about the lower level (pointers, stacks/heaps etc).

On another note, I might be weird, but I know no programmers who code in C++ in the industry (plenty at uni though). Everyone is .NET, Java, PHP/server side scripting and one in COBOL.
__________________
SYNTAX ERROR ...
Grich is offline  
Old Nov 26th, 2008, 7:01 AM   #7
lectricpharaoh
SEXY SHOELESS GOD OF WAR!
 
lectricpharaoh's Avatar
 
Join Date: Jun 2005
Location: Wet west coast of Canada
Posts: 1,676
Rep Power: 14 lectricpharaoh will become famous soon enough
Re: why do people hate java

Quote:
Originally Posted by titaniumdecoy
lectricpharaoh, all your gripes about Java seem fairly trivial to me.
I hope you weren't offended. After all, many of my comments (the more 'inflammatory' ones, anyways) were in jest. Couldn't you tell? That said, I do feel most of my specific points were, and are, valid.
Quote:
Originally Posted by titaniumdecoy
Java was the first programming language I learned and I am still quite fond of it.
Aha, so that's it. Java's the programming language equivalent of your first kiss.

My first programming language was BASIC. I guess that makes her an ugly girl, though even humble BASIC had the VARPTR instruction. Translation: BASIC 1, Java 0.
Quote:
Originally Posted by titaniumdecoy
It makes things simple; you don't have to worry about the stack, heap, pointers, memory management, etc. You can master the language in a relatively short time unlike C++.
That's not a fair comparison. Mastering C++ takes a lot of time and effort, even for very gifted people. I wouldn't claim to be anything better than a mediocre programmer when it comes to C++ (I'm a much better C# coder than a C++ one).

Besides, I wasn't referring to things like memory allocation, garbage collection, and such. You will have the same thing in any managed environment, such as .NET, and can use smart pointers, STL collections, and/or third-party allocators and garbage collectors in C++ to achieve the same effect. I personally think garbage collection is fantastic, so long as the language provides some 'escape valve' to avoid it where necessary. C and C++ lack a GC, so unless you plug in a third-party one or roll your own, this isn't an issue, and .NET languages like C# provide this escape valve in the form of structures, which are like lightweight classes that live on the stack instead of the heap. Though Java doesn't provide this, it wasn't one of the gripes I listed, but it certainly is a Java flaw in my eyes.

Imagine you're doing something with great frequency, and this something involves instantiation and destruction of objects. Picture I'm writing a game, and in the render loop, I have to create lots of short-lived objects (sprites for bullets are a good example, as they're both numerous and ephemeral). If I use full-fledged classes under C#, I will allocate stuff faster than the GC can reclaim it (tight game loops typically don't use thread-friendly techniques like sleeping, and a modern GC- like that in Java or .NET- tries to run only when other threads are idle). Sooner or later, there's no space left in the heap, and my program locks up for ten seconds as the GC shits itself, and does a full collection. Using a struct avoids this issue, because it's allocated on the stack like a primitive type. You can alleviate this problem in Java if you use a pool of objects, setting unneeded ones to a 'not present' state, but the language is still limiting what you can do, and not all the problems go away with an object pool. After all, they have to be stored somewhere, which means you're either stuck with a fixed number (if they live in an array), or you need to use a collection (which can be good or bad, depending on other factors).

Java also lacks a union type, but since the uses for these are fewer (and often based around type-punning abuses), it's not one of my gripes. C# lacks them too, but you can achieve an identical effect by using attributes to control struct member alignment.
Quote:
Originally Posted by titaniumdecoy
In addition, I don't understand your complaint about Java's lack of pass-by-reference and lack of pointers. Since all objects are references there is never any reason not to pass-by-value, and all objects are essentially pointers.
Okay, I admit, some of my gripes about Java are regarding stylistic things. Things like operator overloading, property methods, and other 'syntactic sugar' features are nice to have, but there's nothing that demands their inclusion. While C++'s z = a + b + c + d + e + f + g might look a lot cleaner than Java's z = a.add(b.add(c, d), e.add(f, g)), and is probably easier to maintain (because it's easier to read), it's not a huge deal. However, regarding the lack of both pointers and pass-by-reference, my gripe stands.

Objects aren't references, but they are handled through references. Also, the lack of pointers or true pass-by-reference does make certain things (some of them trivial in other languages) impossible or (at the least) very kludgy in Java. Let's use the simple example of swapping two items in an array, which is a common operation in sorting algorithms. In C, it's easily done with pointers:
C Syntax (Toggle Plain Text)
  1. void swap(int *a, int *b)
  2. {
  3. int c = *a;
  4. *a = *b;
  5. *b = c;
  6. }
C++ offers the same possibility, or you can use true references:
C++ Syntax (Toggle Plain Text)
  1. void swap(int &a, int &b)
  2. {
  3. int c = a;
  4. a = b;
  5. b = c;
  6. }
In C#, you can either write 'unsafe' code and use pointers, or again use pass-by-reference:
C# Syntax (Toggle Plain Text)
  1. static void swap(ref int a, ref int b)
  2. {
  3. int c = a;
  4. a = b;
  5. b = c;
  6. }
In each case, the code is very simple and easy to implement. Try writing it in Java. Note that even with objects in Java, where you are passing a reference, you still cannot do a swap in this way, so using the Integer type in Java won't work:
Java Syntax (Toggle Plain Text)
  1. static void swap(Integer a, Integer b)
  2. {
  3. Integer c = a;
  4. a = b;
  5. b = c;
  6. }
All we've done here is swap the references, which are local to the callee. Nothing in the caller's scope is changed, which is exactly what we were trying to do. In effect, it's much like the following C code:
C Syntax (Toggle Plain Text)
  1. void swap(int *a, int *b)
  2. {
  3. int *c = a;
  4. a = b;
  5. b = c;
  6. }
In other words, we've accomplished nothing. If you want to swap things in Java, you need to write the code inline, each and every time you want to do it, and the sole reason for this is that Java does not allow the programmer to express his intent. While I understand the reasoning for not allowing pointers, I feel C#'s approach of only allowing them in code blocks marked as 'unsafe' makes a lot more sense. However, given the decision of Java's designers choosing not to allow pointers at all, they really should have instituted pass-by-reference as an alternate mechanism.

Function pointers are another powerful use of pointers. Imagine a finite state machine object, and you control state changes by assigning a function pointer to a field. Your other option is to have a (potentially huge) switch() statement. In OOP, you could write an alternate solution using subclasses and polymorphism (this reminds me of another gripe: no way to make method calls non-virtual in Java, even if they're not overriding base class methods, but let's not go there), and that's probably just what a Java programmer would do. However, event handling is another excellent use for function pointers. It's pretty hard to beat 'when event X occurs, call function Y' for clarity and efficiency. Of course, the Java developers didn't see it that way, and removed them entirely. The .NET developers, on the other hand, saw more than the potential for misuse, and created delegates (basically safe function pointers).

Arrays are another issue. C, C++, C#, and many other languages allow true multidimensional arrays. This means that the elements for the array are laid out in one contiguous block. In Java, you can't do this. You can only do arrays of arrays, meaning each row is contiguous (at least, I would assume so), but as for whether two rows are adjacent in memory? Who knows. You might think that this is another one of my 'trivial gripes' with Java, but it's not; inability to do this means you have a much harder time writing cache-friendly code. It also means that if you are interoperating with other systems that require buffers in a specific format, it's that much harder to accomplish. Sure, you can work around this issue too, perhaps by using a big one-dimensional array, but that too is a kludge.

Want another legitimate gripe? Okay, where are Java's unsigned types? If I want an integer value that won't fit in 2^31 bits, but will fit in 2^32, I have to use a 64-bit type, which wastes memory. Sure, if it's just one or two, it doesn't matter, but imagine I have an array of a million elements. That's two million bytes wasted, and last I checked, such a frivolous waste of ~2 megabytes was frowned upon, even with today's code bloat. To make matters worse, this type will allow me to express negative values, which might be exactly what I want to avoid doing (think index into an array, file position, etc). Having an unsigned type lets me eliminate a whole class of errors in this situation. Much like having an enum type is good because it helps restrict input to only valid values, having an unsigned type allows me to prevent negative-value errors from ever being a problem.

I could add other gripes, like lack of variable numbers of arguments. This is one of my Pascal gripes too, and being compared to Pascal is not a compliment for any language. Though this particular one can be worked around in part by copious use of operator overloading, I'll stop with the gripe list for now.

Like I said, Java has its place. (Can I get a 'T'? Can I get an 'R'?) There are some very nice things about Java. It's possible to write some impressive applications in Java. I know; I've used some. However, my opinion (and that's all it is, an opinion) is that Java also has plenty of warts. My hope is that the language will evolve (even though Java 'evolves' at a rate comparable to biological evolution ), and include some of these features in the future.
Quote:
Originally Posted by Grich
I want to be able to make applications without worrying about the lower level (pointers, stacks/heaps etc).
That's a perfectly valid attitude. Generally, I don't like to worry too much about the low-level stuff either; it tends to confuse the big picture. I just choose to use a different language to do so.
Quote:
Originally Posted by Grich
On another note, I might be weird, but I know no programmers who code in C++ in the industry (plenty at uni though).
See what I said above about real programmers; this just means you don't know any (titaniumdecoy, I'm kidding).
__________________
My microwave has settings for snake, gremlin, and puppy.
lectricpharaoh is offline  
Old Nov 26th, 2008, 7:28 AM   #8
Grich
Professional Programmer
 
Grich's Avatar
 
Join Date: Sep 2007
Location: Sydney - Australia
Posts: 424
Rep Power: 11 Grich is on a distinguished road
Re: why do people hate java

Quote:
Originally Posted by lectricpharaoh View Post
That's a perfectly valid attitude. Generally, I don't like to worry too much about the low-level stuff either; it tends to confuse the big picture. I just choose to use a different language to do so.
Everyone has a weapon of choice.

Quote:
Originally Posted by lectricpharaoh View Post
Aha, so that's it. Java's the programming language equivalent of your first kiss.
I started with BASIC when I got into programming. I have always been a BASIC bigot ever since. So that's why VB.NET is always number one choice for me in applications development, it's always my comfort zone.
__________________
SYNTAX ERROR ...
Grich is offline  
Old Nov 26th, 2008, 12:38 PM   #9
grumpy
Programming Guru
 
grumpy's Avatar
 
Join Date: Jun 2005
Location: Adelaide, South Australia
Posts: 1,329
Rep Power: 14 grumpy will become famous soon enough
Re: why do people hate java

Having used Java (the language and library), I find it rather painful because it is based on the premise that only one style of programming is the solution to everything, and (in the work I do) I regularly do things that - in the minds of the Java designers - I should not do. Features like the virtual machine and garbage collection are useful when they are needed, but also encourage bad coding practices (eg if you rely on the "system" cleaning things up, your program design tends to be sloppy as you don't check some things you should). The Java library is a bit like a kitchen sink, with variable quality: some parts are great, but others are - frankly - rubbish. Disabling features like multiple inheritance (except of interface), operator loading, etc is alright, except that - if you have a design where such tools make sense - it becomes incredibly difficult to write clean or efficient code.

My main dislike, however, is not of Java. It is Java zealots. Sun's marketing department started the problem by describing Java as the solution of all programming and many people seem to have swallowed that message whole (quite ironic as, in reality, Java was really a commercial vehicle for competing with Microsoft). Then, when I have legitimate goals that are not suited to Java, those people insist that the problem is with my programming goals (as Java is, by definition, "the solution"). If I have a hard realtime requirements (i.e. determinism, which is very difficult to achieve with a virtual machine or in the presence of garbage collection) then it is my requirements that are wrong, not Java.

The reality is that Java, like all programming languages, is suited to some tasks and not to others. If people have tasks that Java is well suited to, then they are welcome to use Java. However those people also need to accept that other people have different tasks, so they may choose to use other languages.

In deciding on a programming language, there are a number of criteria people use;

1) Careful thinking: choose a language that allows a practically useful range of problems to be solved.

2) Habit: where people know a particular language, and insist on using it because that's what they know - even if it isn't suited to the task at hand.

3) Dogma and zealotry: people who insist on the superiority of a particular language. If a programming language cannot meet requirements, then those requirements have to change.

The first is the ideal basis for choosing Java (or any other programming language). It is also very rare. The second is more common, as it's a basic human characteristic to stick with what one knows even if that becomes painful. The problem is that habit can turn into dogma and zealotry (eg insistence that those who do things differently are wrong).

Interestingly enough, a lot of threads like this one (eg "why do people hate XXX?") often turn into staging ground for the zealots.
grumpy is offline  
Old Nov 26th, 2008, 3:16 PM   #10
titaniumdecoy
Programming Guru

 
titaniumdecoy's Avatar
 
Join Date: Nov 2005
Location: California
Posts: 1,535
Rep Power: 14 titaniumdecoy will become famous soon enoughtitaniumdecoy will become famous soon enough
Send a message via AIM to titaniumdecoy
Re: why do people hate java

Quote:
Originally Posted by lectricpharaoh View Post
Quote:
Originally Posted by titaniumdecoy View Post
Java was the first programming language I learned and I am still quite fond of it.
Aha, so that's it. Java's the programming language equivalent of your first kiss.
Leave my personal life out of this!

Quote:
Originally Posted by Grich View Post
On another note, I might be weird, but I know no programmers who code in C++ in the industry (plenty at uni though).
Interesting. Most of the "real" programmers I have talked to are C++ programmers. However, it does seem like newer languages like C#/.NET are beginning to steal some of C++'s thunder.
titaniumdecoy is offline  
Closed Thread

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Programming with Java: Tutorial ReggaetonKing Java 7 May 20th, 2008 11:58 AM
Special browser in Java (Project) stalefish Java 3 Feb 9th, 2008 5:22 PM
People and Social skills of programmers/IT professionals csrocker101 Coder's Corner Lounge 52 Sep 14th, 2007 5:41 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:52 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC