Java superior to C/C++, but beware pitfalls, expert warns

Java offers developers more power and flexibility than either C or C++, but those advantages are tempered by some notable shortcomings, according to one expert.

Greg Kiessling, chairman and co-founder of KL Group Inc., a Toronto-based Java software development firm and consulting group, said inherent problems are often lost in the hype surrounding the relatively young language.

But that hasn’t stopped Java from generating excitement in the application development community – nor should it, he added.

“People are finding Java is twice as productive in coding compared to C,” Kiessling said. “And Java is the first language designed from the ground up to be truly object-oriented.”

Kiessling made the comments at the 7 th Annual Java & Object Technology Forum held earlier this month in Toronto, an event partly sponsored by ComputerWorld Canada.

To further his argument, he quoted statistics from Stamford, Conn.-based research firm Gartner Group Inc. which predicts that by 2004, 60 per cent of all business application logic will be written in Java, Java servlets, Java Beans or Enterprise Java Beans.

To help those new to Java, or who are still working out the wrinkles, Kiessling then listed the “top 10 challenges” facing the language.

1. Performance: To boost Java’s sometimes shaky performance, users should avoid unnecessary synchronization, string concentration, unbuffered I/O and slow library methods. “And profile early and often,” Kiessling stressed.

2. Object Explosion: “Guess what? Object creation is very slow in Java,” Kiessling said. To help manage objects, he recommends users create pools of objects at one time. Also, create objects only as they’re needed. Finally, use primitives as opposed to your own customized style where possible.

3. The 22 nd Day Problem: Kiessling held up a copy of the book Teach Yourself Java 1.2 in 21 Days as an example of another problem with Java; although it’s become popular among young developers, the industry still suffers from a lack of talented Java programmers.

“You really should use experienced, skilled programmers,” Kiessling said. You’re much better off taking experienced SmallTalk developers…and spending 21 days teaching them Java than you are taking someone who already knows Java, but isn’t [experienced].”

Even teaming seasoned developers with those new to Java will help speed along the learning process, Kiessling added.

4. Deadlock & Concurrency: “In all large complex applications, it’s impossible to predict deadlock problems,” Kiessling said, so he advises Java developers use threads judiciously. Also, understanding the code and the risks associated with it will fix problems before they begin, he added.

5. Memory Leaks: One of the benefits of Java versus C is that it doesn’t require users to allocate memory before they use it. But that doesn’t mean there aren’t memory problems associated with Java, Kiessling said. In the case of Java, they come from so-called “memory leaks” which occur when code comes with objects that aren’t in use anymore.

“I can tell you with our own Java products, we’ve had problems uncovering the memory leaks…so be careful, and avoid loitering objects.” He recommends that users de-reference objects when finished with them, and to profile regularly.

6. Black Box Problem: This problem pops up when programmers try using objects that they didn’t write, and thus do not full understand. Such objects are widely termed “black boxes.” Though chances are the objects will perform the way the author intended, there’s a small chance that they won’t. Kiessling again recommends regular profiling as the best means to overcome this problem.

7. Fat Client: Some developers tend to overload the client, Kiessling said. Instead, architect for the N-tier, and use servlets or Enterprise Java Beans where possible.

8. Browser Limitations: “This is a big reality check for lots of developers,” Kiessling noted, as developers trying to run applets have to work around various browser limitations. Never assume “write once, run anywhere” in the browser environment, Kiessling said. And use the Java2 plug-in where possible or target Java Development Kit (JDK) 1.1 browsers.

9. Rich Java UI: Kiessling recommends that programmers stick to Swing and JavaBeans, Kiessling said, as they build much better user interfaces, and boast clipboard support, drag-and-drop functionality and localization.

10. J2EE Early Adoption: Referring to the recently released Java2 Enterprise Edition, Kiessling said only those brave enough to be pioneers should be considering it, and even then, they shouldn’t expect “awesome” performance, at least not for awhile. Instead, he advises organizations keep it in mind, but to carefully study its pros and cons.

Would you recommend this article?


Thanks for taking the time to let us know what you think of this article!
We'd love to hear your opinion about this or any other story you read in our publication.

Jim Love, Chief Content Officer, IT World Canada

Featured Download

Previous article
Next article

Featured Articles

Stemming the tide of cybercrime

By: Derek Manky Technology continues to play a significant role in accelerating...

Power through a work-from-anywhere lifestyle with the LG gram

“The right tool for the right job” is an old adage...

Related Tech News

Tech Jobs

Our experienced team of journalists and bloggers bring you engaging in-depth interviews, videos and content targeted to IT professionals and line-of-business executives.

Tech Companies Hiring Right Now