The good and bad about web2py

a few months ago I was looking for a web development framework that is less painful and fun. Earlier I've been using web2py and I was partially satisfied of what it can do in a very short period of time. However, after I started to use web2py in production I was hit by the following facts that made me completely unhappy

Web2py logo

Disadvantages of web2py

  • web2py doesn't support unit testing, it supports doctests which is far from being optimal for a testing freak like me and is too limited in terms for the scope, you cannot really do the same level of tests you used to do in normal server side or desktop programs.
  • web2py does use Python which is my favorite scripting language so far and the one that I have been using for the last couple of years continuously. While Python is a great language it was used in a twisted way to design the framework, Python magic was all over the place, variables defined globally are allover, you cannot see real OO in the design, plus the code follows PEP-8 which I hate its doblahfunction style (lots of underscores).
  • Very bad error reporting, although this is quite debatable but I've been quite dissatisfied with that and let me tell you my reasons:
    • Web2py does not differentiate between development mode and production mode, if an exception is thrown a ticket is generated all the times and you will gave to navigate to the ticket to see the error. In production that would be useful (although I would have loved to see more control on how/where the ticket is stored/generated. In development mode this is a headache, I really need to see the error instantly and not to see a ticket number!
    • The error message for a syntax error or coding errors in web2py is ambiguous (try doing a mistake in the model) that's because web2py takes your code and merges it into larger file to run, thus, it cannot determine the line number of the error or the source of the error correctly.
  • web2py also doesn't have a decent ORM, it has a nice database abstraction layer (DAL) that abstracts many types of database engines in a nice way, but remains the way you define the tables and fields a completely functional (not OO). When you get to have a relatively large model you will get your code scattered by all nested definitions and attributes that will make things harder to maintain.
  • web2py has really poor IDE support and you cannot use standard python development tools without modifications -- for me this is a serious issue.
  • Using the python CPython interpreter limits the whole application to run only on a single core because of the GIL, however, this is not web2py limitation, this is a limitation defined by the implementation of the python interpreter and can be eliminated if you changed the interpreter to Jython or moved away from asynchronous non-blocking socket web server that uses multiple threads, and started using multi-process webserver so that you get multiple python interpreters running. I'm not really sure if web2py has done anything to ensure better concurrency or not.

Advantages of Web2py

Web2py remains to be the best Python web development framework I've ever seen, easily beats django and turbogears in terms of the speed and simplicity of the development.

  • Web2py uses python-based template language which is one of the coolest things I've seen in this framework and this will kick start python developers to start writing code immediately after understanding the basics of writing templates as views.
  • Web2py can run python compiled code as an optimization to lower the running time and to allow you to distribute your code in a compiled fashion.
  • Web2py has a capable DAL that will let you forget "partially" that you need an ORM and it'll make things easier for those who don't want the full-fledged ORM in their software.
  • The framework in production is really fast and with some optimizations and tuning you can minimize the memory footprint  so you can run on a really small VPS or slice
  • Provides a comprehensive administration web interface that has integrated editor and source control (scm support is far from being really usable)
  • web2py makes is super easy to write web services, xml-rpc or JSON
  • Good support of different caching techniques/technologies, like memcache, disk cache, ram cache.

Summary

Web2py is a free, fast, secure web development framework that's entirely written in python and encourages using python in every aspect (model, view, controller). A very good framework for small web applications or prototypes but fails to fulfill the enterprise class quality requirements because the complexity of solving bugs will increase exponentially because of the lack of unit tests, good and accurate error reporting, and scattered model.

comments powered by Disqus