Usually, as Senior Editor of LinuxWorld Magazine, I restrict my potshots to complaining about how much work is left to make Linux a usuable desktop OS, or heckling SCO and Microsoft. But it's a little-known fact that I have an secret identity as a Java developer. So, for a change, I thought I'd take a potshot at Java.
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.
About 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 E. Ervin wrote: I
find alot to agree about
with your posting and I
am a Java partisan. I
think part of the trouble
is based on two things.
Number one, almost
everyone who is a Java
programmer is a
recovering C/C++
programmer. C/C++
programmers are notorious
for being too clever, the
language forces them to
be. If you think I am
kidding, take a look at
the latest set of
improvements that were
made to Java 5.0, they
are all about getting the
C programmer. The next
point is that almost to a
man, we software
developers do not
understand that the best
analogy to software
development is not a
factory, but writing.
When someone goes about
writing an article that
is to be read by the
widest audience possible,
they don't use everything
they know about grammar
and all the words that
they know. Take a look
at the k...
Sean Ogden wrote: Loved
the artical and the
comments.
Had to comment:
Did you get chopsticks
or a knife & fork at the
Perl cafe?
My opinion is these are
not language issues, but
cultural ones.
AKP wrote: Just use the
great, rich, and soooo
easy to learn and use C#,
VB.Net, or any other .Net
language and I am sure
you will not suffer ANY
of this pain. Just take
your pick... Gosh, you
can even use COBOL if you
are still stuck with that
language and get similar
great results. Go dot
net.
krm wrote: Making things
overly complex means more
job security for those
that can still do it.
Then more paid work later
to modify it for new
uses. Then more people
will be needed to teach
it. It is a money making
proposition all around,
with only a few
idealistic but naieve
people making it complex
because it is fun to be
able to keep all that
complexity in mind and
still make it work.
Einstein did say to make
things as simple as
possible (and I know he
added "but no simpler").
You can waste a lot of
your life on overly
complex pursuits, even if
you make a lot of money
doing it. You make
something very complex
work, and gain a little
euphoria from being able
to do it, and from you
being able to do it and
hardly anyone else, but
it is still a waste, and
something much more
productive could have
been done.
So th...
Stephen Strenn wrote:
Right on!
But allow me to argue
that the Java community
needs *more* design
patterns, *not less*.
In particular, our
libraries and packages
need the FACADE design
pattern. The facade sits
atop our complex,
powerful library,
providing a very easy to
use interface that lets
90% of us use the package
with a minimum of fuss,
but doesn't preclude the
other 10% from accessing
the flexibility provided
by the underlying
library.
So here is to a *new*
Java paradigm - every new
Java library must come
with a facade!
Kieran Dolan wrote: Maybe
the real problem is the
insidious creep of
"patterns". Patterns are
great aids to
implementation design but
often they seem to be
used as an excuse for not
thinking the problem
through.
In particular, the
excessive use of
factories seems a real
problem in Java.
Frequently I see a
factory that has only one
implementation and
returns only one type of
object. If we take a
simple API, add a
factory, an interface,
its concrete
implementation in a
class, a factory
interface, a factory
implementation class and
possibly add in a
"factory factory" with
its implementations, a
single API has bloomed
into a complex system.
Multiply this by 10 or 20
and we have an unusable
system and a maintenance
nightmare !
TX wrote: Something tells
me a simple form
submission wouldn't
require 200 screens
either.
Also MVC model 2 doesn't
necessarily result in
three files per screen.
Firstly, you usually only
need to make the model
and the view, since the
controller is done by
whatever system you are
using (e.g. Struts.)
Secondly, multiple
screens can be done by
having multiple views to
a single model (this is
actually one of the
points of using MVC in
the first place.) If you
put one file per screen
then you will quickly
find code bloat, which
you would agree is bad.
George Costanza wrote: I
think James Turner is
right on the nose with
his article.
Java makes it easy to
write OOP and so
developers take on this
holy journey of
abstraction/patterns
often burying the actual
problem to be solved
within several layers of
unnecessary (at times)
wrapper calls.
I am not against good
design, but it should not
mean "code bloat". Part
of the charm of languages
like Perl, PHP, C is that
you write succinct code
to get the job done.
Take MVC Model 2 for
example, great pattern
but its 3 source files.
In a large project with
200 screens, I am looking
at 600 source files. Is
that really necessary for
a simple "form
submission"?
Robert Wilson wrote: 1.1
What Is ColdFusion?
In 1995, J.J. and Jeremy
Allaire introduced a
product they believed
would revolutionize
application development
for the Web. They too
called their creation
ColdFusion. The two
brothers formed the
Allaire Corporation and
began selling ColdFusion.
Unlike its infamous
namesake, ColdFusion has
delivered on the promises
put forth by its
creators. In 2001,
Macromedia acquired
Allaire, and along with
it, ColdFusion.
ColdFusion MX represents
the second ColdFusion
product release under the
Macromedia banner.
According to Macromedia's
marketing materials,
ColdFusion is "the rapid
server scripting
environment for creating
rich internet
applications." Internet
applications exist as a
collection of pages, also
known as templates, which
work together to allow
users to perform such
tasks...
Zing wrote: Executing GPG
from Java is only hard if
you want to use the
native Java API. Of
course if you were like
the rest of us, and had a
utility class lying
around which took an
input stream for the
input to a program and an
output stream for the
output to a program, you
could do the sane thing
and exec "gpg", capture
its output, and so on.
GPG really isn't going to
be a simple thing to use
any time soon. But I
guess we could make it
somewhat simpler, because
in an ideal world:
InputStream src;
OutputStream dst;
//
GPGKeyStore ks = GPGKeySt
oreFactory.create("somewh
ere/pubring.gpg");
GPGKey
k = ks.getKey("0xFFFFFFFF
FFFFFFFF");
GPGEncryptor
enc = GPGEncryptorFactory
.create(k, src,
dst).encrypt();
So I guess the question
is, assuming the BC
implementation is at
least as difficult to use
as the Cryptix
implementation, wh...
Horacio Lopez wrote: Mr
Turner,
I couldn't agree more
with you about Java.
On the contrary, dissent
on your remarks about
Perl and how well its
CPAN is constructed.
Fortunately, for a bunch
of us who don't want, or
don't need to be told
what to use, there's
something in the middle.
The Ruby programming
language was created
handy and easy to master
as "A better perl" still
being Object-Oriented as
in a "better Smalltalk".
There's no lack of other
languages, there's also
Python, and more recently
Groovy, I just personally
prefer Ruby because of
the handy RAA (Ruby's
version of CPAN
raa.ruby-lang.org)
Rubyforge.org (Ruby's
version of sourceforge)
the great *libre/free
"Programming Ruby" book,
and the amazing friendly
community that has been
built around it (check
out irc://freenode.net/#r
uby-lang)
As if it wasn't enough
...
E Nishada wrote: I have
been writing software in
Java for about 6 years
now. Java does have its
warts but due to its
simplicity, garbage
collection and useful set
of standard packages, I
switched from Smalltalk
to Java. Besides,
Smalltalk jobs
disappeared pretty fast.
As I see ever more
complex packages and APIs
that don't always work
well enough, I have been
pushing for Java + a few
packages as the
implementaion tools and
it has worked well for
us. If you stay away from
EJBs and other
complexities, I think you
will be fine.
I think the real issue
behind Java's complexity
(Java packages really) is
overuse of design
patterns. Design patterns
have a context that is
routinely ignored and
applied where it is
unnecessary. Where I
work, we had to abandon
the entire codebase
developed by a team and
rewrite it with KISS
pri...
David wrote: Bravo. I'm
a longtime Java
programmer since the JDK
1 days and it's only
gotten worse. You should
see the XML DSign APIs!
What a joke. I have an
XML doc, so I should just
do something like say,
sign("/doc/part"), or if
I need to sign 4 or 5
fields, I would be okay
with something like:
dsig.addPart("/doc/part1"
);
dsig.addPart("/doc/par
t2/subpartA");
dsig.sign();
But it's never that easy,
yet 99% of all
programmers want to do
that.
The entire DOM API for
XML makes working with
XML nearly impossible,
yet XML is such a simple
and elegant format.
EJB is another joke.
It's shame because it's
FINE to have that
complexity UNDER THE
HOOD, but it's downright
ignorant that we all have
to write wrapper classes
that hide all that
complexity.
Go figure! At least it
lets me get paid more
than I should for doing a
job that really shouldn't
be that hard.
Ivan Handler wrote: Very
good article. I recently
went crazy trying to
integrate JaXB into a
project. Luckily I found
JiBX which does the same
thing but without all of
the unnecessary
complication.
Java is a good language
to program in and it can
be very clean and
elegant, but you need to
be careful what packages
you use and how you
create them.
I have been writing code
for over 40 years, every
language has its strong
and weak points. If used
properly, I find that
Java is far more elegant
and clear than most other
languages. It can keep
you focused and doesn't
have a lot of syntatical
constructions to learn
(as in Perl) or backend
ways to corrupt your
structures (as in C++).
I do think the tendency
to overgeneralize is
present in many
programmers. I think
some of it is sheer
arrogance, writing code
as if it is go...
Dave T wrote: I couldn't
agree more. We had a
tight group of developers
who wrote simple fast
reliable code in Java.
Then we hired one of
these "flexibility" guys,
and he spent weeks
re-writing code to be
"flexible". Finally the
conflict got too great
and he quit. Now we are
spending time re-writing
the code back to how it
was originally written.
We havent used any of
his so-called
improvements, and Ive
had more than one person
come to me and say When
I wrote the code in this
package, it provided this
functionality, now I
cant tell how its doing
that. And we have to go
into the 36 classes that
replaced the 3 that
originally made up the
package and figure it
out. 36 classes means
more code, more bugs,
more headaches.
Keep it simple until you
NEED to make it complex.
Then only add complexity
for BUSINESS rea...
the real difference
wrote: They're both the
same and they both suck.
In our day jobs we have
to do this:
for (int i = 0; i <
collection.length; i++) {
result += somefunc(
collection[ i ] );
}
and when we play air
guitar we do this:
(set result (apply
'#somefunc collection))
jeremy lightstone wrote:
I will not profess to be
a super programmer.
I understand the
finite/logic concepts, i
am observant,
and i wud rather do other
things than code and find
error.
All comp lang r difficult
cuz too much complexity,
comp geek egos, and the
human condition to make
silly mistakes(++many:).
Let's stop telling
eachother how long is our
schlongScript, and make
comp progs that work and
help ppl, while keeping
us sane + excited.
GarbageCollect the
complication.
My quick thoughts as an
artist and a
semi-programmer.
Perl is
too criptic, Java has too
much typing and seems to
push data all over a
program. In the end most
OO programs are
semi-procedural, and most
scripts(ie.PHP/CFM) r
trying to be OO. I have
reviewed a national
adservers using full perl
and their system was
impressive, however, Java
just seems b...
Trevor wrote: Design is
the art of making
decisions.
I think that developers
often add needless
complexity to their code
because they aren't
willing to choose between
alternative designs, or
to consciously limit and
restrict the
functionality of a
library. I don't think
this is a symptom
restricted to only Java,
although it may be more
prevalent in Java than
Perl because Java
programmers, IMHO, tend
to be slightly more
idealistic than the more
practically minded Perl
programmers.
Overall, I don't
attribute bad design to
the language, but to the
APIs and coding standards
developed around that
language. I've always
found Microsoft's usage
of C++ to be highly
confusing, while Unix's
to be relatively easy to
understand.
The court also said
Novell couldn't run
interference for Linux
and stop SCO from seeking
royalty payments for
alleged UnixWare and
OpenServer infringement
by Linux users under its
infamous SCOsource
licensing program. ,
it's merely a matter of
time before SCO starts
seeking those pa
You have perhaps heard
that while we were on
vacation Linux file
system ace and convicted
wife killer Hans Reiser
took the cops to where he
had buried her body. Two
days later when Reiser
was supposed to be
sentenced to 25 years to
life for first decree
murder the judge
disclosed that
Two of the biggest
launches in Rich Internet
Application history took
place in 2007/2008 when
Adobe launched AIR 1.0 in
February '08 and
Microsoft launched
Silverlight (September
'07). At the 6th
International AJAXWorld
RIA Conference & Expo in
October SYS-CON Events is
delighted to be
Brian Stevens, the Chief
Technology Officer and
Vice President of
Engineering of Red Hat,
delivered his
Virtualization Keynote
'The Future of the
Virtual Enterprise' at
SYS-CON's Virtualization
Conference & Expo 2007
West in San Francisco.
'Virtualization is the
hottest subject today,
Red Hat announced
advancements that extend
the Company's Linux
Automation strategy by
providing expanded
capabilities and
incorporating broadened
community involvement for
secure management of both
users and systems across
virtual and physical
enterprise
infrastructures.
Xandros acquired
Linspire's Linux assets
after Linspire changed
its name to Digital
Cornerstone. With the
acquisition Xandros CEO
Andy Typaldos has been
telling the press,
'Xandros is already the
third-largest Linux
company in the world, and
... we may already be the
largest private Li
SUBSCRIBE TO THE WORLD'S MOST POWERFUL NEWSLETTERS
SUBSCRIBE TO OUR RSS FEEDS & GET YOUR SYS-CON NEWS LIVE!
Click to Add our RSS Feeds to the Service of Your Choice: