Computer Gurus-- Java Programming Language?

Recently I’ve took it upon myself to learn a programming language. Back in “the day” I knew Commodore BASIC very well, and for a child wrote some impressive programs in it. My interest then waned for some time, until the present when I find myself interested in computer programming all over again.

I decided to learn Java.

Yes, I knew there were plenty of alternatives out there. There was C++, Visual Basic (which was recommended over C by a few programmers for my personal needs), Python, PERL scripting language… the list truly goes on.

But I chose Java. Why? I felt that its strength was in platform independence. It is more than just a web-language for Applets. It is a fully functional OOP language, and its strength indeed comes from platform independence. I don’t need a Mac to write a Java application that will run on a Mac. I don’t need to know the first thing about Linux. And I don’t want to.

But… well, it doesn’t seem to be popular at all, and I was wondering why. I dream of the day when “PC” includes all OS’s because of platform independent programming like Java.

Am I not in the know about something here?

Just the other day I saw a news item that Java developers were expected to outnumber C/C++ developers in a year or two.

Personally, what I liked was that there weren’t any pointers. Things don’t run as fast, though. “Garbage collection” is a really convenient feature, allowing the programmer to avoid having to take care of cleaning up after themselves, but you have to pay at runtime.

What I see as its strength is its devotion to the OOP model. OOP is probably the best tool available for managing huge software projects, and Java was designed from the start as an OOP language. In the future, I think programming below the object level will be like assembly programming is now.

Java is VERY popular, just not with Microsoft developers. Bill Gates made it his personal mission to kill Java. Talk to someone outside of an all-MS development shop, and they’ll probably be working in Java to some degree.

Speaking as a “million liner” coder - Java is just too damn slow to use, IMO. It has only been saved from early oblivion by steadily increasing CPU speed, steadily increasing broadband access, and some optimizations from the binary end. Believe me - if Java ran as slow today as it did 3 years ago when I stopped using it, no one would be using it.

I also question the factoid of there being more Java developers than C/C++ developers in the near future. For one, I’ve seen similar factoids for about 4 years now, and for two, the definition of “Java developer” typically is either vague or else double-counts.

The biggest problem is that Sun wanted to play hardball with MS. MS says “OK”, ad decided, since MS was ordered not to manipulate Java, not to bundle java at all in windows XP. It is a huge challenge to Sun to get around that.

Java not popular? Au contraire! As water2j alluded to, Java developers are theoretically overtaking C/C++ developers. Even if you accept their numbers, however, as Anthracite noted, the word “developers” is a bit hazy. If you can write “Hello, world!” in Java, are you a developer? Or are you only a developer if you are writing consumer applications? The number of people who are familiar with Java is certainly increasing, and will continue to do so, especially with the AP CS curriculum switching to Java. I think this is a poor move, but nobody asked me.

The factual arguments against Java can be found in articles like this one. More importantly though, there is anti-Java sentiment from Microsoft. Furthermore, there tends to be an innate prejudice against non-scripting, non-C derived languages in Linux. Heck, there is a lot of prejudice against C++ in Linux. (Yeah, it’s fading, and important things like KDE are written in it, but I daresay it’s still there.)

Computer language preferences can be as strongly held as religious convictions, and holy wars can be waged just as easily. I dislike Java for two reasons: 1) it is proprietary, owned by Sun, and 2) it is slower than C/C++. I vastly prefer a non-proprietary language like C, with standardization done by national and international standardization organizations (ANSI, ISO). As for speed, I do most of my coding in C, and with Java there tends to be a noticeable slowdown. Despite the fact that there is an ever-increasing amount of “Java developers,” you don’t really see a lot of Java applications, precisely because it tends to be slower. Yeah, some people say that with increasing hardware power this won’t matter – well, for some things it still does matter, and for everything speed is nice, especially to a perfectionist like me. I am not afraid to drop down into assembly to do some optimizations for a particularly critical function. Furthermore, Java tends to end up much more bloated than C. Code bloat is evil.

The fact that it is object oriented is great, but object orientation is not all about classes, inheritance, polymorphism, etc. A lot of it is about programming structure and thinking. You can take many of the good concepts and apply them to C or another language. Furthermore, the whole “object oriented paradigm” (buzzword alert!) is not the be all and end all of computer programming, though it probably is more than just the latest fad. It’s not the only way to go about solving a problem, however, and is not even the best solution in many cases.

