Sep 28th, 2009
by dagfinn.
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 [...]
Sep 3rd, 2009
by dagfinn.
Image by niallkennedy via Flickr
Brandon Savage is writing a series on code improvement using a code example (starting with Peer Review: Taking Code And Making It Better). In other words, it’s about refactoring, which is practically my favorite subject. Although I don’t agree with all of it, it’s mostly good advice. I recommend it.
That said, [...]
Jun 2nd, 2009
by dagfinn.
Image by hartboy via Flickr
My previous example in part 2 was just “hello world”, so I’m going to try for something more like the real world. You may find this example unusual, but it does work. I took the PageRange class I used in my July 2007 php|architect article and converted it to the JavaScript [...]
May 4th, 2009
by dagfinn.
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 [...]
May 2nd, 2009
by dagfinn.
Image by B Tal via Flickr
How confused can a discussion get? As confused as the discussion in the comments to Benjamin Eberlei’s Explicit Code requires no comments – Only bad code does. This discussion has a fake identity, and nobody seems to notice. As you can see, the blog post claims to be about code [...]
Apr 30th, 2009
by dagfinn.
Brandon Savage has written a blog post On Code Commenting And Technical Debt. He believes that code comments are a good way to minimize technical debt.
I’m surprised to find the term technical debt mentioned without being accompanied by the term refactoring. Refactoring is generally recognized (outside the PHP world) as the way to pay down [...]
Apr 21st, 2009
by dagfinn.
Image by Jared Richardson via Flickr
I discovered a video presentation available from QCon SF 2008 by Neal Ford called 10 Ways to Improve Your Code. Although the examples are in Java, most of the presentation is relevant to PHP. There are some ideas here that I’ve never heard of myself, such as “anti-objects”.
Some of the [...]
Apr 12th, 2009
by dagfinn.
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 [...]
Mar 31st, 2009
by dagfinn.
In part one of this series, we looked at the ability to use lambda functions or closures to process arrays. In this part, we will see how closures can be used to build classes in a completely new way.
After I did my own research, I discovered that someone had beat me to it. As early [...]
Mar 24th, 2009
by dagfinn.
Image via Wikipedia
On the carafe belonging to our coffee maker, there is a barely discernible spot that tells you how far to unscrew the lid in order to open it so that you can pour coffee from it without getting a flood of it in your lap. I never found this spot until it [...]