// you’re reading...

Personal

PHP Dynamics

PHP

Learning PHP for an upcoming project, my expectations of the language are finally meeting the real world deal. After almost two years of Ruby development, this seems like a backwards move, but I have to admit that PHP has a well established community, offering a lot of content. CompSci.ca runs on PHP technology – Forums, Wiki, and even this Blog. Ultimately the study will only expand my webdev portfolio, and offer a better understanding of software that I already use.

Syntax is a setback. Having been spoiled by Ruby’s natural like code, PHP seems messier.

names.each{|name| name.method }

Though the move from pure object oriented structure, to function heavy architecture proves to be just a grammatical adaptation, having the order of words shuffled.

foreach ( $this->names as $name ) { method ( $name ) }

Ruby’s Framework is dear to me, and it pains me to let go of Rails. Rapid MVC development, and clean next-day demos have helped me persuade my previous employers to let me use Ruby for my projects. Scaffolding out a new model is an impresive trick, but something similar could be done with PHP as well.

Better yet is CakePHP – a rapid development PHP framework based on Ruby on Rails itself! 1.1.7 release takes it well out of Beta, and an active community behind the project keeps the development and resources up to date. CakePHP offers the same impressive demo capabilities as Rails’ famous Blog in 15 Minutes, with a full walkthrough.

The familiar RoR controller

class PostsController < ApplicationController
def index
@posts = Post.find(:all)
end
end


Is echoed by the now warm glow of CakePHP familiarity

class PostsController extends AppController
{
function index()
{
$this->set ( 'posts', $this->Post->findAll() );
}
}

The similarity is reassuring, and so I am looking forward to bringing some of The Ruby Way practices over to the PHP community. This should prove to be a fullfilling experience.

Read more



Discussion

  1. Posted by CompSci.ca Blog » Looking back at working with PHP | December 25, 2006, 2:04 pm

    [...] About 4 months ago I have started learning PHP, as my web development job was going to require it. I have never done any PHP programming before, and now that the work-term is over, I wanted to look back and reflect on what I have learned. In short, the experience was packed with large projects, technical difficulties, new syntax and tools, but I walked away feeling empty. Sure, PHP has now made its way on my resume with a solid background, but personally I just did not feel the same as the term I got to work with Ruby. [...]

Post a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>