Twenty-First Century Javaman

Re: Re: Twenty-First Century Javaman

American said:
I found it easier to learn javascript first. Many would say I have this backwards, but it depends on what you already know of programming.
Well yes, you would. One's a simple scripting language for the web and the like, the other's a complex object-oriented programming language for standalone applications, web objects, and standalone devices. The two are not related in any way other than starting with the same 4 letters.

Cheers,
Rat.
 
Re: Re: Re: Twenty-First Century Javaman

Rat said:
The two are not related in any way other than starting with the same 4 letters.

No, they are identical in every way, shape, and form.


And I already knew C a long time ago. That helped.
 
Well, I guess I'm a Java guy now. It's grotesquely verbose, syntactically brain-damaged a la C, and not particularly speedy. There are inconsistencies you can only understand if you know the guts. There are enough layers to confuse even people who grew up in the over-layered computing world of the late 20th Century. I'm sick of casting an int to an Integer just to get it into some obscure method. GUI events are almost impossible to understand.

That said, I'm managing to write some good code that exhibits a rather nice user interface.

Here is what I am doing:

http://www.lecb.ncifcrf.gov/~toms/paper/ev/

(Note that C++ should have been ++C.)

~~ Paul
 
Paul C. Anagnostopoulos said:
I'm sick of casting an int to an Integer just to get it into some obscure method.
Java 5 autoboxing will cheer you up, then.


(Note that C++ should have been ++C.)

~~ Paul

Not at all, since most people still write C and just compile it with the C++ compiler. Increment the value, but use the old one, right?

Just kidding.

--Terry.
 
Terry said:
Java 5 autoboxing will cheer you up, then.
I'm using Java 5. It unboxes automatically, but doesn't box automatically. I still have to write ((Integer)x) all over the damn place.

Not at all, since most people still write C and just compile it with the C++ compiler. Increment the value, but use the old one, right?
Good point. That's what I would do if I had to use C++.

~~ Paul
 
Paul C. Anagnostopoulos said:
I'm using Java 5. It unboxes automatically, but doesn't box automatically. I still have to write ((Integer)x) all over the damn place.
Really? The autoboxing should work almost everywhere: arguments, return values, boolean expression, collections, number operations and assignments. Does with my Java 5, anyway.
 
The autoboxing works in some circumstances, but not in others. For example, I cannot say i.toString(), where i is an int. I'm forced to say ((Integer)i).toString(). I guess the designers figure that's too error-prone.

I shouldn't have said it doesn't box at all.

~~ Paul
 
Paul C. Anagnostopoulos said:
The autoboxing works in some circumstances, but not in others. For example, I cannot say i.toString(), where i is an int. I'm forced to say ((Integer)i).toString(). I guess the designers figure that's too error-prone.

I shouldn't have said it doesn't box at all.

~~ Paul
Enter the pedantic arse: Any primitive (like int, double, etc) is cast to a String wherever they are used in conjunction with a String, so you should never need i.toString() for int i. :p

For any other situation, though....
 
Paul C. Anagnostopoulos said:
The autoboxing works in some circumstances, but not in others. For example, I cannot say i.toString(), where i is an int. I'm forced to say ((Integer)i).toString(). I guess the designers figure that's too error-prone.

I shouldn't have said it doesn't box at all.

~~ Paul

Well, keep in mind type int is different from Integer. Integer is a class, not just a data type. When you invoke it like you are above, you're basically casting i into an abstract class of type Integer. and calling one of its member functions. (BTW, you can also do Integer.toString(i).)

The Integer class (and other similar classes like Float) is a relatively new addition to Java; imo, it's a good idea, but only insofar as we can start trying to eliminate int and other relics.
 
Cleon said:
The Integer class (and other similar classes like Float) is a relatively new addition to Java; imo, it's a good idea, but only insofar as we can start trying to eliminate int and other relics.


um, actually they are not a relatively new addition. They were there since the beginning.

you can get the JDK1.1 api from this page and check yourself:
http://java.sun.com/products/archive/index.html

And the point was never to eliminate int from being used. As a primitive, computers can handle ints faster than Integers. It may be true that with advances made in the virtual machine that the peformance difference is now small, but I belive there still is one.

I started my professional programming career using Smalltalk. It is an object oriented language where everything is an object. I mean it... EVERYTHING. (There are no primitives like int and float.) And it is slow. Java used a lot of ideas from Smalltalk, but it isn't as strict about keeping everything as objects, because the developers wanted programs to run on lower end computers too. (Also I don't think there was a JIT in Smalltalk either.)
 
The Java designers wanted primitive types not to be objects, for reasons of speed. Fine. But it would have been nice if they had made them behave like objects anyway, to avoid all this boxing and unboxing nonsense.

Most implementations of Common Lisp, for example, can encode small integers, characters, booleans, and null in the same number of bits as a reference, using a tag field.

~~ Paul
 
elevatedsteve said:
um, actually they are not a relatively new addition. They were there since the beginning.

you can get the JDK1.1 api from this page and check yourself:
http://java.sun.com/products/archive/index.html


Quite right--my bad. I got my start doing applet development, using the primitives, and wasn't even aware of the more complex classes until I started doing J2EE development a few years ago.
 

ISF - Join now!

Every member here is approved by hand. No bots, no spam, just people who care about evidence and honest debate.

Membership is free!

Create your free account

Back
Top Bottom