[1]: https://github.com/laravel/framework/blob/master/src/Illumin... [2]: https://github.com/reddit/reddit/blob/master/r2/r2/controlle...
There is a lot more to a language than its syntax.
Special chars, like PHP $, Rust's ~, Ruby's @, help the programmer tell things apart easily.
Vastly better than having to keep the information in your mind after the declaration -- and much lighter and better than full-on hungarian notation madness.
As for the braces, they never went out of style. In fact, with the exception of Python, the languages that don't use them are not that popular, compared to the ones that do. Coffescript, for example, is insignificant compared to the plain Javascript use.
The PHP code you linked to is basically a class with a bunch of getters and setters.
The Python code, on the other hand, handles numerous real-world HTTP requests that do actual work.
So it's not unexpected that the PHP code is lighter; it doesn't really do anything useful!
Although it helps implement a wiki system, the Python code is still very readable and comprehensible with minimal effort.
I think I know the point that you're trying to make, but those examples surely don't back it up in any way.
I agree about the python code that it is reasonably readabale, but i still think it's ugly. Those two things are not the same.
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.
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.
Simply put, ruby is ugly as sin. I much prefer php's syntax. Granted, I also much prefer other C style languages, even objective-c. I mean, that probably says it all. Objective-c is probably on the opposite end of the syntax tree compared to ruby.
Simply put, ruby is ugly as sin. I much prefer php's
syntax. Granted, I also much prefer other C style
languages, even objective-c.
*I mean, that probably says it all.*
Yes. If only you knew how true this was :P