Phillip Greenspun: Java == SUV 974
lateralus writes "In his blog, Philip Greenspun re tells of his epiphany that Java is the SUV of programming languages. An interesting point brought forth in his typical extreme style."
An authority is a person who can tell you more about something than you really care to know.
non karma whore article text (Score:2, Informative)
After researching how to do bind variables in Java (see the very end of http://philip.greenspun.com/internet-application-
A project done in Java will cost 5 times as much, take twice as long, and be harder to maintain than a project done in a scripting language such as PHP or Perl. People who are serious about getting the job done on time and under budget will use tools such as Visual Basic (controlled all the machines that decoded the human genome). But the programmers and managers using Java will feel good about themselves because they are using a tool that, in theory, has a lot of power for handling problems of tremendous complexity. Just like the suburbanite who drives his SUV to the 7-11 on a paved road but feels good because in theory he could climb a 45-degree dirt slope. If a programmer is attacking a truly difficult problem he or she will generally have to use a language with systems programming and dynamic type extension capability, such as Lisp. This corresponds to the situation in which my friend, the proud owner of an original-style Hummer, got stuck in the sand on his first off-road excursion; an SUV can't handle a true off-road adventure for which a tracked vehicle is required.
With Web applications, nearly all of the engineering happens in the SQL database and the interaction design, which is embedded in the page flow links. None of the extra power of Java is useful when the source of persistence is a relational database management system such as Oracle or SQL Server. Mostly what you get with Java are reams of repetitive declarations at the top of every script so that the relevant code for serving a page is buried several screens down. With a dynamic language such as Lisp, PHP, Perl, Tcl, you could do bind variables by having the database interface look at local variables in the caller's environment. With Java the programmer is counting question marks in the SQL query and saying "Associate the 7th question mark with the number 4247", an action that will introduce a bug into the program as soon as the SQL query is modified (since now the 7th question mark has been moved to become the 8th question mark in the query).
Re:/.'d already.... (Score:4, Informative)
Re:JAVA is the suv? (Score:1, Informative)
Re:its a bad comparison (Score:5, Informative)
Didn't even attempt to find out who Greenspun is, huh? Check out his resume [greenspun.com]. He is a Ph.D. in Comp Sci and teaches Comp Sci courses in MIT. Do you happen to teach Comp Sci at MIT?
copy und paste!!! (Score:1, Informative)
Our students this semester in 6.171, Software Engineering for Internet Applications have divided themselves into roughly three groups. One third has chosen to use Microsoft
After researching how to do bind variables in Java (see the very end of http://philip.greenspun.com/internet-application-
A project done in Java will cost 5 times as much, take twice as long, and be harder to maintain than a project done in a scripting language such as PHP or Perl. People who are serious about getting the job done on time and under budget will use tools such as Visual Basic (controlled all the machines that decoded the human genome). But the programmers and managers using Java will feel good about themselves because they are using a tool that, in theory, has a lot of power for handling problems of tremendous complexity. Just like the suburbanite who drives his SUV to the 7-11 on a paved road but feels good because in theory he could climb a 45-degree dirt slope. If a programmer is attacking a truly difficult problem he or she will generally have to use a language with systems programming and dynamic type extension capability, such as Lisp. This corresponds to the situation in which my friend, the proud owner of an original-style Hummer, got stuck in the sand on his first off-road excursion; an SUV can't handle a true off-road adventure for which a tracked vehicle is required.
With Web applications, nearly all of the engineering happens in the SQL database and the interaction design, which is embedded in the page flow links. None of the extra power of Java is useful when the source of persistence is a relational database management system such as Oracle or SQL Server. Mostly what you get with Java are reams of repetitive declarations at the top of every script so that the relevant code for serving a page is buried several screens down. With a dynamic language such as Lisp, PHP, Perl, Tcl, you could do bind variables by having the database interface look at local variables in the caller's environment. With Java the programmer is counting question marks in the SQL query and saying "Associate the 7th question mark with the number 4247", an action that will introduce a bug into the program as soon as the SQL query is modified (since now the 7th question mark has been moved to become the 8th question mark in the query).
Google cache (Score:2, Informative)
Also below:
Our students this semester in 6.171, Software Engineering for Internet Applications have divided themselves into roughly three groups. One third has chosen to use Microsoft
After researching how to do bind variables in Java (see the very end of http://philip.greenspun.com/internet-application-
A project done in Java will cost 5 times as much, take twice as long, and be harder to maintain than a project done in a scripting language such as PHP or Perl. People who are serious about getting the job done on time and under budget will use tools such as Visual Basic (controlled all the machines that decoded the human genome). But the programmers and managers using Java will feel good about themselves because they are using a tool that, in theory, has a lot of power for handling problems of tremendous complexity. Just like the suburbanite who drives his SUV to the 7-11 on a paved road but feels good because in theory he could climb a 45-degree dirt slope. If a programmer is attacking a truly difficult problem he or she will generally have to use a language with systems programming and dynamic type extension capability, such as Lisp. This corresponds to the situation in which my friend, the proud owner of an original-style Hummer, got stuck in the sand on his first off-road excursion; an SUV can't handle a true off-road adventure for which a tracked vehicle is required.
With Web applications, nearly all of the engineering happens in the SQL database and the interaction design, which is embedded in the page flow links. None of the extra power of Java is useful when the source of persistence is a relational database management system such as Oracle or SQL Server. Mostly what you get with Java are reams of repetitive declarations at the top of every script so that the relevant code for serving a page is buried several screens down. With a dynamic language such as Lisp, PHP, Perl, Tcl, you could do bind variables by having the database interface look at local variables in the caller's environment. With Java the programmer is counting question marks in the SQL query and saying "Associate the 7th question mark with the number 4247", an action that will introduce a bug into the program as soon as the SQL query is modified (since now the 7th question mark has been moved to become the 8th question mark in the query).
-Adam
i'm sorry but.. (Score:3, Informative)
but they should be able to do them in all three of the choices they had, or was the course subtitled: "gaining profiency in one of 3 systems for doing one kind of a web project"?
and jsp is simpler than j2ee? jsp is part of j2ee, heres a clip from somewhere
***"What Is JSP?
JavaServer Pages (JSP) is a Sun Microsystems specification for combining Java with HTML to provide dynamic content for Web pages. When you create dynamic content, JSPs are more convenient to write than HTTP servlets because they allow you to embed Java code directly into your HTML pages, in contrast with HTTP servlets, in which you embed HTML inside Java code. JSP is part of the Java 2 Enterprise Edition (J2EE).
JSP enables you to separate the dynamic content of a Web page from its presentation. It caters to two different types of developers: HTML developers, who are responsible for the graphical design of the page, and Java developers, who handle the development of software to create the dynamic content.
Because JSP is part of the J2EE standard, you can deploy JSPs on a variety of platforms, including WebLogic Server. In addition, third-party vendors and application developers can provide JavaBean components and define custom JSP tags that can be referenced from a JSP page to provide dynamic content.
"***
and are we a little generic here (from greenspun)**A project done in Java will cost 5 times as much, take twice as long, and be harder to maintain than a project done in a scripting language such as PHP or Perl. People who are serious about getting the job done on time and under budget will use tools such as Visual Basic (controlled all the machines that decoded the human genome).**
that's nice, what kind of a 'project' is this project in this? the whole point in using java in projects like this is that you can reuse the code in other parts straight(heck, make a game for a java phone, then use the _same_ compiled classes on the server to determine if the uploaded scores are legit that you use for game engine on the j2me device). sure there's other points as well, like not tying yourself to microsoft(though, that is a point for php as well).
and really, people who use visual basic for big projects don't except to live long.. or be taken seriously on slashdot. surely you can do it seemingly cheaper when anyone can do it(but if mit produces people who aren't able to learn any language that suits the job best in reasonable time i've kinda lost my respect for them).
Re:JAVA is the suv? (Score:5, Informative)
I've got to agree with this. Reading Greenspun's blog I was left pondering how to start responding to something so completely wrong.
The article implies a lack of understanding of the JSP paradigm. Sure, binding variables to a relational database is tough. So if you insist on doing that, use JSP tags. But that's not the point of Java -- you should be access instance methods from a JSP page, and those instances can access any data source they choose.
VB and ASP are intended for developing front-ends to primarily relational data, so they make it pretty easy to accomplish. The fact that they make it easy doesn't mean that you can use the same design and technique to deliver a scalable, maintainable web site. All the current theory says take the pain up front and put in a decent template system, and never put code in your page.
"People who are serious about getting the job done on time and under budget" will get the requirements first, and not making sweeping bullshit generalisations. There is a huge problem in the industry at the moment with IS departments trying to coalesce the functionality of dozens of specific-purpose VB applications into one enterprise system. The size of the project, requirement for scalability, expected lifetime and regularity of changes, systems integration issues, cost, stability, customer technology preference and other technical and non-technical issues will all influence the choice of a development environment.
JSP type 1 applications (Score:5, Informative)
You will typically
I tend to agree with his problems with JDBC being quite cumbersome to use. This is why one will typically use data access Java beans which encapsulate data access. Also there are several object-relational mapping frameworks (e.g. CastorJDO) which will even isolate you from SQL and database details completely.
I would even tend to agree with him on terms of how quickly one can hack some web application. One will be faster with a scripting language like PHP, but when it comes to extending/maintaining a JSP type 2/3 application will win.
Re:JAVA is the suv? (Score:5, Informative)
Re:Programming lesson 101 (Score:3, Informative)
Daniel
Tcl is good (Score:4, Informative)
The "problem", if there is one, with Tcl is that it is not fashionable. Instead, lots of people just use it to get their jobs done quickly without lots of chest thumping, willy waving, and enterprise enabling.
Re:I think everyone is missing the point... (Score:1, Informative)
C/C++ don't have closures (but do have first-class functions, unlike Java) because they can't work properly with manual memory management. What's Java's excuse?
Java only supports subclass polymorphism, which makes things like collection classes very awkward to use (worst of both worlds of statically vs. dynamically typed languages), why? (Admittedly, this is being addressed by the upcoming generics)
Not only does Java force an "OO-only" approach, but an unusually clunky and awkward OO approach compared to most other languages.
The only reason why Java can be used to implement (some) programs efficiently is because it includes a huge library of pre-packaged functionality. The core language is probably the least expressive, least featureful language currently in use.
Re:Wahhh !!! (Score:3, Informative)
Java has not usually been "interpreted" for years. And in its JIT compilation, it can use optimizations based on data available only at runtime, which could in some cases make it faster than precompiled C code. Admittedly, that's rare and most of the time Java is slower.
business computing with Lisp (Score:3, Informative)
Who do you think keeps Franz [franz.com] and Digitool [digitool.com] in business? Hobbyists? I don't think so; they'd be using one of the free implementations. [lisp.org] Your "no one in business computing considers using Lisp" comment shows you don't know what you're talking about.
I myself use Scheme [schemers.org] in my employment, and it's helped a lot.
Re:Finally (Score:5, Informative)
It's cross-platform feature has been tainted by the agenda of the forces that dominate the respective operating system
I am currently employed on a project with roughly one megaLOC of Java. It has a Swing GUI, EJB middle tier, and Oracle at the back. It currently runs on Windows, several flavors of Linux, and Solaris, without recompile. I do the production builds on a Linux machine and we distribute them to roughly 2000 Windows and a few dozen Linux workstations. Likewise I do the production middle tier on Linux and deploy to Solaris, and the development and testing versions of the middle tier go to Windows, Linux, and Solaris.
Would it fit on a wristwatch? No, it's too big. Would it run on BeOS or Mac? You betcha.
Re:Warning: Knucklehead (Score:5, Informative)
AMD also uses GNU Common Lisp and ACL2 internally, though they can't reveal any specifics - this is of course the problem with a language that's suited well for the research and development part of the product phase. Who wants to give away what they're doing just to advertise that they're using Lisp?
Of course, if you wanted pretty pictures and "yet another database web interface", try the Stargreen site [stargreen.com]. But you won't find a lot of people using Lisp on those, for the simple reason that most of that work is cut and paste from a previous project.
Re:Programming lesson 101 (Score:4, Informative)
Well you could,
- Use Java Entity Beans with Container Managed Persistance.
- Use JDO
- Use TopLink
All of the O/R mapping tools automatically generate the SQL queries for you based on your Database Schema. No SQL necessary, hardcoded or otherwise.
Re:Like a SUV huh? (Score:1, Informative)
Owned.
Huh???? PHP -Good, Java-Bad? (Score:3, Informative)
PHP is fine for smaller applications. It is an utter desaster for large applications that need maintenance and the ability to be coded by many inidividuals. Every bit of templating done in PHP has to be done by hand or you have to have intimate understanding of the code for the "application server".
JSP allows you to use Java's strengths in that the logic can be done in servlets, beans etc and implemented as one line JSP tags. It's overhead heavy for small projects but excellent for larger ones where you will still be able to figure out what the code does if the original developer left or got fired. This is similar to ASP.Net I imagine.
His comparisons say nothing about the scope of the students applications or the tools used. Anyone doing a whole application in JSP is going to suffer, and this is because JSP is not meant for this, and a comparison of JSP and PHP on this basis alone will make PHP seem better than it is.
As someone else mentioned: Use the right tool for the job.
Greenspun somewhat misguided (Score:5, Informative)
Of the three, C/C++ is obviously not well suited for developing web-based applications.
PHP is quick and easy, but it suffers from a lack of vision -- it was never designed, and the authors don't really seem to know what they want to do or where they want to go with it (don't even get me started on how it's supposed to be "Object-oriented" now...). IMO, it's much easier to make a mistake in PHP, and code is much less maintainable than equivalent JSP pages -- just try switching from MySQL to Oracle, and you'll see what I mean. I shudder whenever I hear the words PHP and enterprise in the same sentence.
Re:Look what it's competeing against. (Score:5, Informative)
Agreed.
Well...no. C is used for system development (i.e. hardware banging). Java cannot be used in that environment without direct support of the libraries and the JVM (or by JNI calls to libraries written in C/C++).
Well...no. C can be used anywhere that Java can be. On the server side, most servers (including web and proxy servers) are written in C. There's nothing stopping people from writing "app servers" in C...in fact there may even be a few of those too.
On the client side, "applets" are not a valid use of Java. Applets was a marketing ploy that grew wildly out of hand. Besides, there are ActiveX controls written in C/C++ that perform the same basic functionality of applets.
One thing that Java has over C/C++ is its cross-platform capabilities. With C, if you want cross-platform you have to work to code it that way. With Java, if you want to break cross-platform, you have to work to code it that way (use non-standard libs, use JNI, etc...)
Yes and no. Perl is slower to start up than a C/C++ native application of similar functionality. Java too is very slow to start up (usually *much* slower than Perl for very small scripts).
However, long running apps written in Perl and Java both perform very well when compared to similar C/C++. By long-running, I mean "long enough that the startup time becomes a wash". I've written web crawlers in Perl and Java that run for weeks at a time. Comparing their performance to existing crawlers written in C/C++, the performances are equivalent (though the Java and Perl bots suck up more memory).
Development time for those bots was significantly less in Java and Perl than for equivalent C-based bots. (BTW: the Perl bots were written back before LWP was stable/available)
Well...no. VB is stuck on one platform (well, two if you consider MS-Java...though VB.NET is NOT VB).
Re:Tcl is good (Score:3, Informative)
Re:Programming lesson 101 (Score:5, Informative)
Yes it is true that you can easily decompile .class files to get back almost the exact source code (without comments). However it is also true that there are code obfuscators that do a really good job of making it damn near impossible for someone to figure out how the code works. Imagine if you overloaded your methods and classes as much as possible such that 70% of your class names were 'A'. i.e.
setName(String) becomes a(String)
setAge(int) becomes a(int)
getName() becomes a() and
getAge() becomes b()
It makes it darn tough to figure out what the code does. And you don't have to write the code in this obfuscated manner, you write it using good code practices and the run the obfuscator on the compiled .class files. The output of that obfuscator is a set of obfuscated code and a mapping file so if you get debug messages like:
NullPointerException in A.c(int) line 147
then your mapping file will tell you that "A" was actually your class name "Client" and c(int) is actually "stZipCode(int)". Now you can still debug a customer's error without giving away anything about the code structure to the customer.
However, the place where Java has been excelling (and where I've made my living for the past 5 of my 15 years in software) is in major web applications where the user doesn't have any access to your compiled code. The combination of Java servlets, talking to Enterprise Java Beans or to a database via JDBC and then outputing the html using Java Server Pages is now pretty much the default way of writing a huge data-centric web site. Pretty much all major banks do their on-line banking web sites this way (this is my area of expertise). This is the technology behind Amazon.com and (I believe) Barnes & Nobel.com as well. If you use Quicken or MS Money to do your bill payments and check your financial statements you're either connecting to CheckFree (Java Based) or to an EEI server (Java based) to transfer all that financial info.
So is Java fat, bloated and wastefull? Well, how fast is your on-line banking? How fast is Amazon? How fast does your Quicken software work? You'll wait far more because of lag in your web connection than with any kind of slowness with Java.
So what we have here is some academic geek with a web site on the Harvard Law server telling those of us who actually pay our mortgages writing Java software that we don't know what we're doing. Well, that's fine. When I'm done paying off my house 15 years early (as well as all my car, student loan and credit card payments) and I'm retired debt free at age 50 I'll try not to be too upset that Phil Greenspan's angry little blog said I did it by using the wrong tool.
Re:Wahhh !!! (Score:2, Informative)
There is some overhead due to the dynamic message passing, but then you have that in C++ as well and is something that would slow both languages down compared to C. The expressibility and re-usablility of the OOPS paragim means that design, and maintenance can be much better with Java than a C program over the entire life a a project for a great savings in time and money for everyone concerned.
Re:Programming lesson 101 (Score:1, Informative)
Wow, people STILL don't get it. (Score:1, Informative)
Java has drawbacks, but the difference between paradigms such as OO Perl and PHP are so misrepresented it makes me want to cry. As someone who spends a fair amount of time mentoring people in Java programming, I'd like to first support the assertion that nobody learns how to program in college. They learn how to solve algorithmic problems, and maybe know a little about OO.
The strong typing, file-system coupling, and general stickiness and complexity of Java are all _features_ of a language that was developed in response to a concrete need. I love PHP (do my dev for personal projects in it still), but it doesn't cut it for big-iron app development, and neither does (any form of) Perl. I'm in charge of architecture for an online banking system, and I think I know a few things about application complexity and code maintenance- and I'll tell you that nothing beats PROPERLY WRITTEN Java in these categories.
1) You can certainly write working applications more quickly in PHP/Perl if you're a novice. The interfaces are easier to learn, the simple stuff is pushed to the top SO THAT YOU CAN do things quickly and easily.
2) You can do things 'More Than One Way' more easily in Perl / PHP without strong typing and hard-locked OO hierarchies. This is a strength for lightweight development, and an increasing pain in long-term, distributed and enterprise development.
3) Java APIs for simple things ARE often difficult, because they're designed to do more than your casual user needs. Take a look at SAX (interestingly named 'Simple API for XML') if you want an example of an extremely difficult-to-use interface to a common technology. The spend a few years developing and tuning XML applications, and you'll begin to understand why the guys at Sun did it that way.
4) Don't confuse Java development with EJB / JSP development, which is the misguided attempt by Sun to provide a MS-like solution for people who don't know enough to be allowed near the good stuff. THAT is a guzzling SUV, and you don't get nearly enough for the price you pay to run those applications.
5) Anyone wanna compare performance benchmarks? On servers these days where it costs $1000 to get a box with a 2GHz proc & 1BG of RAM? Sure, Java users more of that glut of resources than other languages... because you're paying for two things: platform independence, and JVM-managed garbage collection.
PHP & Perl will always be the kings of prototyping and lightweight application development, but will never be able to compete with Java-style frameworks for long-term maintainability, complexity management, and scalable & distributed architecture.
Re:Swiss Knife, Eh? (Score:3, Informative)