Interview: Mike Ho of QCodo

This is the second in a series of interviews we're making available to the CodeSnipers community. We have been working to track down people who we thought had something valuable to say about the software development community, tools, practices, or direction. Some of the names you will recognize immediately, others you've probably never heard of, but all of them have made an impact in one way or another. Without further delay... we have Mike Ho the lead developer of Qcodo.

Qcodo had its debut at the Zend/PHP Conference in October and few in our community were there. Can you tell us about how Qcodo came about and what it does?

Well at the risk of sounding like “yet another PHP framework”, Qcodo is in fact a PHP development framework.

It is focused on allowing development teams create good, solid prototypes in a ridiculously short amount of time, and for giving developers a toolset to mature these prototypes into full-fledge enterprise-level applications.

At its core, Qcodo is broken down into two main parts: the Code Generator and Qforms. The Code Generator focuses on analyzing your database to create basic Create, Restore, Update and Delete (CRUD) functionality. Qforms is an object-oriented stateful, event-driven architecture to handle web page and HTML forms processing, similar to .NET or Java Struts. Both obviously work with each other seamlessly. But you could definitely choose to just use one or just the other.

The entire framework originally started out over 4 years ago as just a simple but robust Microsoft SQL Server and ASP code generator while I was working as an independent contractor. Since then, it has been rearchitected and greatly improved upon throughout the years, first being ported to ASP.NET. Over a year ago it was redesigned specifically for PHP 5 and has been made into a full-fledged development framework for use with the many projects I have been fortunate enough to work on. Throughout Qcodo’s life it has been used on a wide variety of projects on all these platforms, from small startups to Fortune 500 companies like Covad and Lockheed Martin and large government agencies like Chicago Public Schools and NASA.

Earlier this year, I was fortunate enough to be invited to speak at the MySQL User’s Conference, where I talked about the code generator, specifically, and how code generation techniques could be used to greatly accelerate enterprise application development. The feedback was so overwhelming, not only for the technique, but for the code generator itself, that I realized that the market has a huge need for not just the code generator, but an entire framework like Qcodo to be open sourced. So I spent the next couple of months cleaning up the code and ensuring that it was clear of any proprietary or IP constraints, and released it as an open source framework in time for the Zend/PHP Conference.

HTML Helpers - Ruby Wannabes in PHP

I've gone back and forth on the idea of using ALL html generation functions to hammering it all out in a template like Smarty. Templates are nice, It sure is nice to use functions. I was looking at RoR and saw these HTML helper functions. I thought, hey I can write them in php. (Yeah to all you php hating ruby folks, this may be an effort in futility, but thinking how to implement some of these things in PHP helps me understand the concept, like my MVC articles)

Implementing just a few… Here's what I came up with:

Master Plan v0.2

CodeSnipers has been growing pleasantly over the past few months and I believe it's reaching a critical tipping point. After the holidays, there are going to be a series of announcements about new functionality, areas, and ideas that will be coming about in this little community. If all goes well, some of them may happen when they're announced.

Anyway, towards this goal, I'm looking for a few brave people to share their thoughts, bare their souls, and generally start a discussion with the community. I'm not looking for just any people, but people with particular skills:

First, I need a .htaccess/mod_rewrite wizard. I'm not looking for any work to be done, but just to get some questions answered and bounce some opinions around.

Internationalization (i18n)

In order to offer localized versions of an application, there are two things to be taken care for:

  • Internationalization (i18n): this is more development centric and it's all about designing your application to support translations, foreign character sets, timezones, different number / currency / date formats etc.
  • Localization (L10n): using the mechanism provided by i18n, this includes the actual translation and settings for a new language.

On this article I focus mainly on the translation part of the i18n process, although many other subjects are touched.

Caveman PHP Debugging

Certainly it's possible to have nice debugging tools for php (ZEND has one), unfortunately I have not had the experience of any so I will tell you how I debug php - caveman style!

Poke it with a stick
Sometimes, you aren’t sure if the code is getting to a certain line. For quick checks I put

print "here";

That’s fine until I get interrupted or go home only to come back the next day and wonder, huh? where did I put that line??

Stupidly Easy MVC in PHP or "We don't need no stinking framework!" (Part 2)

If you haven't read Part one, go do it! It provides the background for these classes.
In Part 1, I explain my base classes: MVC_Controller, MVC_View and MVC_Model. For my simple links application I extend the model class and the controller class. I did not need to extend the view for my purposes.

As I said before, the "action" variable is actually the name of the method you want to run. I listed the actions previously that I will need (planning ahead, what a concept) so it makes it easy to implement now:

Stupidly Easy MVC in PHP or "We don't need no stinkin' framework!"

One day I sat, faced with this huge 'god' class that managed view, edit, add, delete for two components in one page. There was no value to having all that in a class, other than having a nice neat little "package." I considered breaking it into two classes, one for each component (which was really in the end one) but keeping the same basic methods … ehh, that didn't sit too well with me. I wanted to use templates, make it super easy to update when the powers that be changed their mind or wanted to add something. Then ... after a day of staring it and it and making some notes -- a light bulb went off in my little head. I fired up my laptop, opened some ruby files I had made. Looked at a "controller" file... ok... then looked at a "model" file... ok... then looked at a view file... Ah ha! Bingo.

Not wanting to start a whole new honking framework package (although for the first time I had a fleeting thought, HEY I can start a sourceforge project!!!) just for this one small app... I didn't want (and probably would have a hard time getting approved by sys admins) a framework like Solar, PHPOnTrax, CakePHP or Cerebral Cortex (whew! did I miss any?). But, this was so stupidly easy... and I just had one little application..

Data Types - PHP Vs Ruby (Part 2)

Ruby's types are actually objects with methods, which is different than PHP's primitive types. At first, I thought I'll have to do something like

age =

Not so, in fact the number classes don't even have a new method. Declaring a value to be a number is:

age = 28;

I'm sure there's some fancy word to describe the magic that happens. I like automagically.

Data Types - PHP Vs. Ruby

In conversation with a fellow PHP person now doing Perl, he asked… how does Ruby do types?? And I thought I knew how to answer him, but then when I opened my mouth I found I didn't have the words.

PHP is not a strongly typed language. You can assign $foo an integer, print it (even though it does not contain a string), assign an array and so on. PHP doesn't care.

However, if you want to be certain of the type in a variable there are a few functions to help you out.

settype($var, [type]);

example, to make sure these types

settype($foo, "bool"); // also could use "boolean"
settype($bar, "int");

The Saga Continues: Language tidbits in Ruby Vs. PHP

I wrote a simple math quiz game in Ruby, its one of the first things I wrote as a kid when I was learning GW-Basic (sigh, those were the days!). I found a few surprising differences in Ruby that I'm used to in PHP. Here are a few tidbits I discovered.

Increment Operators
You know these, its what you have in every for statement and quite often used in other looping structures. It PHP its used like $var++ and $var-- … which as we know, is to increase the value in the variable by one or subtract by one respectively. Well to my surprise (and failed Ruby code when I tried it) they aren't in Ruby. You have to use var += 1 and var -= 1 . weird huh? I wonder if this will change in future versions of Ruby. It's not THAT big of a deal, but I was surprised. I suppose it makes it easier later when you want to increase by 2 or 3. But, having a standard way to only increase by ONE is a good idea as a check against the programmer. What if they accidentally hit the 2 or 3 instead of a 1?