Comparing Ruby and PHP
21 September 2006
I was reading Of snakes and rubies; Or why I chose Python over Ruby which is an article comparing Python and Ruby. The blog article has loads of comments. This one I liked in particular
"For people writing good production code in PHP, I'm not trying to pile on - I know you get disrespected enough. It's possible to write well-structured sites on PHP, and lots of you do. It's just that in PHP, anyone can learn how to create spaghetti code in 10 minutes, but you have to learn a decent-sized body of knowledge to gain the ability to separate presentation from logic. By contrast, when novices get started in Rails, they're using good structure by default. They have to make an effort to screw it up."
That is soo true! Because you have to do Rails in the Rails way and (unless you're exceptional) in no other way, all your apps will follow a certain clean standard.
Why am I pointing this out? Because Zope2 is just as bad as PHP in this way. A lot of beginners use Zope's web interface (aka. Zope Management Interface, ZMI) to write code for their web sites and web apps. That's the equivalent of a non-guru PHP developer who naively mixes SQL with CSS with HTML with business logic all in one document. Not good. Or is it?
I'm about to slowly leave Zope2 for Zope3 where things are really strict. Apparently, the reason why the configuration is done in XML is to force people to not mess up their code. At first I was very reluctant to this almost arrogant approach. PHP is not successful because of technical raw power but because of thoughtlessness. You don't have to change gears, turn, break, check mirrors and throttle to get started. Just apply more gas!
Perhaps the Zope community can learn something from Rails here. Getting started should be PHP-like easy and moving from "Hello World!" towards something much more complicated should be done in a strict fashion.
I know I did. At Fry-IT we have command line tools that allow you to create a structured (filesystem based) web app filled with folders, stubs, standard templates and blank
.py files where you fill in the blanks and within minutes you have a well structured codebase. It's not as good as the Rails tools but he idea is the same. Let's learn from PHP and Rails, a non-PhD threshold to get started to skip boilerplate stuff and a set one way to do it once you've started.