Decoupling models from the database: Data Access Object pattern in PHP

Monday, January 5th, 2009

Nowadays it's a quite common approach to have models that essentially just represent database tables, and may support saving the model instance right to the database. While the ActiveRecord pattern and things like Doctrine are useful, you may sometimes want to decouple the actual storage mechanism from the rest of ...

Food for thought: utilizing models in MVC

Saturday, December 6th, 2008

"What is a model" and "Is Zend_Db_Table a model" seem to be asked once in a while on #zftalk. Frameworks say they have a full model available, thus they are MVC frameworks ORM libraries say they generate models. It seems the ActiveRecord pattern has become somewhat synonymous with model. Pádraic Brady ...

Base classes in OOP programming languages

Wednesday, November 19th, 2008

David Otton posted a short but thought-provoking post about stdClass, which many think is the "base class" all PHP classes automatically inherit from. I have to admit that I had this misconception as well. On the other hand, "true" OOP languages such as C# and Java both have a base class ...

You should know at least three languages

Saturday, September 20th, 2008

I think a good programmer should know at least three languages: English C or C++ A scripting language with dynamic typing Why?

Theory vs. Practice in coding

Tuesday, September 9th, 2008

When working on a project, I sometimes find myself stuck - thinking about some implementation detail, such as how to tell my admin-module which other modules are installed in my CMS (but that's another story) - and being stuck, unable to get anything done, just thinking of the problem at ...

On template “tag soup”

Tuesday, July 22nd, 2008

Jeff Atwood's latest post (at the time of writing this) talks about mixing HTML markup and server-side code, àla He also throws in the question: Is there a better way? - However, it seems there's at least as many ideas of a ...

Dependency Injection, or how to make simple concepts sound difficult

Saturday, June 21st, 2008

You may have heard of Dependency Injection. It's essentially a way to remove implementation dependencies from classes, or "the process of supplying an external dependency to a software component. It is a specific form of inversion of control where the concern being inverted is the process of obtaining the needed ...

Is web application development less challenging than desktop application development?

Monday, June 16th, 2008

I have heard several times that what I do is not "real programming" - web application development is supposedly less challenging than "proper" desktop application development. But is it really so?

Is PHP a good first language?

Thursday, May 1st, 2008

Sometimes I've seen people say PHP is a bad first language, because it teaches bad programming habits. But is this actually true at all? Often those who say that don't really like PHP themselves either, many times because of equally untrue reasons. I think PHP is a perfectly good first programming ...

Django and Python

Tuesday, April 29th, 2008

I've thought it would be useful, both professionally and just for fun, to know a bit wider array of frameworks, libraries and other stuff related to web development, and last week it was Jaxer time. Now, I've got my hands on Django, a Python-based web framework. I've always liked Python - ...