| By James Turner | Article Rating: |
|
| March 30, 2004 12:00 AM EST | Reads: |
37,045 |
First off, a caveat. I'm not some wet-behind-the-ears newbie who longs for Visual Basic. I've been coding in Java for over 5 years and have written 2 books on JSP development (MySQL & JSP Web Applications and Struts Kick Start, both from SAMS, run out and buy them right now). I'm a committer on the Jakarta Struts project. So I think I can claim I know my way around a polymorphism or two.
So when I say that Java developers seem to be in love with unneeded and confusing layers of complexity, I'm not say it from a position of ignorance. I'm saying it because I find myself frequently finding the Java way of doing something about 10 times as difficult as in other languages.
For example, I recently needed to automate encrypting and transmitting some files via FTP. Since I was already generating the plaintext file in Java, I figured it would be easy enough to tack on PGP and then send it. In fact, I already knew how to send it because I had other Java programs that did FTP. So all I needed to do was find a native Java PGP implementation, and sure enough, the Bouncy Castle folks had a native Java implementation free for the downloading.
Immediately, I ran into the thing I hate most about Java developers. They (as a group) are in love with how clever they can be. The Bouncy Castle code was a morass of Factories, multiple different classes that needed to be configured in order to make everything work right, and even at that I couldn't get it to work after a day of messing around. The mantra in Java seems to be to never hardwire anything, so that in the hypothetical "someday", you can rip out class X and put in class Y by just adding a Factory. The end result however, is code that's confusing to use, hard to maintain, and never seems to be very well documented.
In desperation, I turned to option 2, doing it in Perl. What a difference! One CPAN install got me the entire suite of packages I needed to make the Crypto::OpenPGP package work (and BOY could the Java community take a lesson from the success and good design of CPAN) The package was straightforward to use, maybe not the most elegant, infinitely extensable design possible, but easy to get up and working in 10 minutes.
I moderated a panel at COMDEX last fall where Rasmus Lerdorf (Mr. PHP) and a Perl proponent ganged up on the person representing Java, complaining about how slow it was and hard to develop in. I tried my best to help defend Java, but it was hard. The trouble is, I see their point.
Java is a great language. But for some reason, the Java community has decided to take it and make all the ancillary packages as complex and difficult to use as possible. It's like a racehorse that's had a wet bar and a hot tub mounted on it. The Perl folks have the right idea. Make supporting technologies that are simple to use, rather than so elegant that they become incomprehensible.
Imagine if the Perl cafe and Javahut were across the street from each other. You walk into Javahut, and ask to sit down. "I'm sorry," says the person at the door. I'm not actually the hostess, I'm a Factory class that can give you a hostess if you tell me what type of seat you want." You say you want a non-smoking seat, and the person calls over a NonSmokingSeatHostess. The hostess takes you to your seat, and asks if you'll want breakfast, lunch, or dinner. You say lunch, and she beckons a LunchWaitress. The LunchWaitress takes your order, brings over your food, but there's no plates to put it on because you forgot to get a CutleryFactory and invoke getPlates, so the Waitress throws a null pointer exception and you get thrown out of the place.
Dusting yourself off, you walk across the street to the Perl cafe. The person at the door asks what kind of seat you want, what you want to eat, and how you want to pay. They sit you at your seat, bring over your food, collect the money, and leave you to eat in peace. Sure, it's not the most elegant dining experience you ever had, but you got your food with a minimum of pain.
The long and the short of it is that, in my opinion, Java is a great language being destroyed by Rampaging Computer Science. There's a time for elegance, and a time for usability. If developers want to make the internals of packages flexible and extensible, that's all well and good. But the external interfaces should be clean, simple to use, and have wrappers for the most commonly accessed functionality. For example, in a PGP package, I should be able to encrypt or decrypt a file in 5 lines of code or less. After all, I can do it in Perl in 3.
Published March 30, 2004 Reads 37,045
Copyright © 2004 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By James Turner
James Turner is president of Black Bear Software. James was formerly senior editor of Linux.SYS-CON.com and has also written for Wired, Christian Science Monitor, and other publications. He is currently working on his third book on open source development.
![]() |
James Turner 03/29/04 02:10:22 PM EST | |||
Troll? Ok Loke, you come over to my house and make PGP work inside Java. Saying that Java isn't a scripting language is just an excuse to ignore things that Java is bad at. If I have a piece of Java code that is producing a fairly complicated report (that requires the full power of Java), and then have to wrap it all in a Perl script because Java can't handle actually delivering it to the end consumer, I'd say it's Java that's showing a lack of flexibility. I *could* have written the whole thing in Perl, but chose to use the OO functionality of Java to make my report generation cleaner. The fact that I *couldn't* do everything in Java, because the "Java Way" was so complex as to be unusable, speaks more to the problems of Java developers than me not knowing what tools to use for what. James |
||||
![]() |
Phillup 03/29/04 12:50:19 PM EST | |||
Over twenty years I've programmed with at least as many languages. So, I won't claim to know any language intimately. But... I have programed in Perl for the last five years. Why is simple. Because Perl let's me leverage the last 20 years of programming. If they see a good idea in another language... they put it in Perl. You will see a lot of people complain because of how Perl code looks. The simple fact is that you can write clean looking code... or ugly code. Perl doesn't care. It is your code... do it the way you want. Perl's strength is that it let's a programmer program the way they want to. That is also it's weakness. My advice would be to spend a few more years with a few other languages. You won't appreciate Perl until you know how elegantly it lets you solve some problems that you have used other tools for. If you are looking for "structure" and don't have the discipline to enforce it yourself... then stay away from Perl. |
||||
![]() |
xzzy 03/29/04 12:48:28 PM EST | |||
Wvery time I sit down and promise myself to write a new script all tidy and clean in python, about five minutes into it I'm muttering "if this were perl I coulda been DONE by now" and quickly revert back to old faithful. |
||||
![]() |
Billy_Gates 03/29/04 12:47:43 PM EST | |||
I prefer python over perl. The resulting code is soo much cleaner. I suppose it has to do with the old debate of losely or strict typed langauges. Perl is highly modular but I would hate to work in a team of 10 or more perl developers all writing in their own styles and methods. Shudder |
||||
![]() |
Loke 03/29/04 11:50:09 AM EST | |||
The article smells a lot of troll - he starts out with an apples and oranges comparison, and then spends the entire article arguing the wrong thing. No one ever said that Java was simpler than Perl. Quite the opposite. The one thing that Perl has going for it is the fact that it's very simple to do simple things. I think everybody who knows both Java and Perl are very well aware of this. Here's some news for James Turner: Java is not a scripting language. In the real world (sorry, Struts doesn't impress me one bit) we want flexibility. In order to have flexibility you need to have flexible libraries. Encryption is very important, and since Java is not a sinple scripting language one needs a lot more flexibility. More flexibility means more stuff to set up. 9 out of 10 Java libraries are very easy to use, but also very confugrable. Usually there is a DefaultXyz class that can be used to get off the ground in a single line of code. I'm sure he could use the FTP client library that was mentioned in the article with just a single line of code. I wonder exactly why he could only come up with a single example of a hard-to-use library? Maybe because all the others were very easy? |
||||
- Kindle 2 vs Nook
- Is Cloud Computing Like Teenage Sex?
- GovIT Expo Highlights Cloud Computing
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Cloud Computing Can Revitalize Your Career as Software Developer
- Ubuntu-based Open Source Linux Mint Tests KDE Version
- Yahoo! SVP Shelton Shugar to Discuss Innovation at Cloud Computing Expo
- Virtualization Journal "Readers' Choice Awards" Voting Is Now Open
- Einstein, Sharks and Clouds: IT Security in the Cloud
- Adobe Flex Developer Earns $100K in New York City
- Virtualization Expo Call for Papers Deadline December 15
- Amazon Web Services Database in the Cloud
- Kindle 2 vs Nook
- Cloud CEOs, CTOs & SVPs to Speak at 4th International Cloud Computing Expo
- Is Cloud Computing Like Teenage Sex?
- 1st Annual GovIT Expo: Letter from the Technical Chair
- Ulitzer News: Search vs New Media
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing Expo: Exclusive Q&A with Yahoo! SVP Cloud Computing
- Confessions of a Ulitzer Addict
- GovIT Expo Highlights Cloud Computing
- Twitter, Linked In, Ning and Ulitzer: Easy Personal Branding Strategy
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- The i-Technology Right Stuff
- Linux.SYS-CON.com Exclusive: Linus Discloses *Real* Fathers of Linux
- After Ubuntu, Windows Looks Increasingly Bad, Increasingly Archaic, Increasingly Unfriendly
- Linus' Top Ten SCO Barbs
- A Closer Look at Damn Small Linux
- Netscape Co-Founder's 12 Reasons for Growth of Open Source
- Introducing "Cooperative Linux" - Linux for Windows, No Less
- *POINT - COUNTERPOINT SPECIAL* What's Wrong with the Open Source Community?
- Where Are RIA Technologies Headed in 2008?
- Linux.SYS-CON.com Exclusive: What Would UserLinux Look Like?
- i-Technology Viewpoint: The New Paradigm of IT Buying
- Is Linux Desktop-Ready Yet...or Not?































