Slashdot Mirror


Choice of Language for Large-Scale Web Apps?

anyon wonders: "PHP is the most popular language for the web. eBay uses ISAPI (C), Google uses C/C++ (search), Java (gmail), and Python. Microsoft uses ASP (what else?). For small web site, it really doesn't matter. What's your take on language choice for large-scale web applications? Maybe language choice is irrelevant, only good people (developers) matter? If you can get the same good quality people, then what language you would chose? Considering the following factors: performance, scalability, extendibility, cost of development (man-month), availability of libraries, cost of libraries, development tools? Has there been a comprehensive comparison done?"

17 of 801 comments (clear)

  1. Polyglot by FTL · · Score: 3, Insightful
    What's your take on language choice for large-scale web applications?

    As many as possible. Use PHP for the front end, Perl for input parsing, Euphoria for the graphics, JavaScript on the client-side, Moo for the database and Python for the glue to hold things together.

    Every language has strengths and weaknesses. There is no killer language. A good carpenter has lots of tools and uses the most suitable tool(s) for each task. Likewise a programmer should be skilled in many languages and should pick the most appropriate one for each task. Learn as many programming languages as you can, and when you've done that, learn a few more.

    [The feeling of job security is also rather nice.]

    --
    Slashdot monitor for your Mozilla sidebar or Active Desktop.
    1. Re:Polyglot by Tablizer · · Score: 5, Insightful

      As many as possible. Use PHP for the front end, Perl for input parsing, Euphoria for the graphics, JavaScript on the client-side, Moo for the database and Python for the glue to hold things together. Every language has strengths and weaknesses.

      Noooooo!

      It will just produce a job ad that says:

      Required: 3+ years experience in PHP, Perl, JavaScript, Euphoria, Moo, and Python.

      Then when they can't find any individual to fit the bill (surprise!), they will lobby Congress for more visa workers so that they can hunt the entire globe for the "best and brightest".

      (Hmmmmm. What the hell is "Moo"?)

    2. Re:Polyglot by Lord+Ender · · Score: 4, Insightful

      If I were your boss, I would hire an intern and have him rewrite your apps from scratch with a single, maintainable language. Once he is done, I would hire him for half of what I pay you, then give you the boot. Job security through incompetence?

      --
      A slashdotter who didn't build his own computer is like a Jedi who didn't build his own lightsaber.
  2. The only thing that counts... by Qui-Gon · · Score: 3, Insightful

    And you said it...

    Maybe language choice is irrelevant, only good people (developers) matter?

    --

    We are blind to the Worlds within us
    waiting to be born...
  3. Depends by boner · · Score: 4, Insightful
    What you are asking is a dilemma that has been around since the invention of different programming languages. My personal opinion is that the best investment of your time is designing the web-app itself. Once you understand the feature set you require/desire then it makes sense to start looking at how the feature set requirements map to the available languages from a development and performance point of view.

    Most people tend to forget to take a productivity point of view and let themselves be guided by whatever is available or what's cool. If you follow a productivity approach it will help you make the trade-off decisions between interpreted languages like PHP and compiled languages like C/C++, with ASP and Java somewhere in between.

    There is a balance between development and production, when you go live and your web-app is well-designed it should be easy to add additional hardware to compensate for performance issues (server is about US$ 2000,- , or the equivalent of 10-20 hours of developer time.)

    The single most important piece of advice after recommending that you spend more time on designing the app: don't get married to the language. Be prepared to use PHP to develop quickly and understand what works and what doesn't for your web-app. Once you have solved the usability bugs, investigate how you can drive efficiency by choosing a different language or not.

    There is no template for what is the best environment, only your common sense, and oh... did I mention that you should spend more time designing your app?

  4. Depends on what you want to do... by Foofoobar · · Score: 4, Insightful

    I use PHP myself because it focuses on one thing and doesn't get distracted by trying to do more than it's build to do... that being, serve dynamic web pages.

    Sure you can use it to dynamically generate images, PDF's and alot more but these things tend to slow down and detract from what it is meant to do and should be handled by third party apps preferably on a different server that way you separate your processes and keep PHP focused on it's task.

    Plus with the improvements in the ZEND engine and it's object oriented programming, PHP is now comparable and even sometimes faster than Java.

    People will say that it doesn't scale but they base this opinion on a preset prejudice or on the scalability of the underlying architecture. But PHP's engine is actually more compact than the JVM because it has less to focus on and thus can scale along side Apache, the entire way.

    And with tons of larger companies moving to PHP, it has proven it can handle the load.

    My only complaint though is developers who try to do EVERYTHING in PHP. With all the added modules, it does have the potential but do you really want to waste processing power letting PHP handle all these extra tasks? Use PHP for dynamic webpages and any added processing you need to do, I suggest moving to a secondary app preferably built in C/C++ or even Java. That way you get the most bang for your buck.

    --
    This is my sig. There are many like it but this one is mine.
  5. Re:Java Java Java! by Surt · · Score: 4, Insightful

    Actually, odds are that hand written assembly will underperform compiled c these days. Hiring or training people that can write better assembler than a modern compiler is very very difficult.

    But for web development, Java is generally the right choice for the backend. Lots of competent people available who will require no learning curve. The support tools available for java on the backend are also clearly the best right now, as you pointed out (hibernate etc.). The tools for working in java are also a step ahead of anything else right now (idea and even its slightly retarded younger brother eclipse are both way ahead of the tools for any other language).

    --
    "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
  6. Wrong by dereference · · Score: 5, Insightful
    Ajax asyncronously calls JAVA functions without needing a page redraw.

    Wrong.

    AJAX asynchronously calls any server-side technology without needing a page redraw. It could be PERL, ASP, or anything else that can respond to an HTTP Request.

    Please read the docs about Ajax before telling me something that has nothing to do with it.

    Please follow your own advice.

  7. Our standard enterprise stack these days by BigGerman · · Score: 5, Insightful
    (for those who actually care to get something out of the door)

    Java:

    front end - Tomcat running JSPs (JSTL or Velocity for templating)

    in the middle - Spring and Spring MVC

    Closer to database - Hibernate.

    Ideally, everything running in same JVM. Add more servers for scalability front-ending them with load balancer with sticky sessions.
    No J2EE fluff, easy to find people, good productivity.

  8. Re:Perl? by rascal1182 · · Score: 3, Insightful

    Ruby is another write only language if you dont know it (actually arent they all!).
    This is I presume simple example code. God only knows what kind of code a ruby "haXX0rzzzz" would produce:


    The thing about this is, skilled Ruby programmers (that I've seen) produce beautiful, simple code, devoid of silly things like conditionals. These programs aren't hard to understand.

    OTOH, the Perl mentality seems to be "I can do that in fewer keystrokes!"

    These are obviously over-generalizations. I have seen good Perl code and lousy Ruby code. I just think that Ruby is more condusive to good code (personal preference, really).

    --

    "Yarrgh! I be just a paintin' of a head..."
  9. Language != module by Foofoobar · · Score: 5, Insightful

    You are mixing up the language with the modules. There is a reason why PHP comes without all those additional modules... so you can decide what you want it to do. If you want to add all those modules to PHP and make it do all that, then you have to do it yourself. But the base install does not include them. In fact it no longer includes MySQL support in it and that too must be added as a module.

    As far as your opinions on PHP not scaling, tell that to IBM, Avaya, Hewlett Packard, Disney, Sprint and the others who get millions of hits a day using PHP. Seems to me if sites that get millions of hits a day can handle the bandwidth using PHP, that it JUST MIGHT be able to scale. :)

    And as far as worst security history, you again confuse bad programming with the language it is written in. For this analogy, C# and VB still hold that title. Just because the language allows you to make mistakes in your programming, does not mean it is the languages fault when you create a recursive function that loops perpetually.

    I suggest trying a course in logic; it makes your programming better and your argumentative rhetoric make more sense. :)

    --
    This is my sig. There are many like it but this one is mine.
  10. The real problem in comparing Java and PHP by amarodeeps · · Score: 4, Insightful

    Java is called a language but in this context it is more of a platform which, frankly, is older, more robust and better thought-out than anything PHP has to offer--at this point. I believe PHP is great for small to medium scale web sites, but once you start to deal with the large structures that enterprise systems require, PHP is just not an option--if you want packages already available to you which are thought-out, mature and stable, like all the various J2EE solutions available.

    PHP very well may be faster for an individual page--but what are you comparing that to? Tomcat set up to use JSP? Well, there's a lot of infrastructure there that a PHP developer is probably not going to use for a simple dynamic page. And the fact is, PHP is incorporating a lot of 'heavier' OO features now whose effective use is debatable when considering web apps tied to the HTTP protocol--why build and tear down your entire OO structure every time you load a page? To do that intelligently you want an application server caching these objects...and then we start talking about Java and all the years it has on PHP there.

    So, I'm really just saying--some things are right for some projects, others for other projects. Choose wisely.

  11. Re:You are contradicting yourself. by gregmac · · Score: 4, Insightful

    Lets not forget that PHP has the worst security history of any language, there are constant exploits and there's nothing you as a PHP user can do about it.

    Constant exploits? For PHP, or for crapply-written content management systems (ahem, phpnuke) that happen to be written in PHP?

    CERT has issued two advisories for PHP itself: CA-2002-05 and CA-2002-20. Looking through the changelog I see only a handful of security fixes.

    Like most languages, it's possible to write unsecure code. I've seen code that executes stuff on the command line, right from a GET string. It's just as possible to write secure code.

    One problem with PHP is it's a simple language, and a lot of beginners with no experience pick it up and can use it to write applications. Knowing nothing about software development, or security issues, they tend to write bad, insecure code. This has nothing to do with the language, it simply has to do with the developers. If python or ruby came into incredibly widespread use (ie, available on pretty much any hosting account you can buy, like PHP is), then you'd probably see the same thing happening. It doesn't say anything about the languages, it's simply a matter of inexperienced developers writting bad code.

    --
    Speak before you think
  12. Re:Java Java Java! by drgonzo59 · · Score: 5, Insightful
    You are right, performance from the language point of view is won by assembler, but often it is the choice of the algorithm that will make the big difference. A bubble sort in assembler of 1 million items might be slower than a quicksort of the same million items in python.

    Often when someone asks the question "what languages do you know?" or "what languages are the best?" it shows a lack of CS background and experience. The right question is "what programming paradigm would you use?" or "what programming paradigm is better?" (Of course when you come down to a specific problem, then the choice of libraries might determine the language, but the original poster only specified "large web application" as the requirement so talking about a specific language is pointless).

    The difference between the two questions underlies the difference between the two types of education most programmers have. Some have gone to 4 year colleges and got a "Computer Science" degree, while some learned a language in their spare time, or went to technical college. The people from the technical college will know just one language and ask others what langues are the best, what languages they use etc. To them learning a new language hard. What a CS degree teaches (or should teach) is different programming paradigms - procedural, functional, object oriented, along with an algorithms and data structures. So if someone knows how to think in terms of objects when they solve the problem they can program in java, c++, python, ruby and other object oriented languages.

    I used C++ in college, then I learned Java, now I use primarily Python. All I had to do is learn the syntax and some of the common library functions -- all can be done with a good reference book and/or Google in a couple of weeks.

    Or if a problem can be better solved with a functional approach, I would use Prolog or Lisp (you can use Lisp for websites too!).

    So, I think the original question should have specified the problem more exact or ask about what paradigm would be better. Rather than give a general requirement ("large web application") but then then ask for a specific language. This is bound to lead to nothing but arguments of why everyone's favorite language is best and that's about it.

  13. Re:Java Java Java! by Surt · · Score: 4, Insightful

    Actually, if your hand written assembly doesn't look like compiler generated assembly, you're probably missing out on things like multi-functional unit parallel scheduling etc. The number of people who can code in a way that will feed instructions to a modern cpu successfully is very small.

    Writing efficient assembly code today is at least 3 or 4 orders of magnitude harder work than it was in the 60s or 70s, and there are far fewer experts available to hire today than there were back then. There are maybe 3 or 4 major computer game developers still doing hand assembly optimization these days, and those guys would be extremely hard to hire away from their current jobs. Most games are just developed in c, and are bound by the performance on the video card anyway, so that optimization on the CPU just isn't that important any more.

    --
    "Who is the Journal of Quantum Physics going to believe?" --Stephen Hawking
  14. Re:Not all true (imo) by Westley · · Score: 5, Insightful

    You say it's "simply not true" but don't actually give any reasons.

    Now, I've never used IDEA for a prolonged period of time - I couldn't get into it, and was happy enough with Eclipse not to worry. (The fact that Eclipse is free helps - it would be difficult to persuade my company to pay for loads of licences for IDEA when Eclipse is perfectly all right and free.)

    I do, however, use Visual Studio .NET 2003 and Eclipse in daily work. Here are just a few reasons I much, much prefer Eclipse to VS.NET:

    1) Refactoring. Yes, there are tools available to help - but it's free and bundled into Eclipse.

    2) Organise imports. Even with VS 2005 having some limited support, it doesn't help nearly as much as it should.

    3) Built-in unit testing tools. Using TDD.NET to fire up NUnit GUI (or any of the other things it can do) is much, much uglier than the built-in support for JUnit in Eclipse.

    4) Ant support in Eclipse. Our Java build script is *so* much nicer than the nastiness VS.NET encourages. I'm looking forward to investigating the VS 2005 integration with MSbuild.

    5) "Hold down ctrl to make anything a hyperlink" - want to go to where a method, variable, class etc is declared? Just hold down ctrl and click. Navigation was never simpler.

    6) Search for all references (etc) - in theory there's "go to definition" in VS.NET 2003, but half the time it doesn't work when you're in a large solution, and I don't believe there's any way of finding all references.

    7) The VSS plugin for Eclipse is actually better in my view than the VS.NET support... much easier to understand the configuration, change it on a per project basis etc.

    8) Launching Tomcat in a debugger with Eclipse (even without any extra plugins) seems a lot more reliable than trying to make sure that IIS has actually caught up with changes. Why do web projects need IIS to be running even to open in VS.NET? It's crazy.

    9) Quick Fix and other source options - get Eclipse to write code for you, fix code for you, extract constants, etc. Fantastic stuff - especially in test-first development, where you can write code which uses the API you *want* to exist, then tell Eclipse to create the shell of that API for you.

    10) Compile on save with a really good incremental compiler. This saves huge amounts of time. Oh, and changes really do happen, unlike in VS.NET where if you change an embedded resource, a normal build sometimes picks up the change but sometimes doesn't. (Not to mention VS.NET locking access to files it's built quite often, meaning you can't rebuild them without restarting VS.NET - particularly in terms of XML documentation.)

    These are not esoteric features which are hardly ever used - although I could list loads of those too, if you want. These are things I use *every day*. My pair programmer and I are *always* saying how much easier our C# work would be if VS.NET supported the features above. Half of them aren't even in VS 2005 beta 2, as far as I can see - or at least aren't as well implemented. Funnily enough, I can't remember the last time we said something similar the other way round...

    So, I've given some of my reasons why I think Eclipse isn't just a step ahead of VS.NET, but leaps and bounds. Now, why do you think VS.NET is better than Eclipse, and do you really not care about the above features?

  15. Re:Seconded! by cahiha · · Score: 3, Insightful

    It does it all, and it values the most expensive component of software (for all but the biggest Web apps): programmer time.

    Programmers also have to debug and maintain that software, and that makes Perl one of the most wasteful languages in terms of programmer time.