PHP in Action Rotating Header Image

Posts under ‘Application design’

Bad code is good for you?

Image by Balakov via Flickr

In The importance of bad code (or, WordPress and why I am a psychic), Marco Tabini proposes the idea that we need bad code. Or at least that we should be tolerant of bad code in open source projects because that invites participants that might otherwise not contribute.
This is an interesting [...]

Sounds like an average PHP app to me

Image via Wikipedia

Dean Wampler blogs: Is the Supremacy of Object-Oriented Programming Over?
“The fact is, for a lot of these applications, it’s just data. The ceremony of object wrappers doesn’t carry its weight. Just put the data in a hash map (or a list if you don’t need the bits “labeled”) and then process the collection [...]

Real programming with PHP 5.3 (part 3): Links

Image via Wikipedia

After the previous post in this series, additional independent implementations of the idea of JavaScript-style classes have turned up. So I’m going to list them and comment briefly on the differences. I hope this will be helpful to anyone who actually wants to use this in practice and needs to decide on the [...]

Smart return values

Image by cackhanded via Flickr

Davey Shafik discusses return values from functions. In the specific case of a function that returns values from a database, he wants to return false on error and an empty array if the data set is empty. He also has a reason for that:
“However, it’s very rare that I care about [...]

How code comments deteriorate

There was a lot of disagreement on the value of code comments after my earlier post Comments considered harmful. Perhaps the most important objection that was raised was the idea that it’s OK to improve the code, but it’s even better to keep the comments in addition to the improved code.
As one [...]

Comments considered harmful

There is too much old advice in PHP. A recent case comes from the PHP Advent calendar. Eli White is a strong believer in commenting code, including inline comments inside functions.
Unfortunately, he’s at least 10 years too late. This used to [...]

The one-line web framework

The core of your average web framework is a Front Controller. Front Controllers are commonly considered complex and esoteric. That’s a myth. I sometimes brag that I can construct a Front Controller in 15 minutes. Actually, it’s doesn’t take quite that long. In PHP, a Front Controller can be simplified to just one [...]

How to test everything

They say there’s no free lunch, but at least there’s free breakfast. Last week I attended a “breakfast seminar” with Robert C. Martin (Uncle Bob). There really was free food.
Anyway, Uncle Bob held an extremely entertaining and useful introduction to the FitNesse testing tool. He got me hooked on it, but I’m even more fascinated [...]

More beautiful code

I got some interesting comments to my previous post on “beautiful code”. Some were pretty strong disagreements.
So am I wrong? Did I get carried away? Did my critical faculty go on vacation somewhere nice and sunny? I admit that sometimes I deliberately look at the positive and ignore the negative. (And sometimes [...]

Beautiful code

Max Horwath has published his slides on Making Selenium Test Writing easier using a DSL onlinefrom IPC 2008. Let me quote the whole short description:
Implementing automated tests by using Seleniums API methods has several [...]