Fallout from the Java = SUV posting

The “Java = SUV posting” continues to resonate in my inbox.


The last two students using Java dropped 6.171.  They were not keeping pace with the PHPers and those who sold their souls to Bill Gates.  (Recall that all the students in 6.171 had built a 10,000-line Java program in 6.170 so they all knew the language itself quite well.)


Lots of professional Java programmers emailed to say “If only those students had used Libraries X and Y, they would have done okay.”  Sadly X and Y were never the same in any two emails so it is easy to understand how the students went wrong (i.e., it is not obvious how one is supposed to choose among the 100 different ways to get something done in the world of Java tools).


Similarly there was no agreement among Java programmers as to whether it is good to have SQL queries prominently featured in source code or better to make everything into Java objects and magically generate SQL behind the programmers’ backs.  Half of those emailing said that SQL was impossibly hard to write and what people really needed was to see the programmers’ custom-created methods.  The other half seemed to think that a database application ought to be primarily expressed in SQL, a concise declarative query language that has been standard for 25+ years.  These are 100% incompatible points of view.


My friend Curtis, an old-time Silicon Valley monster C hacker, AIMed me to say that he’d seen the Slashdot article:



“My problem with Java is that it makes hard things hard, and easy things hard.  The amount of hassle doesn’t scale with the complexity of the problem.  Whereas with PHP you can write “Hello World” without having to read a 200-page book.  Java is a train wreck with dozens of classes with slightly different methods that do similar things.  On the other hand, it kills me that the PHP database interface is so bad.  Actually PHP just kills me anyway…why they had to invent a new language, I’ll never know.”


I pointed out to Curtis that the latest Technology Review, MIT’s alumni rag, picked the developer of PHP as one of its “100 Bold Young Innovators You Need to Know”:



“Rasmus Lerdorf has learned five languages while living around the world.  But it’s the language he invented that has had global impact.  In 1995, without any formal programming training, Lerdorf developed a server language to help him set up Web sites. … He named the language PHP, for PHP hypertext preprocessor.”


Curtis’s response to Tech Review?  “People mistake creation for innovation”.

