Category: Application design
Max Horvath has implemented a library for type hinting scalars.
That interests me, since I find that type hinting for objects has limited usefulness.
I tried using type hints extensively from an early beta version of PHP 5. I mostly gave up on them for...
I came across a Zend Framework (ZF) example I wanted to refactor. You
really have to have unit test coverage to refactor effectively, and since
there were no tests, I started trying to find out how to test it. There
didn't seem to be a wealth of information available on the web, so I've
...
Redirects are useful in web programming, especially when implementing the Post-Redrect-Get pattern . But there is a problem with redirects: there is no simple way to send a message to the user across the redirect. When processing a GET request, you can display whatever messages you want. The...
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...
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...
Everybody who writes object-oriented code knows about constructors. You need them so the program knows how to instantiate objects, right? And you especially need them when a lot of things have to be done while instantiating an object. And personally, I've never considered visibility...
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...
Implementing a new piece of software is working with a black box that doesn't even exist yet. You know something about what's supposed to come out of the black box, but typically not much. So where and how on earth do you start? Let's say we know one thing about...
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...
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...
Having immersed himself in some hideously coded PHP application, Alan Knowles lists six deadly PHP sins in a recent and very illuminating blog entry. Maybe it just wasn't present in that particular example; for whatever reason, he didn't mention my particular favorite: the script...
Inspired by a thread in the Sitepoint PHP application design forum , I went looking for some open source blogging software that was reasonably well designed. The reason was that I wanted to be able to modify the application if necessary but without having to enter "the heart of...