It takes a big man to admit when he’s wrong, and @dilbert4life is one of those men. Here’s a snippet of horror that he wrote around a year-and-a-half ago.
Too many defines? Nay! I say let the site grow and see just how many we can stuff in there.
Starting with this post, we have a new category here at CSI: PHP. It’s called
‘ mea culpa ’, and it’s criminal
code written by yours truly.
and HTML. It’s the only function in a file called common.php, which makes
perfect sense because …
Seriously. Stop it. Or you’ll end up with garbage like this, in which a developer
writes two separate functions for converting JSON to
an array, only one of which is compatible with json_decode .
Yes, both are in production.
CSI: PHP investigator Duane Gran sent in this horrifying snippet. He explains:
I wondered why dumping the $_POST variables before this section didn’t help
in debugging. This occurs in a second step of a 3-step form on a GET request.
It applies a set of session fields to the $_POST variable for later use. …
Yesterday, Zend Framework 2.0 and Symfony 2.1 were released... almost at the
same time. First, I want to congratulate the Zend Framework team for this huge
milestone; I know that working on a new major version is no small task.
And of course, people started to ask questions about these new versions and
one of the …
Perhaps this developer decided it would be better to create convenience methods than to litter their codebase with date format strings. Nothing wrong with trying to DRY up your code, but creating 13 inscrutably named date formatting functions ain’t the way to do it.
HTML5 has a lot of cool things in it, but the one thing I wish I could remove are data-attributes, because of the crimes against clean front-end code that it seems to encourage.
What is this clean web code you speak of?
There is this one thing that I noticed recently and that concerns me: PHP devs don’t use functions.
Now, that was overly general, so let me clarify: PHP developers who have reached a certain degree of sophistication
basically stop using plain functions - instead everything goes all classes and methods. At least …
I love object-oriented design. It’s like open source software in general; perfect strangers come up with ideas that can save me time and money and then, out of the goodness of their hearts, go to a fair amount of trouble to pass these ideas on. I benefit from their efforts every day.
However, you don’t have to go …
Rants about PHP are everywhere, and they even come from smart guys. When Jeff
Atwood wrote yet another
about PHP, it made me think about the good parts of PHP.
The biggest problem of these rants is that they come from people stuck in the
old days of PHP. They either don't care or they don't want to admit that …
For the English readers of my blog : this post is for Belgian users who want to use Sporza.be (a big Belgian sports site) without all the soccer content, since that usually fills over 80% of the site. So the content is in Dutch, sorry
Sporza zonder al de voetbal… niet ideaal voor de voetbalfans, maar die hebben …
As a PHP developer, I’ve often been faced with the task of ensuring something happens on a recurring schedule or determining the next date in time an event will occur.
At my previous job, we needed to run scheduled Gearman jobs on a recurring basis. We chose to use cron as the serialization format of our
I’ve often needed to ensure that something happens on a recurring schedule. At a
previous job, we needed to run scheduled Gearman jobs on
a recurring basis. We chose to use cron as the serialization format of our
schedules, and implemented a database driven system for storing these schedules.
Storing the cron …
We’ve all had those tough conversations on how best to exchange dates between two systems: “is DD-MM-YYYY good for everyone?” “what about YYYY/MM/DD” “we could just use Epoch timestamps”…
Each option is rife with problems; some don’t convey enough info, some are too ambiguous, and others are hard on the human eye. …
Today is my " let open source some of my private Github repositories " day,
and more specifically, I'm releasing a bunch of code related to documentation.
Earlier today, I've released the Sphinx
extensions I'm using to generate the
And now, I'm releasing my API documentation
generator . …
Steve Klabnik just posted an interesting post about mixins . Steve is a really smart guy, and I usually agree with him, but I think his justification is a little bit weak in this case.
Mixin Refactoring through Class Gutting
Oh man, he is so right that this is an anti-pattern. It happens a lot in ruby, someone …
One of the most valuable ideas from functional programming is the idea of Higher Order Functions , or functions that take functions as an argument. It is such a good idea that it has become part of pretty much every modern language, whether functional or not. Amoung the OO imperative languages that have embraced this …