Please create an account to participate in the Slashdot moderation system

 



Forgot your password?
typodupeerror
×
User Journal

Journal Chacham's Journal: Rant: Why i hate Java (simple, old debate) 4

Why do i hate Java? (And C too.) retardedNames, case sensitivity, offsets treated like indexes. These are examples of where programmers had good ideas but then unfortunately designed them into a language.

0 is not a number. A number represents a quantity and 0 is not a quantity. You don't declare an array less one because 0 is a number. However, it is treated as a number for convenience. Why then refer to an index in an array with 0 first? Okay, okay, i know. It's because the variable is just a pointer, and the index is really an offset. So then why use an offset to index an array? Seriously. In how many cases do you treat the offset as an index. And in how many do you treat it like an offset? I thought so.

Then there's the whole = vs ==. Debate over whether = should set or compare is understandable. Personally, i would never have used = to set, because most people use it to demonstrate equality. Not to test it, but to demonstrate it. As in any math equation we teach children. With that in mind, i would think it was more likely to be used to test equality rather than set it. Furthermore, pick the odd operator out: =, +=, -=, *=, /=. ^=. Yeah, yeah, those are for convenience. But how many times have you mistaken the double-character operator for anything else. Yes, but they have another operator that makes it obvious. Exactly. Isn't == obviously setting without an operation. x += y adds y to x then sets. x -= y subtracts y from x then sets. So, x == y should equal y to x then set. Slightly bumpy because it sets x to y and not vice versa, but its really easy to understand. And, earlier languages did it with :=. Same thing.

BASIC used = for both. Noone used LET outside of teaching. Regardless, context defined it anyway. Context is not available in Java because it allows you do do nifty things like increment an array offset while setting it. So, no context. Of course, this leads to bugs and the niftiness is often considered bad practice, but isn't it cool that we can do it?

I've seen absolute morons coding in BASIC. But never once had i seen them use = to do what they didn't intend. You know why? Because its impossible! Context rules. On the same note, i've read about talented programmers who made the mistake in C(++).

Prefix and postfix ++ and -- are a little different. They are not obvious (until you know what they do), and other than errors in logic, they are used as intended. They break context, per se, but that is what they are designed to do. Applying this to the poor = sign is just plain ridiculous.

Seriously, why are these things done when they are counterintuitive, prone to bugs, and bad practice? Were the designers brain dead, or just 31337 h4x0rz that hadn't grown up yet? Or, is everyone so blind to this because they never made this mistake.

Okay, the languages weren't designed inasmuch as they just ended up being used. But why? Was it because the pros outweighed the cons? Or was it because programmers actually like this nonsense?

This discussion has been archived. No new comments can be posted.

Rant: Why i hate Java (simple, old debate)

Comments Filter:
  • It's a systems language... I bet a lot of the weird decisions are that way just because that's closer to how things work on a lower level. Convenience isn't a bad excuse for poor design decisions. A lot of the other stuff is just syntax, which is annoying, but if that's the way it is then whatever. Find another language with a grammar you like. Yeah, it's too bad java-like languages are sorta pervasive now, but there are enough ways around that.

    Had a co-worker who had worked for SUN. Java emerged beca

    • by Chacham ( 981 )

      Well, i want to do something on Android, so Java is the way. :(

      Yes, Java is still ugly, but at least it's consistently ugly.

      rwa2++;

  • First: 0 is a number, it represents a quantity of none. It might be time for you to go back to before the ancient greeks decided this. However, I do agree if an array has a value it should have a length of 1, not 0.

    Second: == vs =, go add up your grocery bill, you might notice at the end you write "total = $x" or "total: $x" (this would have been an appropriate solution, but c was created for people with a math background by K&R, c++ is the following increment, and java was based off of c++). So sinc
  • C was invented on a PDP-6, IIRC, and most of the language constructs mimic PDP-6 assembly. Including Increment and Decrement.

Arithmetic is being able to count up to twenty without taking off your shoes. -- Mickey Mouse

Working...