Hacker News new | ask | show | jobs
by simonw 4677 days ago
I'm afraid you picked a pretty terrible example. That PHP code is 414 lines of getters and setters - the code does nothing of actual value. It's a mess of design patterns and OOP verboseness, which mainly suggests that the PHP community are determined to copy the worst aspects of the Java ecosystem.

The Python code, while a little heavy on decorators for my personal taste, spends the same number of lines of code implementing a whole swathe of useful application functionality.

I'm not saying your particular example proves anything about PHP vs Python, I just think you chose an apples-to-oranges comparison to illustrate your point. It would be much more interesting to see some PHP code that implements business logic similar to that Python.

1 comments

I already answered this below. Anywhere you look in the framework you'll find that it is written in the same manner, so i couldn't possibly find any code that is comparable in style to the python codebase. Yet, it is a full-stack framework, so you can't say it doesn't have any "useful application functionality".

Since the point was to show what kind of code you'll be looking at depending on the choice of your language/framework i think that the examples are appropriate. Which application implements better design patterns is a discussion that goes a little beyond the point of this thread.