Java references

WARNING: This just a little rant about the Java programming language so if you don’t know what the hell that is or care I suggest skipping this article.

A few hours and a lot of caffeine later I have finished my first incursion into programming in Java with out some one standing over my shoulder smacking me up the head for doing something stupid. Need less to say it was an interesting experience, now I’ve been coding in C# for the better part of a 2 years now and was told that this transition should be easy and it was sort of. The sort of part is basically why I’m going on about this little rant, in writing my little application I wanted to reference a primitive type basically things like integers, booleans, ect, in a function except as far as I can tell Java won’t let me do that, it only passes objects by reference and even then it doesn’t really do that; it passes a pointer to the object. First of all this is a big difference that no one bothered to inform me of and I thought that the guys who did Java were all object oriented nuts that made everything an object, apparently not in this case. After looking around for information on why this is the case I found a somewhat weak argument about how it makes the language too complicated or something. First of all what’s so hard about the concept of the value stays changed? Fundamentally higher-level programming languages are basically tools that help make the development process easier, so that they can simplify basic functionality so you can create more sophisticated applications. Okay just for the sake of argument let’s say it complicates things too much, I personally don’t see it that way but I’ve said my piece, how does this help in development? From my point of view it doesn’t.

So far I’ve found that the only real work around for this is to either encapsulate your data in a custom class or design the method call to return a state; this only works if you only need one referenced value otherwise encapsulation seems to be the only way to go. Now don’t get me wrong I don’t hate the Java language, I’m just frustrated with it, if someone can give me a good explanation of why I would gladly shut up, but until then I’ll be smashing my head on my keyboard the next time I want a simple little reference.

~ by cyphrex on October 27, 2005.

One Response to “Java references”

  1. I don’t know if this is what you need, but have you looked at the java.lang.Number subclasses? These encapsulate primitives like int, double, etc. in classes like Integer, Double, etc…

    Hope this helps. 🙂

Leave a comment

 
Design a site like this with WordPress.com
Get started