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…