115 thoughts on “Fallout from the Java = SUV posting

  1. Sigh, I still don’t understand how one can state that Java is so complicated. It’s quite easy to put together some basic SQL queries (and I would suggest avoiding Prepared Statements for all of the reasons you stated earlier, and simply go with a normal query where you can specify BY NAME what columns you want. I haven’t seen more than anecdote to clealry state the difficulty you and your students are having with the language. You can easily even embed sql execution code into a jsp as simply as a series of langauges. Of course Clisp or Scheme is going to be easier to write functionally, or in a scripting language, but you’re comparing apples to oranges. I haven’t seen much web based implementations for CLisp or Scheme, and I wonder how simple they are to use. I myself do like Lisp quite a bit, but find Java okay for some usages. Perhaps you could post some less anecdotal stories about the problems you’re having with Java. That would be wonderful to see.

  2. By the time you need to count question marks to know which value to fill in, and lose track of them too, you seriously need to consider whether or not your application is on the right track or not.

    OTOH, some people can hardly count to 10, who am I to hold that against them?

  3. I am really surprised that MIT grads have such a hard time grasping Java.

    Still, Java sucks for small one-off websites (like I posted before) and for a first time website builder. Making architecture changes is very hard in Java, you need to know what you want to do and that it is going to work before you start. This is probably where your scripters had the edge. Everyone on the course was new to building websites, and they were new to Java. Put experienced Java people and experienced PHP people next to eachother and compare those groups, I think you will see very little difference in coding speed, with the Java guys (m/f) probably having the edge when it comes to exception handling and debugging.

    The newbies probably made the classic mistake of starting with the GUI and then coding the guts. Had they created many classes and methods to handle database retrievals and updates and only then started on the GUI, as you should for any project, they would have fared much better.

    As for me, I am getting a bit tired of web applications. I never thought I would hear myself say this, but I want to get into building J2EE apps with a Swing GUI front-end.

  4. Oops, they weren’t new to Java. My bad. Still, most of my comment stands.

    I wasn’t there to see it, but you saying they had pages of declarations on their JSP pages makes it clear they were trying to do _everything_ in the JSP, not just the presentation layer. Which is stupid, you should have know better and pointed that out to them at the start.

  5. Stating that the students weren’t new at Java makes it all even more scary. Makes me wonder how it was brought to them.

    Some point I agree with. Sometimes the whole Java and J2EE concept can make it very hard to do simple things quick…but that is usually not encountered in simple web apps. Unlike you were claiming, it is just as easy to print “Hello World” in a JSP page as it is in PHP…just the syntax differs….and as I’ve been creating below examples, I wonder which is actually easier to grasp.

    <?php echo (“Hello World”) ?> <!– This is PHP –>
    <%= “Hello World” %><!– This is JSP –>

    Big f***ing difference.

    Database access can be even easier. You don’t even have to deal with connecting to the actual database in a J2EE web application, any decent J2EE container handles that for you. Just ask the container for a database connection, and off you go.

    The problem is getting the application framework to work first, but then again, that’s what you have server administrators for, programmers shouldn’t be touching it.

    Granted, for people who want a quick result, and don’t care much about who needs to maintain, debug or implement their application, PHP and friends are probably a gods gift. The rest of the world probably prefers more robust tools, which allow abstraction of functionality from form.
    Just my $0.02

  6. Do you know how hard it is to compile a loosely typed scripting language? All the typing happens at run-time depending on the data encountered. So you can’t just compile it in the traditional sense, at best you could generate some sort of execution framework within which the code would run in some pseudo-accelerated state. You could call it compiled, I suppose, but it wouldn’t really be compiled in the same sense that you compile C or C++.

    Rasmus Lerdorf

    I don’t know what these five languages were, but I guess none of them were dynamically typed

  7. I took 6.171 via the web a few years back, when it was all done using the ACS and TCL.

    I recently had to do some database applications using java.

    I would say that Java is just not really cut out to be a Web/DB interface because usually it’s too much tool for the job. Who the hell wants to muck around with String and Integer objects when all you really need is a way to get Strings from Database a to Web broswer b?

    I just wonder how well a Java-based site running on Apache would scale compared to a TCL-based site running on AolServer… the tcl site would probably put the java site to shame.

  8. Perhaps untyped languages are easier in the short term, but when it comes time to maintain someone else’s pile of code, I’ll take a typed language any day. Otherwise, how do I really know if I’m breaking something (given that the frameworks fulfill semantic obligations)? Dave Thomas (an avid untyped language advocate) suggests that 100% unit test coverage is the answer. I’ll just take type checking, thank you. Java does take a couple of years to really master, but it’s worth it in the end.

  9. “Similarly there was no agreement among Java programmers as to whether it is good to have SQL queries prominently featured in source code or better to make everything into Java objects and magically generate SQL behind the programmers’ backs.” — I’d love to see a good pro/con analysis of these very different approaches to handling SQL in web applications (independent of programming language). I’ve been writing toy web-applications for years, and I still haven’t found the One True Way that works for me. Are there any good “best practices of web application design” documents online? Or do I have to enroll in MIT to get that kind of an education? 🙂

  10. I agree – if all you want to do is to pound out something that shows results of a database query on a web page, then you shouldn’t be using a programming language at all. If this is your problem domain, any old thing, including PHP, TCL, ASP and Java will do the job.

    I guess the point is, Java isn’t trying to compete in the “just pound out something quick and dirty web pages” category, although I think a real developer can do that. I also don’t get how a language that is entirely HTML based is being compared to a general purpose language. Obviously, as the size of the problem domain that a tool needs to solve shrinks, the tools complexity can be also.

  11. Regarding 101 ways to do it in Java… the same could be said for Perl or UNIX in general.

    To me there are only two things that one needs: a) a data binding framework, b) a SQL framework. The most popular data binding framework by far is Struts. There really isn’t a “most popular” SQL framework. SQLJ is a good approach that gives C-like binding variable statements, but no one uses it.. I think the java community has a real dislike of SQL in general, which is why object/relational mappers like JDO and Hibernate have grown in popularity.

    If I wanted to do a simple web system, I’d write a couple of utility classes to make my database calls and data binding easy, and use Struts. I managed to get 20 COBOL developers to port a few hundred thousand lines of code this way in 4 months (out of 1.5 million lines we got around 1/3 of the system ported as a proof of concept). We used TOPLink instead of stored procs but the idea remains the same. I spent 8 weeks teaching them Java, JSP, etc. and we spent 4 months doing the work, with a couple of solid java developers to assist.

  12. Phil, your SUV metaphor misses the point.

    Java is the peacock’s tail of programming tools. It doesn’t exist to make life easier, it exists to filter out the unfit and reveal the smartest, hardest working programmers.

    I’d “hire” Java programmers in an instant. Just, having hired them, require them to build in Python.

    As to the posts about Java vs scripting scalability, consider this : AolServer and TCL scale to a pretty large number of users. Given that web traffic is distributed according to a power-law, the number of sites that need to scale larger than any scripted solution can handle, is miniscule.

    Writing these kind of exotic systems requires special techniques and tools, but so does writing massively parallel scientific applications. I’d suggest both are areas that you might choose to specialize in, but aren’t a necessary part of everyday web / internet work. And tools for them probably don’t need to be part of the core curriculum.

  13. Not sure if I’ve seen this question answered: are these students CS majors or some other major that is taking a computer class on the side? If they are CS majors, there is no excuse for not being able to handle any language (and I must admit that if Harvard students can’t “get it” then it calls in to question the prestige of Hardvard all around). If these are not CS students, I surely see how PHP has a lower learning curve for web-based applications, but that still doesn’t mean it’s the perfect tool for all projects (ie: non web-based apps). So, to sum this up in a geeky equation:

    if (student.major == Majors.CS) {
    return “retarded”;
    } else if (project.type = Projects.WEB_BASED) {
    return “ok”;
    } else {
    return null;
    }

  14. Andrew Waterman writes, “I haven’t seen much web based implementations for CLisp or Scheme, and I wonder how simple they are to use.”

    A one-page SQL-driven web app based on Scheme. Click the “View Source” link to see how easy it is:

    http://brlewis.com/map.brl

    I’m sorry to hear those two students dropped 6.171, assuming it really was due to difficulties with JSP, and not due to difficulty with the concepts and material. They could have kept most of their infrastructure, and even their working JSP pages, but used BRL for new pages. Even session variables could be passed back and forth.

  15. Mark, if I was in the position to hire anybody, I’d certainly consider you.

    Patrick, I think you need an == rather than an = . The point is, of course CS majors can write in any language. There’s nothing (much) wrong with Java as a language. The problems are

    a) the language requires a riddiculous amount of finger typing (so more time spent correcting finger typing errors),

    b) the strong type checking on things that should be generic means that you spend a lot of time casting in and out of collections and collections which wrap the database,

    c) the fact that library reuse is through “frameworks” and not “components” means that you have to learn a huge amount to understand how to re-use these libraries. There are lighter frameworks, but they’re not the standards nor well documented (eg. you can buy a book in installing and using them)

    d) checked exceptions

    e) strings as second class citizens make every movement of data in and out of a form or database a pain.

  16. From http://raibledesigns.com/comments/rd/sunsets/php_vs_java_which_is

    First and biggest difference, you don’t have a notion of application in PHP. Each page is a script, executed in its own memory environnement. That means PHP is great for dynamic web site, whereas server Java is “sold” for server-centric applications, which is a different class of problem. For a “pure” website, development in PHP is way faster, and performance and scalability is easier to achieve than in Java. For heavy applications (multi-user workflow, XA transactions, distributed objects… as soon as you really need an application server, and *not* just the HTTP layer), the “application” notion is needed and thus PHP is more cumbersome to deal with.

    From slashdot.org

    Let me educate you on a point that you seem to completely miss. (And lots of people with lack of real life experience in large projects miss.) That is: the difference between prototyping and actually making a robust, scalable and (most importantly) maintainable product.

    No one, I mean no one in business computing considers using Lisp.

    Of JSP he says, “… still it seems to be too complex for seniors and graduate students in the MIT computer science program, despite the fact that they all had at least one semester of Java experience …” I expect that seniors and grads at MIT are very smart, but good software engineering discipline usually requires years to learn, even by the smartest cookies. To expect it after one semester is another clear sign of enormous naivete.

  17. Tim: “I just wonder how well a Java-based site running on Apache would scale compared to a TCL-based site running on AolServer… the tcl site would probably put the java site to shame”

    It probably would, but you are comparing a great app server to a mediocre webserver with an appaling servlet engine. (Tomcat)

    If you compare AOLserver Tcl and an application running on Orion Server (http://www.orionserver.com, which is the same as Oracle’s J2EE server, Oracle licensed it) the results would be very close indeed.

    Hmm, being fluent in both technologies, maybe I should try that some day.

  18. When I was at MIT, we used CLU for 6.170 (software engineering) and 6.035 (compilers). Whenever our program had an error, the CLU debugger itself would core dump. We still finished the projects and the classes anyway.

    Apparently MIT today is not what it used to be.
    The professors are no longer slamming their pet languages onto the students who in turn are no longer willing to take the abuse.

  19. Two questions need to be asked: Is this the first time this class has been offered in this format? If not, has this been an ongoing issue (ie, do students using Java *consistently* have a harder time completing the project vs those using other languages)?

    Otherwise, we could just be looking at some random datapoint.

    My gut feeling is that there is a reasonable explanation for the Java user’s problems with completing the project that lies outside of the scope of the language itself. Anyone who knows Java also knows that knowing the language itself “well” is only part of the story. Knowing best practices with the API’s is at least half the game.

  20. “No one, I mean no one in business computing considers using Lisp”

    Someone should tell Paul Graham (and his accountant) that. Have them mention it to Orbitz too.

  21. This reminds me of the truly classic old debate: Ancient Sumer or one of those new higher level, more abstract languages.

  22. Sir,

    Of course Java is “difficult” in the eyes of a scripter. A scripter doesn’t have to worry about such “nonsense” such as compile-time errors, or good packaging, or memory management (yes, you still have to deal with SOME memory management in Java and C#). All they have to do is put a bunch of hard-to-maintain code intertwined with some HTML and you have a web page.

    Big deal.

    Now, tell me how you can distribute your application in (enter scripting language here)?

    Exactly.

    One thing — some tools are better than others with different requirements. The smart programmers don’t program in Java, C, C++, C#, PHP, Perl, etc. The smart programmers know how to analyze requirements and choose the right tool for the job, balancing maintentance, scaleability, and performance.

    😛

    -Michael

  23. You know, the more I read these comments (and those of the previous post) the more I’m reminded of the time Jamie Zawinski (a fellow ex-LISPer) ranted against the state of Linux usability and it got posted in Slashdot too:

    http://www.jwz.org/doc/linuxvideo.html

    Maybe Phil could add a similar disclaimer in this page. As for me, I’ll make sure that whenever I rant against Java, Linux, BSD, Macs, Windows, Perl, PHP or MySQL in my page, I have a handy Redirect in my webserver sending those coming from Slashdot to http://www.goatse.cx...

  24. (Addendum: if you haven’t heard before of Goatse.cx, you might NOT want to go to that site. Leave it to the code-monkeys).

  25. or everyone could just use FORTH and drop all this B*S about types and all. Its all bits in the end. Create the language that is tailormade for your problem domain and you have your problem solved.

    obviously, the decrepit thinking that goes on in FORTH circles these days is mainly to blame for the demise of that language. But a well written FORTH program is just pure beauty and simplicity to behold.

    dammnnn!! I’m a nerd

  26. Actually, my mba instructors at Cal would agree with Curtis. They made the point, often, that the reason that us weenie engineers deserved our shafting, was that there was a difference between invention and innovation. Invention is easy, trivial, and barely worthy of respect.

    Recognizing the manufacturing simplicity of two sticks over six and what that can do to the bottom line (cf reiner & brooks), creating a market for small painted rocks, convincing people they need to buy expensive complex bug ridden software to fix the problems in the expensive software they already use — that’s innovation!

  27. PHP has been taking a bashing from all ends for not being a “serious” language. The Perl faithful boast of Perl’s built-in regex syntax (as opposed to using functions) and the ever bountiful CPAN resources. Java developers sneer at it as if it’s not a real programming language. Meanwhile, it’s usage continues to mushroom and it is by far the most popular module for the #1 web server software (at least measured in # of sites).

    I don’t mean to sound like a brainwashed disciple of PHP, as the language has its warts and will continue to show strain as the language creators and/or maintainers continue to transform it from a scripting language into a developer platform. But Perl is beset with inflexible syntax when it comes to representing anything more abstract than a simple array or hash array. Flooding reference syntax pecuilars with a host of default behavoirs makes for cryptic code that even an author who recently wrote it has to study carefully. And I love Perl, but my Perl use is in the realm of system administration chores where it really shines. And Java is riddled with problems – from Sun’s stewardship to just the bloatedness of the language to accomplish simple things. Processing web pages, in my view, is best done with a shell script type syntax substitution. This is where PHP, Perl (or Python) shine – it’s easy to crank out a DB backend serving up pages. For proof, simply look at the abundance of forum board, blog packages or just about any set of web site management software. It’s mostly all written for LAMP.

    Popularity doesn’t mean it’s a superior tool, I concede. But it is a tool that has many benefits:

    * Runs (at least most commonly) as a server module, far superior to CGI stuff.

    * Unlike Perl, where you need root access to effectively add on and enhance (yeah, I know you can setup libraries in your $HOME space…) PHP enabled many to build sites where they could get a cheap $2-$20 a month web hosting plan and SSH access (or FTP for the those that don’t fear the insecure nature of http://FTP...)

    * PHP OO is not real OO but as a scripting setup it’s suitable for most apps and a breeze compared to the rigamarole of Perl of blessing, @ISA, tiein, exporter, etc. …

    * Easy abstract data structures – many will cite this as a major fault, as it may be convoluted to do too much. Still, laying out structures with the untyped variables is a snap and makes for speedy development.

    * Easy to read code – there are PHP apps that are spaghetti but the ease of the language has granted folks not trained in the discipline of programming (a fault that I witness with Java and C++ developers too) . For someone like me who has written code in languages including BAL, C, COBOL, PL/1, REXX, and the newer ones. I can look at scripts I wrote 3 years ago and instantly comprehend program flow. Perl is similar but the default gizmos make me adjust for a little til I get the flow.

    I’m coming off here as a PHP fanboi – I’ve been using it since ’99 and while I hate just about all languages (in one form or another, they all are deficient and outdated…).

    Languages are just tools to express how you want to accomplish a computing task. They do influence how you think of the problem space, even if you do your damndest to separate the algorithms from the syntax. Me, I didn’t get to taste UNIX until about ’97 (being a old school dinosaur IBMer who cranked out COBOL and ISPF Dialog manager Panels with TSO CLIST). Man what an amazing tool set – I did all these things but due to the limitations in the tools I had to write a whole heck of a lot of code. Writing less code == means less code that will go faulty == less code to read == superior tool unless comprehension and readability are completely nullified…

  28. Well, it all depends on – what we state as “easy” – writing a cumbersome code, that looks ok, only after rendered to HTML in a browser, and hiring a personal shrink, after having to maintain this codebase for a year or so, or “wasting” reasonable amount of time on developing a rock-solid J2EE system and enjoying cup of coffee while your PHP friends subscribe for Prozac.

    But, seriously – it all depends, who is writing and what is s/he writing. J2EE is an “enterprise” system. For high-load, scalable system, I can not see, how PHP can be used, at all. For a BBoard serving local community <?=$user?> would probabely do much better than User curUser = UserFactory.createUser ( Constants.OVERCOMLICATED );

    Facts: PHP beats hard JSP, J2EE can do things PHP is just incapable of. Using right frameworks – J2EE development time can be significantly shortened.

    Conclusion: there’s nothing better in this world than a vacation on a sandy beach, and sunny, blue sky…

  29. “Lots of professional Java programmers emailed to say ‘If only those students had used Libraries X and Y, they would have done okay.” Sadly X and Y were never the same in any two emails'”

    There are plenty of ways to pronounce ‘tomato’, that is X and Y seemed different to you, since you are inexperienced with Java. Almost all the posts refered to ‘Struts’, ‘model 2’, ‘servlets’, and ‘MVC’. All those things refer to a framework.

    MVC, Model View Controller, refers to the theory of frameworks used by java web based applications. Model 2 refers to an early general technical specification of a web framework set by Sun. Finally, Struts is a real world, open source implementation of everything I just talked about. Struts utilizes servlets for its controller, JSPs for the view, and segregates data and business logic in the model segment of the framework architecture. Only novices and masochists cram all logic, control, and presentation together using only JSPs (ala Model 1) or other scripting languages – for large, complex projects.

    Again, it is really ignorant and stupid of you to judge something you obviously know nothing about. It is akin to me saying that using LISP for webbased applications is folly and a waste, when my experience with Lisp is limited by a semester course and some dinky class projects. Please, at least read about a subject in depth (or better yet – get some deeper experience with it) before you made stupid, baseless assumptions about it.

    If you weren’t a professor, I wouldn’t be so harsh….

  30. Hmmm… it seems as though there are a lot of Java experts in this thread. Maybe you guys can clear up a point of confusion for me (I’ve only developed a handful of Java-based Web apps and those were in the days before JDBC when you had to use proprietary app server APIs). One thing that we used to do back in the early 1980s when using Common Lisp Object System was create classes on the fly. For example, in a computer-aided engineering system if the user created a new kind of object in the real world our code would define a new subclass and proceed to create objects of that new class. How does one do this in Java? What kind of support is there for writing a Java program that writes a Java program and then compiles and executes it? All of this has to happen in response to a user’s mouse movement or keyboard command, i.e., in a few seconds.

    Similarly we would create procedures on the fly in a Common Lisp program, which would inherit the lexical environment of its creator, and then pass those procedures around to other programs. What mechanism does Java provide for this kind of abstraction?

    p.s. It is ironic that Struts should be mentioned. I ran into an expert Java developer today who’d seen the Slashdot piece. He said “It is funny that these guys are mentioning Struts and XSLT; they’re total nightmares” (he’d written his own tools for building server-side Web apps in Java).

  31. “One thing that we used to do back in the early 1980s when using Common Lisp Object System was create classes on the fly… How does one do this in Java?”

    hmmm, I’m not sure I fully understand your question since it’s been a while since I’ve seen Lisp but my guess would be ‘Reflection’ http://java.sun.com/docs/books/tutorial/reflect/index.html.
    I don’t know if you can create procedures on the fly – but you can dynamically call them using reflection…

    “It is ironic that Struts should be mentioned…they’re total nightmares”

    that’s an opinion… anyways my main point was that in order to take full advantage of Java on the web, you need to use a framework. There are many good java frameworks for web applications, but if someone doesn’t like any of them – they should feel free to build their own, re-inventing the wheel. Struts was mentioned because it’s the most popular framework, and it’s open. I think it’s a pretty good framework, but that’s my opinion. It’s only deficiency is probably giving more power to the view (Jsps), which should have minimal logic.

  32. oh yeah Dr Greenspun,

    I apologize for posting some rather harsh stuff, but just the thought you evangalizing the of use web scripting (that’s 5 times better than Java) for all web applications (especially enterprise applications) really made me angry. I don’t want a new generation of programmers creating garbage.

    You see I’ve had to clean up a good amount of those sphagetti nightmares that were developed rather quickly at some of our Fortune 500 clients. It’s good to remember that the main cost of a project is not development; it’s maintenance. (It gets even better when management believes the maintenance phase of spaghetti should be easier and faster than development, since ‘it’s already there and working’.)

    Sure, scripting languages are easy to learn and creating web applications with them is extremely rapid, while languages like Java have a much higher learning curve and development takes a bit longer…

    However when you have to deal with large commercial systems that need a certain level of scalability, and continual maintenance (new features, bug fixes) – using scripting languages as the primary development tool can skyrocket a web application’s cost in terms of delays and hard to kill bugs… This is when Java’s ‘complexity’ pays off

  33. oh yeah Dr Greenspun,

    I apologize for posting some rather harsh stuff, but just the thought you evangalizing the of use web scripting (that’s 5 times better than Java) for all web applications (especially enterprise applications) really made me angry. I don’t want a new generation of programmers creating garbage.

    You see I’ve had to clean up a good amount of those sphagetti nightmares that were developed rather quickly at some of our Fortune 500 clients. It’s good to remember that the main cost of a project is not development; it’s maintenance. (It gets even better when management believes the maintenance phase of spaghetti should be easier and faster than development, since ‘it’s already there and working’.)

    Sure, scripting languages are easy to learn and creating web applications with them is extremely rapid, while languages like Java have a much higher learning curve and development takes a bit longer…

    However when you have to deal with large commercial systems that need a certain level of scalability, and continual maintenance (new features, bug fixes) – using scripting languages as the primary development tool can skyrocket a web application’s cost in terms of delays and hard to kill bugs… This is when Java’s ‘complexity’ pays off

  34. Bottom line: The students in this practical class who used Java FAILED; the students who used C# or PHP succeeded.

    They may not be the best programmers in the world, but they’re reasonably bright 3rd year MIT undergrads with Java programming experience under their belts. The task before them was to create a useful, tasteful, real-world website. If some reasonably smart kids can’t figure out a problem which is typical of the vast majority of website building problems out there, there’s something wrong with Java the language/vm/apis/frameworks/whatever…

  35. > What kind of support is there for writing a Java program that writes a Java program and then compiles and executes it?

    1. Generate source and compile with sun.tools.javac.Main, maybe using some library like http://xdoclet.sourceforge.net/, http://www.kimbly.com/code/jatha/

    2. Generate bytecode (powerfull but not easy): http://jakarta.apache.org/bcel/manual.html

    > He said “It is funny that these guys are mentioning Struts and XSLT; they’re total nightmares” (he’d written his own tools for building server-side Web apps in Java).

    Lot of brilliant people work in Struts, Webwork, Tapestry, but he choose to write his own tools from scratch. Dont you know that 500,000 drug addicts cant be wrong?? 🙂

    > Similarly we would create procedures on the fly in a Common Lisp program

    It is not fair to talk about a language without a broad knowledge of it. Example, I dont know lisp but I could ask what support it provides for aspect http://eclipse.org/aspectj/

  36. The problem with approaches 1) and 2) is that you have to manipulate your program in terms of alien entities (strings or bytecodes) rather than using in-language concepts. Both approaches aren’t really unique to Java; you could generate .java or .class files from Perl, bash, or C++; hence it is fair to say that Java doesn’t provide any specific support for run-time modification.

    In contrast, there are languages around where easy program introspection and modification are parts of design. The more you try to apporach them in Java, the bigger chunks of them you essentially reimplementing. (sorry, couldn’t resist)

    > Example, I dont know lisp but I could ask what support it provides for aspect

    Gregor Kizales, the major figure behind AOP movement, coincidentially was one of the authors of Common Lisp Object System metaobject protocol. It has everything you want from AOP plus some more.

  37. Brian,

    Wouldn’t the design skills of the developer him/herself and the resulting datamodel be the biggest possible hurdle when it comes to maintenance of an application? Couldn’t it simply be the case that the ‘sphagetti nightmares’ you’ve had to clean up were simply produced by people with poor CS/SE skills? That is to say, they would have been Java nightmares had they used that language?

  38. “p.s. It is ironic that Struts should be mentioned. I ran into an expert Java developer today who’d seen the Slashdot piece. He said “It is funny that these guys are mentioning Struts and XSLT; they’re total nightmares” (he’d written his own tools for building server-side Web apps in Java).”

    What does “expert Java developer” mean? Struts is the best Model-View-Controller (Model2, the one for web) implementation, that there is, today. Model2 is Sun-approved and suggested design-pattern. So, it is very unclear how can “expert” Java developer be against the design pattern that is admited as the core approach for J2EE development by the creators of J2EE, itself? I beg you pardon, I am not an authorities-freak but it really does not seem clear for me.

    Even more – MVC, as most of you does not need to be told by me – is a very old design pattern, originating from Smalltalk and widely used in “desktop-programming” for long time, by now. It was just smart to extend it to WWW, nothing more, if you ask me…

    IMHO, the main reasons MIT students failed are:
    1) They misused the technology. J2EE is not implementing pages in JSP. JSP is only template-layer of JSP.
    Mr, Greenspun – what would happen, if somebody – in the ACS, with its TCL procs ADP/TCL pairs, custom tags etc., would just go on putting TCL snippets in ADP files directly? Would be “easier” – no doubt. Would it be better?
    2) Learning curve of J2EE is much steeper that that of PHP. Does not mean one is better than another.

    The experiment Mr. Greenspun mentioned is interesting but all it prooves is that – enterprise technology is not necessarily an easy one and students (bright or not) do not have enough time to 1) master it in short time 2) get proper experience, skill to know how to use it 3) implement some software system.

    But if you give me a professional J2EE programmer and a n experiences PHP developer and let me give them an enterprise-level task – I bet that Java programmer will long be gone for his/her cup of coffee, relaxing while PHP developer will still be looking for misused variable types.

    The arguement PHP vs Java (or any other, for that matter), is very popular, but for me – have had done both plenty (especially PHP, if honestly) – I think this arguement is more religious than rational. They are both valuable and they should both exist. Their scope of usage is, I beleive, somewhat different and professionals should know where to use which.

    Thank you

  39. Irakli: To me an “expert Java developer” is someone who has built real systems in Java that thousands of people use every day and that organizations continue to run and extend. Being 100% “Sun-approved” doesn’t necessarily qualify one as an expert. After all, adjusted for staff and budget, Sun is one of the world’s least successful software companies in terms of attracting users to its products. There are quite a few 10-programmer teams at Microsoft have more end-users than all of Sun. Not to mention the solo hacker heroes of the open-source world.

    I still haven’t seen an answer to my question (few comments up) about how to solve simple Lisp programming problems in Java. For example, most scientific programs written in Lisp will implement an algorithm generically, expecting their caller to create a procedure at runtime and pass it down to them to be applied. The procedure the caller creates has access to the local variables of the caller and its behavior is decided upon at creation time (i.e., run-time) according to the demands of the computation. How would you do this in Java?

  40. Sheesh, Phil, shouldn’t you have answered your own question? Since you insist, I’ll spell it out step-by-step:

    1. Download bigloo (Scheme->JVM) or Kawa (Scheme->JVM or a subset of CL->JVM).
    2. Write the program in Scheme or a subset of CL.
    3. Compile the program to JVM bytecodes.
    4. Use a Java decompiler to create Java source files.

    Voila! Java code that does exactly what you describe.

    What? That wasn’t the kind of answer you were looking for? You could have figured that one out yourself?

    OK, more seriously, I don’t think what you describe is possible. Maybe someone more up-to-date on Java can correct me, but the most promising tool in Java 1.1 for this kind of thing was local classes. These can have access to final variables (i.e. bound at compile time) in the scope of the block where they are created. I don’t think it’s possible to create a non-top-level class with access to the runtime-bound lexical variables of the block where it’s created. Any variables you wanted to use in this way would have to be explicit parameters, probably to a constructor for the local class.

  41. Dear Mr. Greenspun. I am not going to argue about Sun vs Microsoft. I am sure you can beat me in business analyses arguement. Neither am I going to argue about the skills of a person I don’t know. I was just trying to say that if one considers himself a professional J2EE (or maybe he is not j2ee? Java is a very broad term) developer – J2EE as a notion does imply usage of design patterns, first and most – Model2. Not necessarily – Struts, maybe – that’s up to one’s taste, but Model2 has to be used, to create a valid J2EE-complian web application. It is all I wanted to say.

    Regarding your question. You can do the same in Java. On the low-level you would spend some sleepless weeks using Java Reflection API, I imagine but in the real world, I would suggest to check those out
    http://jakarta.apache.org/bcel/
    http://cglib.sourceforge.net/

    Thank you

  42. Philip,

    I was following, and enjoying, the conversation just fine until you started asking how to write self-modifying code in Java. Maybe I missed something, but what the heck does that have to with the argument at hand? Seems like a red herring. Are you changing the subject? I thought we were talking about the ease, or lack thereof, of building a Web application with Java. Did someone assert somewhere that Java has all the great features of all the great languages?

    Whatever. I find the results of your class interesting, having made a profession of Java/J2EE development over the last few years. I’m mostly a business logic and framework guy, and not a JSP weenie.

    I’m not surprised at all by the results of your classroom assignment. But, in contrast to your conclusion, the conclusion I come to, when hearing that “Students in Philip Greenspun’s applied CS class did poorly when applying JSP/Java to a class assignment. Other students had success using other tools” is the following:

    “When inexperienced people attempt to build a project that doesn’t require many of the things for which Java/J2EE is best suited, Java doesn’t fare so well.”

    In your project, I’m not sure how important things like reuse, encapsulation, architectural separation, portability, etc were. I suspect not very. And of course, that’s fine. It’s a classroom, after all.

    If these things *had* been important, the students may not have acheived them with ANY of the tools. Why? Because it takes experience. But given experience, these things *can* be achieved with Java (and the .NET stuff, too). It’s questionable whether they can be acheived with a page-oriented template engine. (Of course, others responders have propped up PHP by mentioning frameworks that give it some or all of these capabilities, but wasn’t the need for external frameworks a complaint about Java?)

    I almost agree with a previous writer that Java/J2EE makes easy things hard (at least when doing a web app having (nearly) no experience), and hard things hard. Hey, hard things are hard, no matter what the language. That’s the way it is.

    Anyway, to finish with a couple of cliches: I think you’ve thrown the baby out with the bath water. And, “horses for courses”.

    BTW, I also do a bit of Ruby programming. I love dynamic, loosely typed languages. My weblog engine is written in Ruby. There’s no way I’d use Java for it — way too much tool and trouble for the job (maybe a lesson in there?). However, I’m not sure I’d use Ruby (yet) to build a multi-million dollar large-scale distributed system.

  43. Irakli,

    if you’re interested I wrote some stuff about Struts and MVC 2 some time ago. Here

    But my Java question still remains. Yes, there is a scale of enterprise software beyond which the extra discipline demanded by Java / J2EE is essential, over and above smart, trained software engineers using a scripting solutions (and maybe a toolkit of XP disciplines like refactoring, code cleaning, pair programming etc.)

    But I guess that that barrier is very high. Maybe less than 1% of web applications require it. So why should anyone but a few specialists adopt Java and work with it’s overhead?

  44. The sort of self-modifying code described by Philip generally offends the java security model, although, as several have pointed out, there are ways to achieve the desired functionality.

    We’re all reading a lot recently about some great non-java examples of what’s described – they’re generally referred to as worms 🙂

    Really, though, aren’t we further obfuscating the original issue? Is anyone suggesting the PHP is better than java for this sort of dynamism?

    Picking the right tool for the job is key. If I’m trying to plant a petunia, a trowel is good. If I’m trying to clear space for an office building, I might look at a bulldozer. Either would conceivably work in either situation, but it’s not particularly helpful to conflate the issues in order to arrive at a disparaging comparison between trowels and bulldozers.

  45. This is a very interesting, insightful discussion.

    There are engineers who solve problems, and there are engineers who build solutions based on problems other people solved. Perhaps the Java crowd is somewhere lost in the midst of this…

    I don’t think Java is entirely to blame for the failure of your Java project group. For some, Java is a lot easier to use and faster, because they’ve overcome the complexity of the language. However, overcoming this complexity serves no purpose of educating the learnee of where the real problem is. Where is the computer science in this never-ending self-extending API? Why not use something simpler and get the job done faster, the out-of-box way of managing complexity.

  46. Phillip,

    I guess a lot depends by what you mean by “on-the-fly”. How are these new objects and methods/procedures defined and what is the method of communication to CLOS process for defining subclasses?

    As other here have said, while it isn’t a built-in Official Feature, you may be able to do something like it using Reflection. Precisely how easy it is to mimic CLOS’s functionality depends on the mechanics of how CLOS’s funtionality works. It’s something that most people don’t think to do (or haven’t thought to do since college), so it’s hard to give an accurate answer (without knowing more details).

  47. Bama Boy: how do you do it in Common Lisp? An already-defined procedure can create a string starting with “(defclass new-class-name…” and then feed it to “eval”. After that an instance of the new class can be created via the same mechanisms that create instances of classes that were defined when the application started up (i.e., there is no distinction between classes that were predefined and those that are defined on-the-fly).

    Unnamed asker about why this is relevant to the PHP v. Java question: It isn’t of course! The students have already demonstrated statistically that scripting languages are more productive for straightforward problems (gluing the RDBMS to the browser). We’re working the other side of the Java=SUV equation and trying to figure out if Java is in fact good for solving difficult problems in computing or if, like the SUV, you need to get out a tracked vehicle when the going gets truly rough (the traditional tanks of computer science being Lisp variants).

  48. I just noticed Ferdinand’s comment about PHP vs JSP. It is irrelevant, of course but, just for fun, the truth is:
    <%= “Hello World” %> <!– This is PHP with “ASP-like tags support” –>
    <%= “Hello World” %> <!– This is JSP –>

    🙂

  49. Philip, excuse me for changing the subject, but why in heaven’s name would you create a string with defclass and then feed it to eval? Using eval explicitly means you have made a mistake 99% of the time (see the comp.lang.lisp FAQ for more details). To create a class on the fly, you really should make a macro that creates the required defclass form.

    Back on topic: I argued the merits of Common Lisp with Java programmers many times. True enough, I do not know Lisp well enough to outright win the arguments. To everything I could think of that I love in Lisp—closures, CLOS, the ability to dynamically alter running code—they would say, “but you can do it in Java.” (By “do it” they really meant “emulate it with various tricks with inner classes,” since Java does not have closures.) Do you want to create a class on the fly? Sure, you can use reflection or, better yet, generate the source code to a file and then call System.exec(“javac DynamicClass.java”). (That suggestion came up in a comparison to C++ on comp.lang.lisp.) Yeah, it’s more work in Java, but you can do it. To which I would usually reply that you can program on a classic single-tape Turing machine, too.

    It does come down to ease of doing what you want in a programming language, to expressiveness. It comes down to the ability to sit down and work with a read-eval-print loop, to write and edit code and have it immediately compiled in on a per-function or per-class basis rather than on a per-translation unit basis. It comes down to the ability to debug code instantaneously, instead of having to rebuild files, or run make. It comes down to not having to stop Tomcat, delete its cache of compiled JSPs, and restarting it—a matter of several minutes for a non-trivial application—just to test a one-line change.

    Java can be and is used to write and deploy huge applications. To address the argument of counting “?” symbols in CompiledStatements that has come up in this thread, I can only recommend writing a procedure that takes the parameters that need to map to “?” as an array of Objects and then use reflection to build the SQL query—I did this in a Java project I finished last month, and it worked perfectly, and saved my team lots of time. So the argument goes nowhere. I think learned to code at that level of abstraction because I learned Lisp and its encouragement of extending the language to solve the problem at hand, and I applied what I know to Java.

    I have been trying to make the ponit that Java is a cumbersome language. Sure, it discourages spaghetti design that PHP and other scripting languages usually breed. Last year, I spent two months on a project to convert a Perl CGI web application to a Struts framework application. The CGI was terrible to maintain, and the Java version was easier. In my experience, which, granted, consists of no large Lisp projects, Lisp gives the best of all worlds: the fast prototyping of scripting, the easy maintainability of Java, and the performance of native code. Of course, the latter two do require some skill and discipline on the part of the Lisp programmer.

  50. re: Java vs. Lisp. I’m a former Lisp hacker, on Lisp machines in
    mid/late 80s, and on unix back at cmu before, and although i definitely
    prefer the simple syntax and resulting ease of dynamic code creation.
    However although java is not as convenient (i miss macros, etc), there
    are some ways to do certain lisp-like things using Java, which can
    dynamically load new classes, see below. and
    re: environment, I would suggest using an IDE like eclipse which compares
    favorably (though still not quite up to lisp quality 🙂 ) to the
    symbolics/emacs dev environment, with the various integrated browsers and
    navigation easily through references to definitions, etc, refactoring of
    code support is better, integrated pop up doc describing methods and
    args, incremental compilation, and of course the whole emacs-info like
    hyperlinked and browsable javadoc descriptions of classes through a browser.
    (granted it lacks a full-emacs integration, simply emacs-lite vs. real
    emacs. there is also a dev environment for java based in emacs).

    It is possible to simply create a new .java source file on the fly,
    invoke the compiler, and then load the resulting class file dynamically
    (or re-load a new definition of a class this way),
    although thats not commonly done. There is at least one
    library which provides a small footprint in memory compiler to let you
    simply pass in java text and get it compiled to bytecodes without the
    file step (and allowing you to modify existing class definitions, modifying
    their bytecode).

    re:
    >For example, most scientific programs written in Lisp will implement an
    >algorithm generically, expecting their caller to create a procedure at
    >runtime and pass it down to them to be applied. The procedure the caller
    > creates has access to the local variables of the caller

    I’m picturing this as being like the anonymous lampda function you might
    pass to a mapcar, or a compare algorithm to a sort function.
    In java you would define a generic interface that specifies what the function
    is that will be called by the algorithm, ie:

    public interface Compare {
    public int compare(Value val1,Value, val2);
    }

    then you can create a local anonymous lexically closed class,
    for example passing
    in a list, and a bag of generic list algorithms which operate on any
    type which is defined as providing a “List” interface:

    final int gratuitousInstVar = 42;

    public List doSort(List foo, ListAlgorithms listAlgs, final boolean sortOrder)
    {
    final int meaninglessLocal = random(42);
    return listAlgs.sort(foo,new Compare () {
    public int compare(Value val1,Value, val2) {
    return complicatedCompare(val1,val2,sortOrder,
    gratuitousInstVar,
    meaninglessLocal);
    });
    }

    The local class has access to final instance variables, parameters, local
    variables.
    foo might be implemented as a linkedList, array, etc. you might use one
    bag of algorithms using search algorithm A, another time use algorithm B.
    The syntax is more verbose than lisp, and obviously doesn’t use dynamic
    compilation of the code.

    There are various interesting features of java, like dynamic proxies,
    custom class loading, other things which can be of interest to those with
    lisp-like mindsets. (even while still prefering lisp, the wide support
    of the java bytecodes and gui libraries, etc, make java more practically
    relevant. so i’d be interested in hearing about any common-lisps built
    on java bytecodes).

    Java can also, like C++, be compiled down to machine code (or C) vs.
    just on the fly compilation using the gnu java compiler, or commercial
    products, and eliminate the need to a java environment to run the binary.
    (both from .java source, as well as from byte code .class files (which
    could be generated by a common-lisp)).

  51. Constantine: I’m not sure that I’ve written too much Lisp code that calls eval explicitly but it is the conceptually simplest way to explain how to do anything at runtime that is possible at compile time.

    Former Lisp Hacker: Thanks for the education. It sounds like there is no escape from the verbosity of Java for accomplishing 6.001 problem sets but maybe one need not go all the way back to Turing tape emulation!

  52. sorry about formatting in previous post, pasted in
    from emacs under windows, don’t feel like further figuring
    out bugs/features in this comment thing.(i tried to
    post before without having created an account or logged in, and received no error message indicating that my post hadn’t gone through (or was submitted for review being anonymous, etc). i’m guessing the comment setup wasnt’ done by a java engineer? 🙂

  53. Part of the reason I am an efficient developer is that I don’t spend hours and hours debating “tool choice” and the relative merits of Java and Lisp and C# and PHP and Perl/CGI VB.Net. I already know that I am going to use C# and .Net because they are the tools with which I am most effective, and there is no business problem that can’t be solved in .Net but that can be solved in Java.

    (This is also why Philip’s company ArsDigita was also so effective – it knew it was going to use Tcl / AOLServer so it didn’t have to waste time discussing the relative merits of different platforms with clients).

    But to play the game for a moment: keep in mind that the goal of 6.171 is for students to be able to develop something like Amazon (“”build me amazon.com by yourself in three months” quoted from here). What Philip tells us is that MIT seniors and graduate students are not able to achieve the “amazon in three months” goal using Java (even though they have just completed a semester-long Java course), while those that use other technologies (apparently .Net/C# and PHP/MySQL) are able to achieve it.

    I don’t see how Java is any more appropriate for “enterprise applications” and “scalibility” than Lisp that was used to develop Orbitz (a huge volume site that is more responsive in performance terms than any other site I’ve seen) or the Perl tools used on Slashdot (which gets a LOT of traffic) or the custom C scripts used to develop Google.

    And finally, C# seems to do everything that Java does, without the spectacular complexity and (often) fanatic programmers.

  54. Alex Campbell:

    >there is no business problem that can’t be >solved in .Net but that can be solved in Java.

    Care to make a bet on that? There are very few absolutes in the world. 🙂

  55. “Wouldn’t the design skills of the developer him/herself and the resulting datamodel be the biggest possible hurdle when it comes to maintenance of an application? Couldn’t it simply be the case that the ‘sphagetti nightmares’ you’ve had to clean up were simply produced by people with poor CS/SE skills? That is to say, they would have been Java nightmares had they used that language?”

    hmm the best analogy I have is when you’re using Java (or .NET) with a framework for web programming, it’s like bowling with the side gutters blocked. Yes, it still takes some skill to get a strike or spare, but it’s a hell of a lot easier knocking down pins (even when the bowler has limited skill).

  56. re: the students who used java in the class struggling and dropping
    out. I’m not sure that there is enough info to draw any real conclusion
    from that. Is it possible perhaps that even unintentionally, the
    instructor’s bias away from java may have influenced the choice of
    material and resources presented and lectured on (even if attempting to keep the talk platform independent) in a way that gave an advantage to the other groups? The architecture
    of the system might be different if done in java and hence perhaps
    even the choice of assignments, and the ordering of same (in terms of what
    the students chose to think about first re: the design) may have been
    biased in favor of other approaches.

    In addition i’d be curious as to the quality of the students in that
    java group vs. the other groups, what sort of selection bias factors
    there may have been. Not knowing the current culture among tech undergrads,
    I don’t know if some of the sharper (but inexperienced 🙂 )
    ones drift towards the currently trendy “cool” tools like php, perhaps
    having played with it prior to the class, or if perhaps these days many
    software types start out using PCs with microsoft tools and hence might
    drift towards what they are familiar live, leaving the less precocious
    types to the java group? (and those who know what they are doing :-), but
    it sounds like in this case there weren’t any of those).

    I suspect that some of us are simply surprised, knowing how
    straightforward basic java and tools like jdbc/jdo and jsp are, that
    mit quality students would have more difficulty with those than with
    the other approaches. shocked actually. it’d be interesting if any
    of the students were willing to comment on their difficulties publicly.

    re: the SUV aspects of java, if the size of it is part of that reference,
    then of course it needs to be compared to the true size of the toolkits
    used by the other languages, which tend to include the various standard
    unix or windows libraries, or their own internal large libraries. re:
    speed, for the most part java is quite a bit faster than it was initially,
    and some people are holding onto old biases. (some of which of course are
    the same sort of biases people have against lisp 🙂 re: its dynamic nature.
    though the major thing i think that worked against lisp
    was the silly complaints people had about too many parens, vs. basking
    in the simple elegance of the structure 🙂 ).

    re: some people noting that they should have “used library X and Y”, etc.,
    and the comment that they didn’t have months to discover the right libraries.
    Not knowing what they used, it may be that they made the mistake of
    thinking the problem was more difficult than it was and hence being drawn
    into toolsets like j2ee which may be overkill (or overbloat some of us think
    🙂 ) for the task at hand. If so, if they hadn’t fallen for the siren song
    of some toolkit may have discovered it not that difficult to do with
    the basic standard edition java tools, like JDBC (or i’d actually
    suggest the new JDO standard for simple things, which easily allows transparent persistence of classes initially (which can be optimized where/if needed
    to use JDBC and straight SQL instead) even without a template
    engine. The immediate template engine they would run across if they
    chose to use one would be JSP, which is fairly trivial to use, and easy
    to plug in references to java code that deals with the DB. I constantly
    lately, while doing more in java than i’ve done in the past,
    have been punting on inadequate third party
    tools and redoing things myself, would have been faster to do so initially.

    re: “no escape from the verbosity of Java”, if you use an IDE
    like eclipse (from eclipse.org), it’ll take care of some of
    the verbosity for you with commants like “organize imports” which will
    go and find any imports required by the class you created, and menu
    commands to insert method stubs for all methods defined in an interface,
    and you can define emacs-abbrev style inserts (and templates), etc.
    there is a free third party plug (listed on the plugins sites) that’ll
    do better emacs style indenting in the emacs-lite editor.

    I suspect that some of your
    info may be out of date (i remember glancing at your online course docs/
    notes a few months ago (seeking out info to get someone else pointed in the right direction re: ecommerce stuff) and seeing out of date biases
    against mysql, and i think (though not sure) postgresql,
    in favor of oracle (which is often overkill or not
    appropriate business wise due to expense), when some
    of the missing features can be taken care of in a level
    of code above those DBs. (re: some logging and replication issues, etc). sorry for the digression, don’t have time
    now to dredge up the issues i had with the online docs (right on target in some ways i remember, though i seem
    to recall, perhaps wrongly, too great a willingness also
    to go for bigger boxes vs. better architecture to avoid
    the need, if i have time i’ll track down the reference
    later and forward on a couple of papers by system
    architects pointing out ways to address the issues
    (which i don’t remember) differently). sorry for the
    tangent to this thread.

  57. The course staff biased in favor of PHP over Java? Sorry but any of us would have chosen Java over PHP for ourselves, mostly due to a horror of amateur-designed computer languages. If you look at http://philip.greenspun.com/teaching/6171/2003-fall/calendar you’ll see that hardly any of the class time is taken up with lectures and all of the lecture material is related to the user experience or the internal workings of the RDBMS (as a measure of our influence all of our lectures demonstrate Oracle and nearly all the students chose to use MSFT SQL Server or PostgreSQL). MIT class time is too precious to devote to looking at glue code.

    I’m beginning to lose respect for Former Lisp Hacker when he says that our textbook’s recommendation against MySQL is out of date. It seems to be true that the MySQL guys recently discovered transactions but MySQL, last I checked, doesn’t support views, which are the primary means of abstraction in the RDBMS world. The students would not be able to complete Problem Set 1 in MySQL due to this lack of views. We’re not ashamed of recommending Oracle. A full version can be downloaded 24/7 from http://www.oracle.com and used for immediate development. Oracle runs on nearly every operating system. A student who learns how to use Oracle will be able to use the same tool on every application he or she develops for the rest of his or her professional career. A student who is an experienced Oracle developer will give interviewers a feeling of comfort during a job search. And more to the point… unlike with Java, students who’ve chosen to use Oracle are able to get the work of the class done on time.

    If you were a corporate middle manager would you rather hire an open-source enthusiast who has built stuff with Ruby and MySQL or a 6.171 graduate who has used C#, the .NET tools, and SQL Server? Paying Microsoft a license fee is annoying but any firm that has enough money to pay an MIT graduate a First World salary has enough money to pay their tax to Bill Gates. Ditto for Oracle. If a company really needed to save money on IT it would be more effective to outsource all the jobs to India than to switch from Oracle to whatever else.

  58. Philip,

    First I would like to thank your for you all the articles you have written over the years, many of which I have used in building my website.

    As far as your argument that Java is too complex I can understand why you might say that. First, Java is an object-oriented language. Being an OO language it has a significantly higher learning curve than that of a structural language such as C. And you could say that a structural programming language has a higher learning curve than a scripting language such as PHP. So the problems you are seeing in your class are understandable and expected.

    So what good is an OO language and why would anyone want to use one? Well, OO languages were developed primarily to manage the complexity in large computer programs. C++, an OO language, was developed by AT&T to manage the complexity in the large and complex telecommunications programs. One of the greatest misconceptions about OO languages is that they are a lot easier to use than structural and/or scripting languages. The truth is that it takes a lot more time to setup a project using an OO language such as Java or C++. The savings come when the system becomes very large and you are required make a change or add new features.

    So even though I am a very experienced Java programmer I would probably choose to use PHP or something similar if I were in your one semester course and were writing your assigned project. But, if I were writing a large program for a company or mission critical application then I would choose an OO languague.

  59. Personally, I’m appalled by the way Philip tries to deter the heat from his original assertions about Java vs. <rest of the world>. If I looked long and hard enough I could probably find some feature of a language I might or might not use in the real world which is not to be found in the target language. Heck, I can even name a less obscure feature right of the bat which wasn’t available in Java for a while until someone decided to write an API for it: Regular Expression support? Does that mean awk and sed are superior over Java. Sure, they are for their intended use. Of course you can also do web scripting in awk, just as you probably can in lisp…question is: why bother? There are better tools.

    Consider this, if Lisp was all that great and superior over anything else, maybe you should have told your students to do their project in Lisp and Oracle, not freely choose their own tools. Maybe then they would have learned more about how to write software, instead of moaning about the chosen tools. Seems to me that your MIT students took the opportunity to do a “learn on the job” for the tools, instead of doing what they’re supposed to be doing: deliver a product. Seen it happen in the wild too. All those projects failed. Miserably.

    Personally, I’d expect more and better of an MIT proffessor….OTOH, most of the teachers I had (I won’t claim to have had professors since I’m only a measely MSc equivalent) weren’t actually known to be all that “Real World” minded…and don’t bother pointing me to your resume. Seen it.

  60. PG: “If you were a corporate middle manager would you rather hire an open-source enthusiast who has built stuff with Ruby and MySQL or a 6.171 graduate who has used C#, the .NET tools, and SQL Server?”

    Depends on the rest of the resume, but honestly…as it looks now the first would have a better chance. Enthusiasts have the desirable characteristic to work with what’s available, and get productive fast. Your MIT graduate would start to whine about not having a whole microsoft infrastructure at their expense, and expect it to get fixed because…well he’s the MIT student. Kind of like how your MIT students now decide in the middle of a project to switch tools (and duplicate all the effort they put in already) just because…well, they don’t have the expertise and flexibility to cope with the chosen tools. Suppose as a coporate middle manager I’d have told my fresh out of MIT graduate to build the same website in J2EE again? Would they demand me to throw away my expensive Websphere infrastructure and oracle database just so they can develop in PHP and postgres?

    But hey, I’m not a middle manager, I’m the enthousiast. I’m biased by design.

    PG: “Paying Microsoft a license fee is annoying but any firm that has enough money to pay an MIT graduate a First World salary has enough money to pay their tax to Bill Gates. Ditto for Oracle. If a company really needed to save money on IT it would be more effective to outsource all the jobs to India than to switch from Oracle to whatever else.”

    Where did expense come into this whole discussion again? You might manage to rattle the cages of some slashdot devotees with this kind of commentary, but I wonder what it adds to the discussion at hand.
    If I were a shareholder of a company I’d rather wonder why money is spent on overkill rather than landing in my pocket as profit. Most of the time, using heavy duty databases like Oracle is, in fact overkill. Maybe companies are outsourcing to India because people there are still prepared to do the grunt work the Sillicon Valley gurus deem themselves to good for? Working life isn’t made up of cool projects only and endlessly funded upstarts with play rooms and workplace massages. How badly we’d like it to be that way. The answer to Sillicon Valley’s problem lies in mentality. Not money. IMHO.

    (substitute “he” for “she” where applicable, substitute “Silicon Valley” for “Random high tech hotspot” where applicable)

  61. “If you were a corporate middle manager would you rather hire an open-source enthusiast who has built stuff with Ruby and MySQL or a 6.171 graduate who has used C#, the .NET tools, and SQL Server?”

    If I were a corporate middle manager, I wouldn’t be looking at this at all, even though the number of years matters. I’d pick the guy who knows how to kiss my ass better. Because the bottom line is code gluing is so easy to do I’d expect anybody with 3/5+ years experience do a decent enough job that’ll work under my leadership.

    Hiring engineers is different from buying a solution.

  62. Ferdinand, in answer to your question, “Why bother doing web hacking in Lisp?”, the reason why I’m doing it today is because my employer wants an enhancement to an application central to the work of the Equity Research department. Since the rest of the web interface is in Scheme (a Lisp variant), it would be silly for me to do today’s web hacking in anything else.

  63. “I’m picturing this as being like the anonymous lampda function you might pass to a mapcar, or a compare algorithm to a sort function. In java you would define a generic interface that specifies what the function is that will be called by the algorithm, ie:

    public interface Compare { public int compare(Value val1,Value, val2); }

    then you can create a local anonymous lexically closed class, for example passing in a list, and a bag of generic list algorithms which operate on any type which is defined as providing a “List” interface:

    final int gratuitousInstVar = 42;

    public List doSort(List foo, ListAlgorithms listAlgs, final boolean sortOrder) { final int meaninglessLocal = random(42); return listAlgs.sort(foo,new Compare () { public int compare(Value val1,Value, val2) { return complicatedCompare(val1,val2,sortOrder, gratuitousInstVar, meaninglessLocal); }); }”

    You completely missed the point. This is funny.

  64. Bruce,

    I’m not saying it’s impossible or something. Best tool for the job at hand, etc, I’m all for it. But for doing a webbased project from scratch…it wouldn’t by my first choice. But then again, I’m not educated in IT, I never “had” to learn and work with the classic languages (scheme, lisp, etc). I taught myself some perl, some java, some php and even some C, and I keep forgetting how to use them, so each time I have to reteach myself everything. I also taught myself how to utilize xml and xsl in web applications (my personal website is built using xml, xsl and jsp..as experiment). Maybe I’ll teach myself ruby, lisp and scheme someday too. But without a good enough reason, I doubt it. Maybe unjustified, but languages like lisp don’t seem to me the default tools of choice to develop web applications in…basically, just because noone else does either, barring a few desperate oldtimers who long for times long past 🙂 (fun intended, no flame bait, don’t get your tail in a knot over it!</disclaimer>).

  65. Joe: If the field variable must be final, doesn’t that mean its value may be computed at compile time? It’s a variable that doesn’t vary. Not nearly as useful as a non-final variable.

    Ferdinand: I wasn’t looking for an excuse to use Scheme. It just presented itself as the best solution to the problem. Details at this URL:

    http://brl.codesimply.net/brl_7.html#SEC74

    I long ago stopped getting my tail in a knot over the vast herd of programmers who won’t try a superior tool simply because they don’t see a lot of other people using it. My new attitude is, if you can’t get them to join you, beat them.

    It has mostly stopped bothering me that Phil Greenspun ignores BRL. At first I attributed it to his desire to avoid untried, possibly unstable technologies. But BRL has been around long enough now to eliminate that issue. Perhaps Phil’s bad experiences with Java turned him off to anything JVM-based, even if it isn’t the Java language. Perhaps it’s the whole “languages don’t matter” idea when you’re painting a web interface over the steel and concrete of your RDBMS. However, this year’s 6.171 class discovered that some kinds of paint are easier to work with than others.

  66. Bruce,

    I wasn’t trying to say you shouldn’t use what you want and like to use. Honestly, I never heard of BRL before you mentioned it. That might be something to blame on me, but I do get around on the internet plenty to have picked up at least some new developments. Or it could be that the developer and userbase of BRL is still so small that for now it doesn’t make much of a dent in the more “established” fortress of usual suspects for web designing and scripting. Personally, I haven’t seen an O’Reilly book about it yet, and as cheesy as that might sound…it is somewhat of a standard to judge established technology by.

    As for Philip Greenspun not wanting to recognise BRL. I’m sure he has his reasoning for that. Probably similar to the reasoning for not spending much time to the plethora of other languages and products around. You can’t keep up with everything around, even if it matches the problem space you’re trying to find a solution for exactly. Too much to do, too little time to do it in. Deadlines suck.

    It might be very appealing to make the database do most of the work for a web application. From an amateur viewpoint, I’d say that will only pollute the database with obscure snippets of stored procedures and random views to present data neatly to a web engine. It leaves a mess for the DBA’er to document and maintain. It might be nice if the web developer is also DBA for the database (lucky students), and can do what he wants in it, but usually those responsibilities are delegated to different people. And it’s a known problem that administrators and developers have …issues getting along. Mostly because the DBA doesn’t want a web jockey messing about in his database, and the web jockey doesn’t want the DBA to play road block, obstructing the progress of his pet project…but anyway, I digress. Luckily my vacation is over soon, so I can get back to work. No more trolling on forums.

  67. Even after having written ten thousand lines of something, a student keeps a student. You should compare the performance of well-trained persones, that used their PLATFORM for years. The you’ll see that Java people take over PHP and Microsoft guys. This is what I experienced in the past six years teaching and doing Java and C++. Java-The-Platform is very complex to learn, more complex than most other platforms. You cannot learn it in ten thousand lines. But when you learned it, it easens many jobs. Actually the RoI of introduction of Java into a project is FAR BEHIND (!) the RoI of PHP or C++, but the TCO of Java measured over ten projects but not only one is much slower.
    This means, you need years to learn it. In that yours you only invest in Java. There is no return. But after years you get a return that is many times the return of C++ of PHP. So actually this all is only a problem of what time scope you are measureing.

  68. I think Markus expressed very well a Java developer’s position regarding the subject. It takes years of experience, not a semester-class to prove a point.

    To: Robert Johnson,
    PHP also has classes and objects and literate PHP programmers do use them, as well as templating system (e.g. Smarty) instead of “scripting” inside the HTML – it is already well-proven to be an unproductive way. As for the complexity of OO: I do not agree. It is not hard to understand OO. After all – it is a mimic of real-world vs linear programming which requires more of pure algorithmic approach, hence more specialised mindset. I may be speculating a little bit here, but OO is not hard to understand! It may only be harder to switch mindset to OO when used to program the other way around. But even so, Philip clearly said that students were using JSP, which is not much different from scripting as far as developer is concerned. Who cares if it is then converted to a servlet? Not those students, I bet, or they would not have done pure-JSP implementation, in the first place.

    I think this thread is becoming a little bit too religious…

  69. It’s obvious the ASP.Net folks used VS.Net and MS tools (only one real choice).
    Dunno what PHP folks used.
    Dunno what the J2EE folks used.

    Or did everyone use DreamWeaver to take the language out of the equation? 🙂

    I’m surprised how many people are just lambasting the original blog entry w/o asking for more details on what the scenario was and what the students had problems with…

  70. Would some Java advocate please point me to one high-end millions of users “enterprise” application on the web that is actually written in Java using J2EE? I’ve never seen one.

    I’ve seen lots of dog slow content applications running JSPs, and I’ve seen J2EE testbeds that get Slashdotted, but I have never seen the high-load scalable Java apps in the real world. It all seems to be marketing hype by Sun, that Java is somehow more inherently Scalable, when indeed, there is nothing about the language or the platform that proves that. In fact, the first version of the EJB architecture could not be shipped.

    Someone please show me how this language, designed for toasters, makes for great Enterprise work, And show me using a real example.

    BTW, your real world examples for scripting languages scaling to meet real world demands: Amazon, Yahoo, Google, Slashdot, etc. etc.

  71. Jack, we were mostly discussing PHP, ASP, J2EE here.
    Amazon, Yahoo and Google are using custom-built software technologies, so mentioning them here is not exactly relevant, IMHO.
    I will help you – Western Union is really using ASP, microsoft.com is, msn.com is…

    Here’s a quick list of large sites using J2EE, you sure you have never seen any of them? 🙂
    http://www.excite.com
    http://www.sun.com
    http://www.oracle.com
    http://www.visa.com
    http://www.theserverside.com
    http://www.schwab.com

    Want more?

  72. Yahoo is on PHP, thank you very much. Besides I believe the conversation had moved into scripting languages versus J2EE, where ‘scripters’ were being categorized as amateur or hobbyist. Both Google and Amazon make extensive use of Perl both on the site and behind the scenes. All of these sites are far beyond the traffic of those you listed. So if those are ‘hobbyists’ then I suppose that hobbyists run the most popular sites on the web.

    It’s interesting you mention Oracle as they just recently added PHP support to their application server suite.

    If we restrict the definition of J2EE to EJB and not include use JSP calling JDBC direct, which is technically part of the standard but is not exactly Sun’s ‘Enterprise Architecture’. Is there anyone using J2EE in the list of the popular sites?

    Recently I heard Sun make a claim that 95% of the sites on the web use Java. How is that claim justified? NetCraft doesn’t show anything near that.

  73. In addition it is of interest that Yahoo changed architectures in the past couple of years, evaluated Java (around the time of EJB 1.0) versus PHP, and picked PHP. Yahoo picked PHP conciously. I would be interested in your response to that.

    The reality is that the history of Java is a litany of failure. It never worked on toasters. So they tried Applets. Now if you read “Bitter Java” Applets are listed as an anti-pattern. So they tried the desktop with Swing, and NOBODY shipped any of that. The only shipping Swing apps are Java IDEs.

    So they tried the Web Server, and have basically hyped that to the point where they showed a perceived success. Sun was talking about Java ‘Enterprise Applications’ on the server when there was no justification or history behind it. Publishing white papers that said that Java scaled better than PHP when there was no evidence to support that, and when in fact, it was quite the contrary in reality.

    Now that Microsoft has come along with .NET you see Sun trying to swing the Java community back to being interested in mobile devices. So this optimal ‘enterprise language’ is now the best for small ‘mobile computing’ applications and games programming.

    We have come full circle! This toaster language grew wings and became an amazing enterprise applications language, but then back to being a toaster language. Without ever making substantive changes to syntax! Quite amazing.

    Seriously. You can’t just go around quoting the Sun Java hype machine and spouting their silliness about being scalable, or being the ‘optimal enterprise application development environment’, or the language being capable of doing things other languages just can’t. It’s all just hype and as engineers we should look past the hype and work on FACTS. We owe that much to our customers.

  74. Jack, I am sorry but you are speculating now.

    You begin with the statement “Yahoo is on PHP”, which is populistic. Yahoo IS NOT on PHP. Their kernel is still running whatever they used to. What they did – they decided to begin using PHP in developing some new services. Here’s the explanation of why they did it: http://public.yahoo.com/~radwin/talks/yahoo-phpcon2002.htm and it looks to me that the primary reasoning was “time to market”. PHP allows much faster development, in some cases. They never said it is more managable, scalable or whatever.

    Regarding Applets – I, personally, do not like them, much, but in case you forgot – games.yahoo.com is entirely based on Java Applets. So, it strikes me Yahoo uses more Java Applets than PHP in their code, measure by percentage, so far?

    So what? it is no argument.

    Regarding who has more traffic: beleive me – the sites I mentioned do have enough traffic to say if the technology they use is enterprise-level or not. What you were arguing was exactly that – there’s no evidence that Java is really “enterprise-level”, or you surely sounded like that.

    You also mentioned Java applications in context of being a failure? Funny, is not it that Zend Studio – the ultimate IDE for PHP (written by PHP creators!!!) is a Java application?

    So is the whole frontend part of Oracle database, not mentioning that Oracle also allows to write Java extensions, and only in Java.

    Re: PHP. I can not comment on other people, but I never said PHP is for ‘hobbyists’ and I actually run an open-source project on PHP http://www.penub.com, so – no, sir – not me 🙂

    And last – EJB has problems with performance. A lot of professional “Javaists” will admit it. But, neverthless, IMHO it is still the best there is for what it does. It is up to a literate software architect to decide when to use it and when not and how much of it to use.

    I am J2EE designer for the kernel of http://www.digijava.org and when we were begining it – we saw a lot of buzz about similiar project – Liferay. Even though it looked nice, we decided not to use it, because it is 100% pure EJB-based. The architect of Liferay thinks it is a big plus, he even has that on the fronpage of his website. We decided it is not. Because, for our system, we expect a lot of load and user-traffic and EJBs can be slow.

    I think a lot of Java guys realize there’s problem in EJB technology and I do expect to see new offering or fine-tuned version, if possible, in the future. But J2EE is not necessarily EJB-based, and I do not know why you are mentioning EJBs again and again.

    Thank you

  75. One more thing, for those who are too lazy to follow the link, I posted above, which explains Yahoo’s decision about PHP. Look what it says about “Why not JSP, Servlets or J2EE”:

  76. One more thing, for those who are too lazy to follow the link, I posted above, which explains Yahoo’s decision about PHP. Look what it says about “Why not JSP, Servlets or J2EE”:

    Pros

    strongly typed

    good performance (JIT), sandboxing

    works w/lots of off-the-shelf software

    But

  77. This “what is and what is not J2EE” nonsense is what makes pinning down the Java issues do difficult. Just as Philip originally pointed out. You ask 100 “Java Programmers” about this architecture or that and why this or that project failed and you will get answers like; “They were using component foo? Those fools, or course it failed.” or “You can’t use EJB and J2EE in the same sentence together. They are not the same thing.” or hundreds of other excuses. Excuses for Java projects failing, which is very troubling.

    I talk to “Java Programmers” and “architects” in interviews who prattle on with things like “We ran out of money before we could finish” or “It went on for a couple of years but never shipped.” There are too many stories of Java failures. Heck, this very article is about Java failure: “The last two students using Java dropped 6.171.”.

    PHP projects ship. Perl projects ship. Python projects ship. ASP projects ship. They may have maintainability problems, but all software, including Java software does, and having a program is a lot better than not.

    Java complexity, particularly the proliferation of standards, the reliance on distributed architectures, caching, and threading, is choking the development community. We need to get back to using pragmatic tools properly and an emphasis on shipping software.

    As for the Yahoo article, despite it’s “Pros” which errantly includes strong typing, they chose PHP.

    Have you ever written an application in PHP?

  78. Jack, I am sorry but if you don’t want it to be my last reply to you – you need to use more facts and less of religious speeches.

    There’s no evidence that PHP projects ship and Java projects don’t. When you asked – I gave you example of very active websites that use J2EE. Are not those shipped and running?

    People here are trying to discuss something. Not – to trash one technology or other. We know that all of the mentioned ones are good-enough as they are all used in the real world. That is not the question.

    The author of the blog (who I have a strange feeling you are trying to “please” a little bit, in your way. Sorry if I’m wrong) is not as radical as you, if you noticed. Look at his quotes: “Sorry but any of us would have chosen Java over PHP for ourselves…” and “… that scripting languages are more productive for straightforward problems” (pay attention to the word “straightforward”).

    Have you even read what the Yahoo! guy was writing about their choice? He very specificly said Java is a very good choice but they would have had problems with FreeBSD. You still seem not to understand that they did not move their existing platform anywhere, they were just discussing what to write new modules on. Their old stuff is running on FreeBSD, so they went with PHP. And he was not as nice in case of Perl (if you at last read what he wrote, you’ll see) as he was to Java. So, there must be a reason, for that, must not it?

    You are trying to state that Java is a trash, and try to bring Yahoo!’s example where guys from Yahoo! do not think that way, theirselves. What kind of logic is that?

    As for the personal question to me (sorry for the offtopic) if I have “ever written an application in PHP”, I already unswered that – I am running a serious open-source project in PHP.

    But if you want clearer explanation, here it is: I have enough PHP code behind me to bet on 200$ with ANYBODY, and something tells me that with you – I could go higher. No offense of course, we can make this bet real if you wish. Offer is open. To be fair, warning: I have 5+ years of PHP development behind me.

    Thanks

  79. I can go and find a few single example here and there of people pushing projects through in Java and completing them. Actually, it’s funny that you should mention Visa in your previous posting because I was actually shown some of the Java code for the Visa site several years back. It was a single Servlet that contained a single enormous function which was a mesh of string concats to build HTML intermixed with JDBC statements in random places. The author gushed about how maintainable and scalable it was.

    I suppose I am off base about your personal PHP angle. I actually find it quite interesting that a Java advocate would like PHP. I have yet to meet a Java advocate who advocated anything but Java, and who saw PHP as anything other than a language to port away from.

    Having said that, I then don’t understand your statement: “For high-load, scalable system, I can not see, how PHP can be used, at all.” Please justify.

    As for Philip. I don’t know him.

    As for betting. I don’t bet. Even so, I don’t understand your bet as written.

    As for religious speeches, I speak from experience. I live and work in the Bay Area and talk with a lot of developers. Statistically speaking a much larger percentage of “Java programmers” tell me stories of failed projects, either the complexity was too great, the schedule was “too short”, the money ran out, or the project never made it out of architecture phase. I contrast this with my experiences with other architectures (C, C++, PHP, Perl, etc.) and they talk more about products that shipped but had maintenance issues.

  80. Ok, let’s go back through your statements:

    “For high-load, scalable system, I can not see, how PHP can be used, at all.”

    “PHP beats hard JSP, J2EE can do things PHP is just incapable of.”

    I would like further clarification on these as I do not believe either can be justified.

    As for Philip, I don’t know him, nor is it of interest to me what he thinks about me.

    As for betting, I don’t bet.

    As for the religious speeches comment. I speak from experience.

    As for Yahoo. The fact is they chose PHP, which according to you, cannot be used for that application because Yahoo definitely requires a “high-load, scalable system”.

  81. This whole argument is pointless.

    Nothing done in a classroom is “real world”. Ever. If Phil thinks it is so maybe he can tell us how many times he changed the requirements arbitrarily and how many single-digit number of days before project delivery deadline he was doing so?

    Failure to do something in any language in a single example is simply not proof of anything. Perhaps the guys who chose Java where extraorinarily untalented, or just plain bad designers, or maybe not taught design properly, or didn’t take those classes. Perhaps in the end all they proved their lack of ability as application architects by not choosing the appropriate development environment and deployment technology!

    As for the latest arguments re: Yahoo and ‘J2EE never shipped’ perhaps the respondant could ask the many fortune 500 companies, blue chips and others that deploy mission-critical J2EE applications in their businesses about that then. Then ask them about the extent of their PHP applications. And I’m not talking about their flash-heavy brochureware websites or customer satsifaction surveys I am talking about their BUSINESS TECHNOLOGY.

  82. I’m a little surprised no-one’s mentioned SQL up to this point.

    The thing about SQL is that unlike any other mainstream computer language, it works on sets, not on individual rows or variables (at least, for the common subset of SQL – I’m not including cursors). Writing an EFFECTIVE SQL query requires the programmer to think in terms of sets.

    We’ve recently written a consignment tracking and management system for a courier that delivers and collects packages for catalogue companies – basically, a set of software that handles their workflow from notification of a new consignment through to delivery to the end customer, or return to supplier in the case of a collection or a cancelled delivery. This took the effort of four developers for about 12 weeks. There are four ‘actors’ on the system – an import/export process for notification of consignments and informing the supplier of status changes, a hand-held application for loading bulk transit vehicles and delivery vehicles, a data server component for communications with a pre-existing Proof of Delivery application, and a web site for directing the operation of the other components, querying the status of consignments, and reporting on the status and performance of the business.

    The back end database was MS SQL Server 2000, and business logic was largely written in SQL Server stored procedures. The automated processes were largely written in VB.NET, as was the hand-held application (utilising our thin-client application server specifically designed for barcode scanning applications – the application logic is implemented on the server). The website was written in VB.NET using the ASP.NET framework, including all reporting.

    I found that many of my colleagues had trouble with simple queries to select and update single rows (on one occasion, confusion arose over UPDATE and the fact that if you omit the WHERE clause, it updates EVERY row). These developers have a tendency to use cursors a lot.

    Another copes with the set nature of SQL fairly well, but has trouble with derived tables – he tends to use temporary variables.

    Myself, I use damn near every feature of SQL Server’s Transact SQL that exists, although I’m not too hot on correlated subqueries (I think they’re called!). Particularly, the data server which communicates with the Proof of Delivery application is almost entirely written in stored procedures, using the FOR XML and OPENXML features for generating and processing XML.

    Perhaps there’s a deficiency in the teaching of relational databases?

    Looking now at the website, I think the major time-savers have been that the ASP.NET data model works so much like the event-driven Windows model, and data-bound controls (particularly Repeater, which we’ve made very heavy use of).

  83. Side-aspects of the issue:

    1) Security: There is an enormous amount of PHP pages
    out there hosted by Apaches of thousands of Internet Providers, all with the same process user and permissions within the same Apache, all capable of
    sniffing and disturbing business of the other
    customers. It’s a great mystery to me that there is not more abuse, since it’s really easy
    to do bad things. Otherwise the Internet Providers
    would discover quickly how easily they could avoid
    these problems using Java.

    2) Deployment: Sure it easy to get your first PHP/ASP/whateverP webpage up and running… as long as
    you have a patient and experienced sysadmin which is
    willing to configure, re-configure or even re-compile
    and re-configure Apache with alle nifty PHP-modules
    you need. Kids having problems with coding JSPs
    will definitely have more problems compiling and
    installing a PHP module…

    3) Knowing PHP means knowing how to make webpages.
    Knowing Java enables to to learn how to make webpages,
    how to write some applets, how to develop desktop
    applications, how to write games on handhelds, and
    nowadays you might even use your knowledge to go into
    the big telecom business and poke around with JAIN
    services. I think that’s worth of spending a few more
    hours on the first hello-world-page 😉

    Cheers
    Karl

  84. The metaphor seems apt, but Java is really a Hummer or something. It’s inefficient for everyday use but it will in fact go almost anywhere you want to at 12 MPG. If you are doing ai software for route finding though, Philip is right – use Lisp or ML.

    Here’s the giant win for java though, you can actually use code you download from a website and it will probably work. This was never true for the previous SUVs c, c++, pascal or visual basic. And getting rid of buffer overflows in the maligned String class was a huge boon for security when your code runing on the internet. You can get stuff for drawing graphs, for monitoring websites, for finding the difference between two texts, for regular expressions, for database pooling, for calculating the distance between two zip codes, for email sending, for creating events when you get an email, for creating pdfs, and for connecting to every database from postgres to ancient ibm mainframes.

    With C++ it was and probably still is a week minimum to get a fancy new library to work. With Lisp, nobody ever decided which lisp was the right lisp. Or maybe i should go with the clearer syntax scheme and narrow my library choice further. Actually ML’s syntax is a lot nicer and my one prof at Stanford and the other 200 guys who use it could all get together and… oh yeah all have lives. Only python and perl have the kind of good library support that java enjoys.

    And then you have to pick a server. Paul Graham has a lot of advice about how great a Lisp is, but how about a tutorial for running it on the web and doing some of the other great things he was talking about? How about a tutorial anywhere? Evangelism matters.

    So Lisp and the other great languages seem out. And PHP seems out if you are going to take your application beyond the one quarter class and develop it for year or two (for the very good reason that its not a real language).

    For schlepping web parameters back and forth from a database though, java is a nightmare. I’ve done servlet stuff for 5 years including EJBs and JSPs and various template schemes, and while way better than perl or c++, java is way too pedantic to be much fun. The amount of excess verbiage in my code is crazy, i’m very tired of writing the same class again and again and changing the database parameters or flow a little. Auto generation of classes would rock.

    How about Jython as a glue language? You would have the benefit of very useful libraries, very good java servers, and a language that’s both robust and good for scripting. And python can execute python code almost as well as lisp can execute lisp. Check this out: http://www.norvig.com/python-lisp.html

    In Java’s defense, I wonder if the very valid critique of java has to do with the three ring circus created by having too many volunteers and too many ideas about organizing web applications. Every Java programer DOES have a different way of doing things. Half of them are probably pretty reasonable, but instead of 1000 people working to optimize that development method, there are 20. So the student goes down some path, but it turns out that nobody has tried to use WebMacro with PostGres and Apache on a Windows 2000 server. The newsgroups don’t have any info about debugging it, and the WebMacro dudes haven’t talked to the PostGres dudes and nobody has a downloadable installer that let’s you set up everything in one click.

    Sun is sort of stuck promoting EJBs (a very complicated and difficult technology) because the are really selling to the Fortune 500. Microsoft has the freedom of making their money off of the little guys, so they can promote things that actually make sense for the little guys. Maybe in the next 10 years, we’ll see an emergent java web development thing come from the open source fray that will work as well as .NET and PHP (with tools and libraries and maybe even one download instead of eight to set up a server).

    You should be able to download a functioning news posting web application module and expect it to work with your site (as you seem to able to with PHP).

  85. With an instructor that is violently against Java, I can totally understand why the students were forced to drop out. It had nothing to do with Java.

    I feel bad for the students. They were in a no-win situation. The only way they could have suceeded is if they had a different instructor.

  86. JAVA, PHP, Perl, LISP, Python, C, C++, C#, COBOL, FORTRAN, VB, etc., all languages we use every day on our jobs/programs or whatever. It seems a bit funny to me that those who are HUGE proponents of JAVA, take extreme offense when someone criticizes it as a development language. After all, IT IS ONLY A PROGRAMMING LANGUAGE. It has its benefits, like the others mentioned above have theirs. In 2 to 5 years, pretty the time-span of when a “new” latest and greatest language makes its appearance, JAVA will be on the “sideline” waiting for its use from a company or a single programmer. So here is a message to all of you “die hard”, coder-wannabies–know-it-alls, whatever fits the “bill,” use it. If not, don’t. Wow, simplicity is exactly that, SIMPLE. Grow up….

  87. J2EE scalability and performance, eBay Case Study:

    “It was a bake off, essentially, between two camps: .NET and J2EE. And Microsoft was the .NET vendor and there were multiple providers for J2EE, and eBay gave very stringent requirements and tests that each of the two camps needed to demonstrate. And after a significant amount of time and really deep knowledge of what the application had to do and the performance benchmarks at the end, J2EE won out. And specifically, WebSphere was the application server chosen, and they have just really been elated with their decision on J2EE. So this is a very good indication of how well J2EE really can scale and really can perform over .NET. ”

    http://www.theserverside.com/events/index.jsp

  88. Next time you conduct your class I will personally come out and tutor the Java students. You can hack just as fast with JSP or Webmacro or Velocity as you can with those other languages. Drop me a line.

    A little off topic… but…

    Can you tell me how to debug an SQL query? Seriously! I work for a company (www.retek.com) that uses Java and Oracle and it’s when I’m staring at a 300-line SQL query with 7 tables and 4 UNIONs that has been “tuned” by a performance team that I weep, not 10,000 lines of Java code. That latter can be debugged! I can step through the code, I can’t do that with Oracle. (maybe I’m stupid and there is a way)

    Putting all your business logic in the database is a horrible world because databases don’t go “out”, ie, they are passive and you must write code that queries it and shoves stuff into it, the aren’t good at doing things on their own. This is why you can’t have a web site be written in stored procedures waiting behind URLs.

    I know you have a negative opinion of Middleware from past readings, too; but you are always looking at crap products like Kiva and such. Furthermore, if I have all my business logic scattered across the database and the UI, I have no central place to make consistent changes, which gets out of control fast with a bigger project.

  89. Greetings to all! Excuse for this message, but at you excellent design of a site! Very much it was pleasant to me, I shall come here very often!

  90. Thank you for being generous with your resources… I hope that you will receive more than you need for your time and
    energy. Keep at work!

Comments are closed.