JPz'log Coin Coin and Plop da Plop

16Jan/062

Python + mod_python: why use PHP again?

As time goes by, I hate PHP more and more. The language is deeply flawed and ugly. It promotes nasty habits, so that 9 PHP developers out of 10 write code that does not separate the view and the business logic. In fact, it is a common coding standard among PHP developers to put a slight amount of logic in the same document as the one that contains the tags. And the my code is in .php files that are requested in URLs[1] is real drama when you want to teach Java EE on people that have been formatted by the PHP way-of-code-wasting.

Of course there are examples of PHP software written by good developers. For instance Dotclear is a wonderful piece of work, but one should not forget that talented developers will always produce good code even with a doomed language. I only see one reason for me to use PHP: it is the only language that you will find on affordable web hosting.

Now, when I have the control of the web server, I don't see why I would not use Python + mod_python. Python is really neat, and mod_python really makes things simple to create small to medium sized web applications. If you delegate the requests handling to the publisher handler and process views with the Python Server Pages (similar to primitive JSPs), you get nice URLs for free and an amazing productivity. And you also get the huge Python Library + 3rd-party modules. Oh and if you do things this way, you won't mix view and business logic.

I strongly urge you to try mod_python if you haven't yet, the tutorial will put you on rails[2] in 5 minutes (granted!).

Notes

[1] To be fair, you can do the same mistakes with JSPs.

[2] Ah ah ah...

Share this post:
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • Live
  • Netvibes
  • StumbleUpon
  • Technorati
  • FriendFeed
  • Wikio
  • Twitter
  • Identi.ca
  • Reddit
  • RSS
  • Slashdot

Related posts:

  1. DecoratorInjector in Python by Yannick
  2. A todo list on Google App Engine… Python
  3. nose: testing in Python made easy
  4. Does anyone know…
  5. Netbeans as a J2EE teaching IDE

Comments (2) Trackbacks (0)
  1. Hi! Can you point us to some nice Python and mod_python links on the web? The tutorial you talk about would be really nice!! :)

    I do all my work in Java, but I’m getting into ObjectiveC and Cocoa on the Mac, and into a couple of scripting langs: Ruby and Python (which would you recomend from these two? ;) .

    Thanks!

  2. The tutorial from the official documentation is just fine!
    http://www.modpython.org/live/cu...

    I tend to find Python quite easier than Ruby, and mod_ruby looks to be less mature, but if you need to basically create ‘forms’ from a database, Ruby on Rails is quite a good option. I am not a Ruby specialist anyway ;-)


Leave a comment


No trackbacks yet.

JPz'log is Digg proof thanks to caching by WP Super Cache