C++ to Java: A Lifestlye Change
I have learned in the past couple weeks that I will become a Java developer. I have always had a disliking towards Java for various reasons. Since attempting to learn it though in a corporate environment I have found that it does have an awful lot to offer the business world. With that said there are a few features it lacks that I feel should really be a mainstay of any major programming language.
The biggest advantage I have found with Java is probably how easily it is ported across systems. In previous internships I worked with Visual C++ and the idea of it working on a possible Mac client were pretty much out of the question. Moving to Java though allows developers to focus less on cross compatibility and more on the true function and desired outcome of the program. While it is more flexible in cross compatibility it is also more flexible when looking at things such as internationalization. C/C++ were made ages ago and there wasn’t really much of a character encoding standard at the time. ASCII was really just about it and that really didn’t give companies any advantage when it came to foreign markets. Libraries and workarounds exist for this in C/C++ I know but since Java was made much more recently these standards are inbred into the language a little more making it a lot more accessible and easier to use. I also like the ease the transition from C/C++ to Java has been.
I have heard for some time now that people who have a background in C/C++ don’t have much of a problem transitioning to Java. I always though that this may have been people just trying to lure me over to the ‘dark side’. For the most part it has really been true, the syntax is almost identical, it is some of the logic that is throwing me off more than anything else. Even though it is causing me some trouble I must say that I am not coming at it from the other direction like a couple of my coworkers are. People who originally knew Java and are trying to move into the C++ realm are seeming to have a much harder time transitioning. A lot of it is stuff that I would consider trivial for the most part. When I stop and look at the differences in the two languages though it isn’t too shocking that someone who only knows Java is completely lost in a language like C++. The idea or using pointers or passing arguments as references is completely lost on some of these people. There have been several situations where someone has passed a class into a function, tries to change something, and it comes out completely untouched. I ask if they are passing by reference and they don’t even know what I am talking about. Something else surprising is some of the inheritance structures that these people are creating in C++. I guess I have taken for granted that C++ has multiple inheritance, something that Java ironically doesn’t have, I’ll get to that later. Some people have created classes that inherit through this giant tree of extends. This wouldn’t necessarily be bad but when you try to force something like this some of the relationships can become sketch at best.
Not having multiple inheritance may not seem like such a big deal but when you break down the foundations on which Java was built it truly seems to make pretty much no sense to me. It truly is ironic that a language built so heavily on the idea of OOP has no way to inherit multiple objects. While this may not be the death of the language it truly is something that I would expect from such a widely accepted and powerful language. Something else I find that Java is missing is a wide variety of primitive types. While Java has the basics: int, float, double, byte, char, boolean, and long, it doesn’t really have a way to expand on any of this. Java has eliminated SOME of this by creating the BigInteger() and BigDouble(). I don’t really find this to be a solution to my problem though because I am still awfully restricted. Initially looking at this list it may not seem too restricting, wait, there is more. Combining types or modifying types does not exist, that is to say I can’t made a long long, a long double, or anything of the sort. The one that really got me today was that there is no way to make a number unsigned inside of Java. This seems like a major oversight for any language that wants to gain any sort of major use and respectability. Sure I will probably not have a use for a number that goes all the way to 18,446,744,073,709,551,615 anytime soon but it still does take a huge chunk out of possible markets.
Despite the gripes about Java it truly is a pretty strong language. While its range of uses may not be as far reaching as some of the older lower level languages it really does pick up the slack in the ability to get something together and ship it out quickly among varying platforms. While efficiency may be lost there is a definite profit gain accomplished by using a language like Java over some of the other big names out there.