The SitePoint Forums have moved.

You can now find them here.
This forum is now closed to new posts, but you can browse existing content.
You can find out more information about the move and how to open a new account (if necessary) here.
If you get stuck you can get support by emailing forums@sitepoint.com

If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Managers View comparison php ruby/rails

First a confession, Iím not a programmer, at least not in the last 10 years or so. I do read many of the books both PHP and recently Rails, just so I am aware of what the tools are capable of. I am a manager of a small development company with a couple of web developers. We have been using PHP for almost everything but as a manager I have a question. It seem like every time I have a PHP programmer look at program written by another programmer the style is so completely different. Custom built libraries, database wrappers vs. native calls, templates vs. no templates, OOP vs. procedural etc. etc. In many cases it is too expensive to make any changes to the application because getting to know the code base takes too long.
Based on my reading of the Rails book it looks like Rails may impose enough structure that the number two programmer may make changes to an existing program with a lot less study time than for a typical PHP program.
Do you think this is true? If it is true I will encourage my guys to migrate over to Rails even though I expect a productivity slowdown during the learning curve.

Rails is going to enforce a certain level of quality (object oriented code, MVC pattern), but that's about it. The best way to enforce code quality is to create and enforce a standard for your coders, and that won't be solved by switching frameworks.

Vgarcia: Do you recommend any php or rails standard. Do you have any samples handy you would be willing to share. As a manager and former programmer I feel a little out of place insisting on something specific as many choices are neither right or wrong but a matter of preference. It does make it a lot harder for maintenance .

If you want to have micro coding standards like "braces after if on the same line", there is a very good solution: emacs. Emacs is an editor with special support for virtually every language through "modes". If you're coding Ruby code, you download ruby-mode. This mode handles indentation, and many other things which are normally done in standards. This will make sure that everyone (if they're using emacs) has the same style.

But this in only a solution for coding standards, not for libraries. The good news is that Rails encourages a certain style:

Rails has a built in database wrapper, template engine, and uses OOP. You COULD do other things, but this is not the obvious path. You have the freedom if you want (this is needed in special situations), but nearly everyone uses the built in template engine, database wrapper, and OO. So this is "cross programmer portable".

Before jumping right into Rails, I would do a pet project in it first, so you'll know how to develop AND deploy. There may be other issues because Rails is so young.

I love this phrase: "cross programmer portable".
Without any real experience it seems as though a PHP program can be just about anything from very bad to very good. The vast majority of PHP code I've read is training code and would not be suitable for production. It looks like the Rails framework strongly encourges even a beginning programmer to use at least adaquite style.

Vgarcia: Do you recommend any php or rails standard. Do you have any samples handy you would be willing to share.

I'm not going to tell you that this

Code:

function whatever(arguments)
{
}

is any better than this

Code:

function whatever(arguments) {
}

That borders on micromanagement in my opinion

What I was talking about was setting a baseline with your programmers, with regard to what libraries are to be used for database calls, templates, etc. For example, with PHP you could say something like "use smarty for templates and use PEAR DB:ataObject for all database interaction". This way, all of your programmers learn and work with the same APIs, shortening the learning curve.

The nice thing about Rails is that all the database libraries, templates, etc. have been chosen for you. If you and your programmers can live with that (or any other framework that's as complete), it can simplify your life

>>>>
The nice thing about Rails is that all the database libraries, templates, etc. have been chosen for you. If you and your programmers can live with that (or any other framework that's as complete), it can simplify your life
<<<<

This is what I gathered by skimming the Agile book. My problem is that my programmers and frankly I believe most programmers, including myself in a past life, change their style and favorite libraries almost every project. I have a hard time working with one of my own projects if it is only a couple years old. If you were to ask me if it would be possible for a changing large group of programmers to create a complicated program like an operating system or web server I would say no. Every new programmer would want to refactor the old code before doing new work and the job would never get done. Obviously Iím dead wrong. Itís the old bumblebee syndrome. Linux canít exist anymore than bumblebees can fly.
This being the problem the fact that the tools have been chosen in Rails and hopefully will evolve at some reasonable pace looks good to me as a manager.
Here is the real problem.
If you want to be a Linux contributor you probably have to spend at least a year really digging into the code before you can contribute anything of high enough quality to be accepted. Certainly worth it for a code base worth millions.
Most of my projects are 5g to 50g. Iím hoping that rails will level the playing field so that I can sell $1,000 worth of modifications to a site and not have it cost me $5,000 due to ramp up if the original programmer is not available.
So far it seems as everyone is agreeing with my original guess. Rails encourages good code that looks similar and should be easier to pickup in the middle.

* Zend Framework - work in progress, but with strong community behind it already. It will most likely be primary PHP framework in the future.
* Symfony - popular PHP5 framework. A lot of code generation and YML files...
* CakePHP - looks like Rails, but not that complete.

Not all PEAR packages have the same quality because there are many programmers involved in them, some of them are PHP4, some PHP5 etc. Really good package of common classes is ezComponents. And the good thing is that they are well designed and made by one team of programmers. PHP 5.1+