A poster on this board once wrote that “Java will be the Pascal of this decade” (sorry, can’t remember who). I agree. It has fundamental weaknesses as described by the Salon article I linked to above, it faces prejudice from Microsoft, Linux folks tend not to like it, and most geeks are reluctant to change languages once they have found one that works for them.

First, tell us about what sort of things you’ll be programming. The language I would recommend is pretty dependent on the context in which it will be used. Java is very good on the server side, but still poor on the client side when GUIs are involved. Java is also very good for network programming. Some types of applications will demand performance that Java just can’t deliver; some types of applications won’t require something as powerful as Java at all.

Anthracite, JIT compilers and Java virtual machines have improved a hell of a lot in the last three years. It’s probably worth another look.

Regarding the continuing war between Sun and MS, a sun executive admitted in an interview that the absence of a Java virtual machine from Windows XP will be beneficial, in a way, since it’ll force a lot of people to download a current JVM. There’ll be fewer of them out there, but Java will have a better platform where it exists.

I obviously meant waterj2. Since I don’t like it when people misspell my name (I tend to think it indicates some carelessness/disregarding of the person’s point of view – if you can’t remember someone’s name, did you remember what he said?), I felt compelled to correct myself and apologize. 'Twas a typo.

To be fair, SDP, Garfinkel retracted some of his statements in a followup article here, admitting that Java has some strengths on the server side. He still made some arguments against it, but it puts his comments into the realm of “well, those are my preferences, and others don’t agree.”

I think the problem you are facing is that there isn’t one language for every programming problem.

Java is good for some things, but in order for it to run on all platforms, it has to only use the lowest common denomintor of all of those platforms. Lowest common denominator laguages & toolkits are often lame.

Sometimes you want to take advantage of specific hardware, video, audio or other devices.

You ought to use the appropriate language for what you are doing. Once you know one or 2, the rest are simple, the concepts aren’t that different.

I typically write lower level code using C++, ATL based COM objects. Specifically, i write a component using Microsoft’s ATL toolkit, making sure all my exposed interfaces are COM so that i can use the objects from other languages.

I write most of my UI often w/ HTML & VBScript, although VB, C#, & Java work too - that is the beauty of COM interfaces.

I mix and match languages as i need, and the tookit evolves over time. It wasn’t tool long ago that my code consisted of FORTRAN, C & C++, ASM . Now it is mostly C++/HTML/VBScript/JScript, I imagine in the future that will change and include C# and something i haven’t heard about.

Then again i’m a developer often working on research questions and developing prototype & proof of concept code.

Thanks for pointing me to that article. I was not trying to be disingenuous by not mentioning it; I simply had never read it. (I read the original from a slashdot link, I think.) I still basically agree with him, and I think his position remains relatively unchanged.

However, I will acknowledge, as he did, that Java may have some server-side strengths. I just don’t know enough about that type of programming to make any informed statements about it. My distinct impression is that erislover is not developing server-side apps, however, and so those advantages will be rather moot for him.

Actually, I would love to write some server-side applications for interactive games on the net, as right now I’m not exactly sure I’m going to handle the communication problem. I have NO experience with communication protocals and really don’t even know where to look.

Problem is, I don’t think my hosting service supports server-side Java applications.

About Java being proprietary, I’m not sure I undertstand why that matters. After all, Microsoft has its own special class library, as does Borland C++, and so on. In the end, the programmer makes his own package of classes and so on, so the proprietariness of any language seems a little moot to me. I admit that my experience doesn’t give me a lot to go on argument-wise, however.

What seems most important to me is that Java, as a language, is “universal.” With C++ one needs to make use of each OS’s special requirements on the programmer side. In the general case, Sun takes care of that with the machine-specific Java interpreter, leaving the programmer to just write the program.

The risk of writing in a propietary language is that it’s more of a moving target than a language like C or C++ that’s subjected to ANSI standardization. Major changes can be made without input from developers, and there’s no procedural guarantee that the language won’t change suddenly, breaking a lot of existing code. However, that’s not likely with any language meant for general popular acceptance, since a language only lives as long as there’s a developer community for that language, and making sudden changes that break code is a sure-fire way to alienate them.

Also, Java is not as proprietary a language as some like to suggest. Sun released the language under a comunity development licence, which ensures at least a certain amount of input from Java developers and continuity between spec revisions.

True, but this slows things down.

Also, not many people develop software on different machines than they expect to run it, except if they plan it for release in several different versions. In the case of large applications intended to be released commercially, even Java will probably need some tweaking and testing between different versions.

