PHP Frameworks are Governments

I was e-mailing a friend the other day talking about PHP frameworks. He’s been writing one for himself and I’ve written many many frameworks and CMSs through the years. I’ve also looked at a lot of existing frameworks out there like Zend, CodeIgniter, CakePHP, Solar, Symfony and I’ve come to a conclusion. There are a lot of similarities between PHP frameworks and governments.

If you don’t use a framework of some sort (I’m using a loose definition of framework) you would have anarchy. I’ve seen a lot of anarchy in PHP code. No consistency, code all over the place, probably insecure.

There are Libertarian frameworks, that provide some structure and common libraries but generally leave you to your own devices. They are lightweight, so they don’t use up too many resources and they are flexible. A Libertarian framework will probably not force you to use an ORM to connect to the database.

On the other end of that spectrum are the Fascist frameworks. They tell you how to lay out your code, how to write your controllers, how to write your templates and don’t even think about writing a line of SQL because you’ll be using ActiveRecord. These work because you don’t have to think much. Everything just works, you don’t have SQL injection problems, everything is filtered properly and forms are a piece of cake (as long as you don’t care how they look.)

Where does your favorite framework fall on the political spectrum?

A Brief History of Me Programming

I’ve been programming in one form or another for as long as I can remember. Since my family got it’s first computer when I was five I couldn’t have programmed much before that. However I knew DOS well enough to help teachers with their computers in first and second grade so I was probably already doing some programming by then. It wasn’t sophisticated by any means, just simple code like:

10 print "Hoopla!"
20 goto 10

I’d type in code from books, like Superworld which was geared towards kids. I remember reading various computer magazines my school subscribed to (Byte comes to mind). In school we had a class where we could play with Logo.

There was an older kid on my bus who had a TI-81 and I was always amazed by it. He would write games for it and I thought that was neat. Needless to say when I entered 6th grade and had my first math class that required a calculator I convinced my parents that the TI-81 was the appropriate calculator (requirement was a scientific calculator). I learned how to program that pretty quickly, it was similar to basic which I had some experience with. The TI-81 didn’t have a graph link so I’d print out programs from the internet and type them in. I remember printing out some Star Trek game that took me over a week to type in.

When I got to high school I needed a more powerful graphing calculator. I got the TI-85 which was a major improvement from the TI-81. Not only was the TI-Basic on it more sophisticated but I now had a link port so I could download programs from the internet and copy them straight to my calculator without having to type anything. This gave me many more options. I could also trade games with other students at school. One of the early ones I remember was a breakout game. It wasn’t long before I learned how to add new levels and started hacking it to do different things.

Then I discovered ZShell. This was a hack for the TI-85 that would allow people to run programs written in assembly. So I jumped on that and started teaching myself assembly for the Z80 processor. By this time I had my own laptop so when I had a gap in the offered computer science classes at school I convinced the computer science teacher to approve an independent study class for me to learn assembly. The teacher wasn’t any help but I still figured it out pretty quick.

The following year (Senior year) I took AP Computer Science which taught C++. I picked it up very quickly and the teacher was smart enough to let me go at my own pace. I finished the coursework for the three term class (24 weeks) in about 8 weeks. The remainder of the time I started learning more things, like graphics programming. By the end of the class I had written a Mandelbrot set generator. I was pretty happy with myself.

After graduation I attended UW Whitewater for a bit. There I studying Java. Then I transfered to Herzing College where I learned VB .Net, as well as covering Java and C++ again.

At Herzing I started teaching myself PHP so I could do better things with my website. My first programming job at Applied Tech started out as an ASP job but very quickly transformed into a PHP job. There I developed my skills in PHP. I’ve been programming in PHP since then and have since stared the Madison PHP Meetup group.

I’ve played around with some other programming languages since then, but haven’t gotten in too deep. I’ve played with Ruby, Python and C#.

Along the way I’ve done some Javascript (comes with doing web programming for a living). And now I’m digging deeper into it. I’m constantly surprised by the interesting things Javascript can do that I haven’t seen in any of the programming languages I’ve used before (anonymous functions anyone?).

What will my programming future be? Who knows. PHP and Javascript will probably be major players for the foreseeable future. Although I’d like to get back into doing some non web-based programming. For the time being I’ll probably play around with C# some more.

PHP Bugtracking

So I am currently looking for good bug tracking software. I have a few requirements, some of which I’m sure are unreasonable. First the code needs to be able to run without errors, warnings or notices in PHP 5.2 (using php.ini-recommended) and it’s an extra bonus if it works under E_STRICT. It should either use no database or MySql. It should not require funky extensions, python or perl.

A few that I’ve tested out:

The only two that meet my requirements are Mantis and ActiveCollab. Neither one however stands as a clear winner though.

As it stands Mantis is in the lead. It looks like a very capable bug tracker however the interface leaves something to be desired. It seems overly busy and it’s not always obvious where you should be going to do things. Like to add a project you have to:
Manage > Manage Projects > Create New Project
I’m also not clear where to administer categories.

ActiveCollab on the other hand has a wonderful user interface. However it isn’t actually a bug tracking system yet. It’s a project management tool like Base Camp. I can create projects and tasks but tasks are either outstanding or completed. There is no way to comment on the tasks or mark them as complete, pending, not a bug, etc… Bugtracking is on the roadmap for 0.7.5. For a 0.7.0 release it’s really slick and very usable.

So I’m left not really satisfied with my findings. I don’t want to write my own but I may anyways. I’ll be really happy with ActiveCollab when bugtracking is added in 0.7.5.

PHP Works 2006

The conference this year was a lot of fun. I found the talks to be weaker then I remember from previous years. Perhaps I chose poorly. Two of the best talks I attended were “The State of AOP in PHP” by Sebastian Bergmann and “Organizing Your Projects” by Paul M. Jones.

“The State of AOP in PHP” was really cool because I wasn’t particulary familiar with AOP (Aspect Oriented Programming) and to get a rundown of what it is and how it might be used was really cool. It’s like having triggers for object oriented programming.

“Organizing Your Projects” was cool. Perhaps I’m a bit biased because I’m a big fan of Paul M. Jones‘s projects Savant and Solar. But I though what he presented made so much sense and could help so many people. The one idea he really tried to drive home was to not pollute the global namespace. I’ve been trying to do this at work for a while (unfortunately not 100%) but when I created a filter class I named it CTG_Filter (CTG stands for Clarity Technology Group). Some areas he mentioned I never even thought of like session variables. Either way it was a great presentation.

PHP/DB | Works 2006

I just arrived in Toronto yesterday for the third PHP Works conference I’ve attended. The last two years were incredible and I have no doubts that this year will be great as well. I will try to post several entries while I’m here detailing what talks I’ve attended and such. Today is the all day seminars.

Assuming that the schedule stays the same I think I’ll attend “AJAX and PHP Boot Camp” in the morning and “Advanced XML and Web Services” in the afternoon. The session “Extending PHP” sounds interesting but I attended an extending PHP talk last year and it went over my head. I understood some of it but C isn’t my strong point so if I get better at C then I can take a crack at extension writing.