PHP in Action Rotating Header Image

Posts under ‘PHP’

The psychology of test-driven development

Silvan Mühlemann has written an excellent piece titled Unit testing makes coding more fun. I keep saying that sort of thing, too. I also say it raises your IQ. But when I attended a presentation by Uncle Bob (Robert C. Martin) last summer, I was mildly shocked to see that he described TDD as tedious [...]

I want enums in PHP

I want Enums in PHP I’m currently working about equally in PHP and Java. I can’t say I’ve fallen in love with Java. But Java does have a feature or two that would be useful in PHP. One of them is the Enum (enumeration, that is), which is traditional in some languages and DBMSes (including [...]

Immediacy and frameworks

As if to remind us that not everyone in Ruby hates PHP and vice versa, Rails creator David Heinemeier Hansson commends the immediacy of PHP. I'm vaguely wondering if he's also understood the potential of the smooth, agile ride from the immediate to the complex. Probably not. To quote myself from the Sitepoint PHP Application [...]

Testing Smarty templates

I follow the principle that you should test everything that could possibly fail. And I would like to have unit tests for everything; tests that exercise each small behavior in isolation. The components that are easiest to unit test are typically class and methods in plain object-oriented code. Not everything falls into that category, though. [...]

Paparrazzi testing

Uncle Bob (Robert C. Martin) has blogged about testing GUIs (web interfaces, that is; JSP and Rails) without having to run a web server. I don't think it answers all the challenges I'm up against currently, but it inspired me to some heavy thinking about the essential issue of complete and not too cumbersome test [...]

And by the way, the book is in print…

Again a somewhat belated announcement: PHP in Action is in print. My copies of it arrived at my doorstep while I was in Crete, with no clear indication that would have allowed my brother, who was hovering helpfully in the vicinity, to guess what it was. I guessed it, though. But DHL couldn't give any [...]

PHP UK Conference

I went to the UK PHP conference, and now finally I get to blog about it. There was actually a “blogathon” following the conference, but I had to leave early to get the blissful experience of returning to snowed-down Norway half asleep in the middle of the night. Where are all the other blog posts [...]

Tips for web testing

I just started listing the techniques I've learned when writing tests to exercise the web interface of a PHP application. This is from my experience and my personal preferences; it's not the final word or necessarily right for everyone. The idea of being able to record and play back tests, as you can do with [...]

Secure Request object

I'm reading Chris Shiflett's Essential PHP Security. He suggests making sure all input is filtered by putting it in an array called $clean after it's filtered. This is a way to make sure you don't forget to filter any input, so that only filtered data enters the bowels of the application. I like the idea, [...]

Feature-revealing code

Making names “intention-revealing” is a well-known principle in object-oriented programming and design. You want the names of methods to communicate their purpose rather than their technical implementation. A related question is: how much should the code reveal about what's going on at a lower level? An illustrative example is the PEAR package HTML_Quickform, which handles [...]