Web 2.0 development – C++ vs. Java vs. PHP vs. Python

Ok, it the last month I’ve used every one of these languages and most of them for the same project.  Some highlights:

  • Java — decompilers are very useful in reverse engineering
  • C++ — std::string in naive use sucks for performance (wrote a pooled string ala Java String — performance increased by 10x)
  • Python – is easy to extend in C or C++
  • PHP – has the best web frameworks
  • Python – the spaces thing is prone to error, it really is hard to add addtional conditionals and insure that you got all of a if/for/… loop
  • PHP & Python – Lists are good as a basic structure
  • Python – As far as I can tell, it’s not a true lambda
  • PHP – Lax typing, both good and bad…
  • C++ – when it’s right, it rocks for performance
  • Java – a good way to rapidly build app and algs that work
  • Java – it’s easy to over object an API
  • C++ – boost is your friend, but it comes with a cost
  • Python – documentation is almost one step below C++ in quality — long topic around virtuous circles and how Java/PHP rock for docs.
  • Python – has the libraries that PHP only wishes it had, written by people who know what a library should look like.

What’s the upshot…

  • Use PHP to build web front ends — the ability to find a PHP programmer is pretty easy, odds are it’s not going to make/break your application.
  • Use simple RPC mechanisms (e.g. JSON RPC) to Python back ends for the heavy lifting — lots of choices here, but odds are it’s not going to make much difference.
  • Extend your Python with C++ for the computational parts of your heavy lifting — think peep hole optimization.

I used to think that using Java as a back end was the “only” way, but it’s more like the “cult of Java” vs. the “cult of …”, I’m not into religion just getting a job done.   When it needs to be fast both languages will get it there, but you have to remember to spend your time optimizing only where it counts…

  • http://ypeng.org/live/%e5%a4%9a%e7%a7%8d%e5%bc%80%e5%8f%91%e8%af%ad%e8%a8%80%e7%9a%84%e6%af%94%e8%be%83 J2EE 在路上 » 多种开发语言的比较

    [...] 参考: Web 2.0 development – C++ vs. Java vs. PHP vs. Python [...]

  • http://qmsconsultants.com/NABH.html NABH

    I really appreciate your post and you explain each and every point very well.Thanks for sharing this information.And I’ll love to read your next post too.
    Regards:
    NABH

  • Anonymous

    This should be on Quora.

  • Seyed M. Mirtaheri

    Mister genius, please look at the number on top of the charts you took from http://www.wrensoft.com/zoom/benchmarks.html

    The charts are wrong. PHP is actually faster according to the tables! 

  • Seyed M. Mirtaheri

    I contacted the company who created those numbers and asked them why they did not compile their PHP with HipHop? a guy from support team said it does not make sense to do so, since we already have the implementation in C++. These numbers are not meant to compare performance of different programming languages, rather they are meant to compare the performance of a specific framework or rather a specific application written in several languages.