As I said, I see it’s real strength being its use of the OOP paradigm from the ground up. It’s almost a different layer of abstraction from C programming. This is why they are starting to use Java as a teaching language, since OOP is likely to be the wave of the future.

For Java to succeed at this, it will probably have to offer the programmer ways of optimizing the code that are platform dependant. Only then will Java be able to match the speed and flexibility of C/C++. Either that, or some major advances in compilers would have to be made, allowing the compiler to do optimization that the programmer would normally have to do.

Sorry, I shouldn’t have jumped to conclusions.

The answer is twofold. Firstly, in a theoretical, ideological sense, it is better not to be beholden to some company and to have to rely on their benevolence.

There is a more practical reason, however. Any C code written after the language was standardized that complies with the standards (most compilers will let you force your code to be standards compliant: the -ansi flag in gcc, for example) will compile on any other platform that has a standards-compliant compiler. Period. End of story. Code from 20 years ago will compile. That code will almost undoubtedly always compile – you can count on the standards committee not breaking backwards compatibility. Can you do the same with Sun? Will code you write today compile 20 years from now? Well…maybe. If they broke their old code, it would probably just alienate people. On the other hand, certain companies that garner monopolistic powers have been known to do exactly that. They can use it as a wedge to force you to upgrade to their latest whatever. It’s just not good – as a developer, you don’t want to have to rely on this kind of thing. It’s unfortunate that they dropped their plan to standardize with the ISO.

Also, about Microsoft’s special class library – it is not part of C++ proper. If you use it, you are risking having it changed on you, and having your code no longer work. It’s not part of the standard, and it never will be. I only take issue with proprietary standards, however, and they are certainly free to do whatever they want.

Here is an old article that sort of alludes to the dangers that can arise from proprietary control. I quote briefly:

Now Java has obviously survived and thrived since 1998, when this article was written, but that lurking potential is always there.

Perhaps you are unfamiliar with the standard libraries for C and C++, and C++'s standard classes? They don’t hold your hand in GUI creation or with network functions, but other than that, they basically “make use of each OS’s special requirements on the programmer side.”

[Moderator Hat: ON]

This is not a Great Debate. I think it fits best in IMHO, though it probably could have been a GQ when originally posted. Off to IMHO it goes.


David B, SDMB Great Debates Moderator

[Moderator Hat: OFF]

I’m skeptical that Java ever needs to be as fast as C/C++, with the increasing power of even lower end computers.

That sounds like an excuse to a lot of C/C++ programmers for Java programmers to ignore the lower levels of coding, as if they’re letting the computer take up the slack. But remember, at one time, high level languages like C and C++ were viewed as inferior to hand-coded assembly for the same reason. Earlier than that, assemblers were viewed as a wasteful use of computer power.

The trend since computers were first invented has been for computing power to get cheaper and more freely available, while programmer time has gotten more expensive. I see no reason for that to change. Given that, it’s reasonable to view the productivity gains of Java as a worthwhile tradeoff for performance that becomes increasingly irrelevant as hardware advances. There’ll always be a place for hand-coded assembly, but for an increasing amount of what programming is for, it’s just not important.

Call me old-fashioned, but I happen to think that every decrease in speed is a bad thing, and should be avoided whenever it would be reasonable to do so.

Obviously, hand-coding assembly commands is totally impractical (and very badly non-portable). Therefore, we must use a high-level language. Different languages specialize in different enivronments, and Java certainly does have its place.

I also like the fact that it was designed as an OO language. Now if they’d only add in support for true multiple inheritance, pointers, and templates…:wink:

However, as has been mentioned before, the latest and greatest language is no substitute for good progamming. That’s what it really comes down to, regardless of the language.

I have this picture of you sitting in a rocking chair on a porch, waving your cane at the youngsters in the street, yelling “in my day, we used malloc()!”

Do interfaces in Java not provide the same functionality as multiple inheritance?

Ha ha…nah, not quite that old. :slight_smile: Somewhere I still have notes telling me how to improve upon the standard C++ dynamic memory operators, though.

IIRC, they don’t provide the full functionality that multiple inheritance does. There’s a paragraph or so about it here, and a bit more here (this is a pretty good treatment of multiple inheritance in general).

The reasons for not fully supporting multiple inheritance are good ones: it’s tough to use correctly, and there are very few cases where you really need it. I just don’t think that’s a good enough justification for taking it away.