[personal profile] artisanal_xara
Today hasn't exactly been the best day of my life. I had a pretty rough morning. But this afternoon, I started working on my Java assignment, and actually got it 'good enough' in a couple of hours. After I submitted it I decided to make it do neat things. Other than George making me do it the hard way because it's more Java-like that way, it shouldn't have been that much of a problem. However I wanted to use floats instead of doubles. I just started out that way, and after I was into it I didn't want to go change the WHOLE FUCKING PROGRAM to doubles just because Java is a bitch. Big Mistake.

Did you know that there are functions that take a Float, but return a float, and if you don't get them right they don't tell you what's wrong, they just spit back ever more cryptic compiler errors? Additionally, if you have a variable of type Float whose value is 12.0 and you pass it to one of these functions which takes a Float, you will get an error saying incompatible type, because 12.0 is clearly a double, regardless of the fact that it's in a place that requires a Float, and is of type Float. If you try to cast the value to type Float you get a whole series of error messages. Furthermore, you can change ints to floats or Floats, but you can never change a float or a Float into a Double, double, int or Integer.

Additionally, you can't do arithmetic because you have to use Floats everywhere, but 12 is an int,and 12.0 is a double and (Float)12.0 gives back those horrible compiler errors. You pretty much can't cast a Float to a float, no matter what you might try to do. So arithmetic is completely out of the question once you've declared a single Float anywhere in the whole program.

Have I mentioned that I HATE JAVA? Have I? Well, if I've ever neglected it, let me reiterate. I completely, utterly, unfailingly loathe the Java language, and each and every person who has ever contributed to the development or (Unbelievable) continuing popularity of Java.

I thought of a nice analogy this morning (before I had cried any about java today). Programming languages are analogous to english language and grammar. Assembly is taking letters and making words. C/C++ is taking words and writing sentences and paragraphs. Java is taking long, convoluted, confusing paragraphs which are only marginally similar to english grammar, and trying to write an eloquent essay with those unwieldy and impossible tools. (Well, ok, I added some of the adjectives just now, not this morning)

Another analogy. Java is like trying to build a delicate doll house out of gigantic concrete slabs. You might be able to carve into the concrete to do so, but it's going to take more work than building the thing from scratch, and you waste so much in both volume of material and time invested that it's just fool hearty to think it's a good way to do anything.

I don't know how I can possibly persue a programming degree if they're going to make me take data structures in Java.

I think George wants to rescue me before I throw something else. Maybe it's a good idea.

Date: 2002-03-24 09:50 pm (UTC)
From: [identity profile] gorski.livejournal.com
...personally, I'm just Seriously Unhappy that Java has two distinct and functionally very different types named "float" and "Float". HELLO!?

I spent a serious chunk of time buried in a lab last semester either grumbling or swearing at Java for being just obnoxious enough to make my nice little parallel-programming tricks twice as difficult as they needed to be... I'd swear my programs would have worked better in half to two-thirds the development time if I could have just submitted 'em in C.

...I suppose all this doesn't mean much but "I feel your pain". But, oh well.

Having worked on the inside of Java and on the outside of Java, I can say I much preferred hacking away in C at a Java VM to actually having to code in the forsaken language itself...

--me

Date: 2002-03-24 11:53 pm (UTC)
From: [identity profile] cheshire.livejournal.com
I had always thought that Float was designed not really specifically for storage of float values but more for storing float-specific constants (maximum/minimums, etc) and allowing conversions of float values to other values and that, and that instantiation of Float objects was just a side-effect for completeness (IOW, you can do it, but you may not ever really want to). Same with Integer and Double.

For instance, MAX_VALUE, NaN, and NEGATIVE_INFINITY, three float-specific constants, have to be put somewhere, and knowing Java's tendency for putting information under specific classes and out of a more global namespace (although it's been so long that I can't remember what concepts of a namespace Java would even have outside of class namespaces), the appropriate classes would hold static constants indicating these values (that makes sense, at least).

The Float.toString() function has its uses, of course. Try doing that with a primitive.

Date: 2002-03-25 12:02 am (UTC)
From: [identity profile] cheshire.livejournal.com
Of course, this shouldn't mean that I endorse or condone Java's oft eccentric behaviors and quirks. I do not. [livejournal.com profile] gorski knows as well as anybody how I rank C and Java. Just that if you are going to have a float primitive (which can't have methods), and you want to have float conversion functions or constants, you may want to have these under a Float class.

I have many rants about Java. Such as a full-fledged String class with one of the few limitations being that...well...it's an immutable string. Yeah, I'll use that a lot. Or the impossibility of operating overloading. Yeah, that's going to assist me greatly in giving this a natural appearance and ease of use. Or, in order to get a working fgets(3) style function on standard I/O, I have to instantiate two or three different classes and make them perform intercourse on each other just to get a fscking readline. Blah.

Of course, I am an arTEEST, and there are times when I feel a Picasso or Salvador Dali moment coming on. When that happens, I use Java. When I want to stay within the confines of the rational world, I tend to steer towards C.

Date: 2002-03-25 07:32 am (UTC)
From: [identity profile] gorski.livejournal.com
...heh. My original point was TTTO: Having both "float" and "Float" (or "double" and "Double" (ha!), etc) is a bad use of the Eliza effect... Sure, the compiler has no trouble seeing the difference. But I as an English-speaking human being tend to process letter case at a much lower priority than word meaning, and it's entirely too easy for me to substitute one for the other, even just as a typographical error... and then it's much more difficult for me to see what I did when I go back to look at my code.

It's kinda like the similarity of = and == in C... Everybody's made that mistake at least once, I'm sure, and that one's particularly difficult to see[0] since assignment returns the value the lvalue receives as the value of the expression. Matter of fact, if I could make one change to the C language, I would spell = as := .

So here Java comes along and does the same dang thing, only spelling it out longhand for a bunch of class names. Lovely, y'all. Knock it the heck off... next time I want a language that's obscure to read, I'll pick one that's more mathematically interesting, like bf.

ah, well. I guess I had a rant in me that was fighting to get out after all.

peace,

--me

[0] ...Well, most compilers these days spit out a warning when you don't throw away the value of an assignment... and for once, I do agree that that's a feature :)

Date: 2002-03-25 09:29 am (UTC)
From: [identity profile] cheshire.livejournal.com
Now that I think about it, though, I do wonder if perhaps part of the design behind Float, Double, Integer, and so forth was a fleeting attempt at making primitives objects.

The only reason I can see for doing this (and this reason I do actually approve of) is for Java to be able to support C++-style pass-by-reference or C-style pass-by-address semantics. Goodness knows Java doesn't support the implementation of a working swap() function, no matter what you may pass it (primitives pass by value, references pass by value, switch 'em, null 'em, clone 'em, set 'em til you're blue in the face, it won't do one bit of good).

Containing primitives into a mutable class instance would get around this limitation without the programmer having to code containers for primitives on the fly. Just a thought...

Profile

artisanal_xara

January 2018

S M T W T F S
 123456
78910111213
14151617181920
21222324252627
28293031   

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Mar. 12th, 2026 12:22 am
Powered by Dreamwidth Studios