On Wednesday, July 15, 2015 at 1:20:11 PM UTC-4, Matheus Cardoso wrote:
In
Slant.com we have some Python Frameworks under criticism. One of them is web2py. But I got stunned when I saw two great cons:
- Badly designed framework
Globally defined variables,There are a small number of core API objects that are available in the web2py execution environment (i.e., models, views, and controllers). This avoids the need for a lot of boilerplate import code for widely used objects. There is no explanation as to why this should be considered "bad" or what problems it causes.
no real object-oriented designThis is obviously false, as most of the framework follows an object oriented design. Even if it were true, though, there is no explanation as to why that would therefore qualify as bad design (e.g., some frameworks take a more functional approach, which can also be good design).
and basically everything is all over the place.Hard to respond to such a vague claim with nothing to back it up.
The source article cited raises some additional concerns, most of which are incorrect or overblown:
web2py doesn't support unit testingIt does, though does take a little extra setup work to make it work with models and controllers. This is a legitimate criticism, though much easier to overcome than implied in the article.
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 runThis is incorrect. Perhaps the author is referring specifically to view templates, which are first converted to Python code -- when there is an error, the ticket shows the Python code, not the original template code, but this can actually make debugging easier because it is easier to see the structure of the code that was executed (and it is usually not difficult to find the associated line in the original template).
In development mode this is a headache, I really need to see the error instantly and not to see a ticket number!but remains the way you define the tables and fields a completely functional (not OO)It's true that web2py does not have an ORM, and you do not define models by creating a Python class. However, the author fails to explain why the class-based approach is superior. Most of the functionality you would get with an ORM class you can also achieve with the DAL's virtual fields, table methods, and other functionality.
web2py has really poor IDE support and you cannot use standard python development tools without modificationsThis is a legitimate criticism, though overstated, as there are workarounds to allow web2py to work with such tools (and several IDE's come with built-in web2py support).
I think Bruno is conflating scalability and efficiency. Scalability refers to the ease with which an application can be made to serve more requests by simply adding more hardware resources. In that regard, it is just as easy to scale web2py as any similar type of framework. So, web2py does indeed scale.
On the other hand, efficiency refers to the number of requests that can be served with a given amount of hardware resources. What Bruno probably meant is that web2py is not as efficient as other frameworks, in that it requires more time per request. This might be true out of the box, as web2py automatically includes some functionality (such as sessions) that is optional in other frameworks, and web2py must read model and controller files on every request. However, it is possible to optimize web2py code by bytecode compiling the app, moving most logic to modules, using lazy tables, caching, etc. Even after such optimizations, I suspect web2py will not be the fastest framework around, but for real applications involving databases (as opposed to idealized benchmarks), it probably won't be far off.
Anthony