Recent Coded Smorgasbord

Inspired by the Pop-up Potpourri, the examples presented here aren't necessarily "bad" code nor do they imply the miserable failure that we're all used to reading here. The examples are more-or-less fun snippets of code like ones that we've all written at one time or another.

Sep 2016

Properly Handled PHP

by in Coded Smorgasbord on

It’s tempting to pick on PHP, because PHP is a terribly designed language. At the same time, there’s an air of snobbery and elitism in our mockery of PHP. I mean, half the Web runs on PHP, so how bad can it be? These examples could easily have been written in nearly any other language, and they’d be just as bad in those languages too. Is it fair to single out PHP? Perhaps not, but each of these examples does nothing- or nearly nothing- which may very well be PHP’s greatest asset.

As a case in point, Ethan inherited some code. It needs to count how many sub-directories there are in a certain directory.


What You Don't See

by in Coded Smorgasbord on

Many times, when we get a submission of bad code, we’re left wondering, “what else is going on here?” Sometimes, you think, “if only I knew more, this would make sense.” More often, you think, “if I knew more, I’d be depressed,” because the code is so clearly bad.

For example, Devan inherited a report, built using SQL Server’s Reporting Services Report Builder tool. Now, this tool is not intended as much as a developer tool, as a “if you can use Excel, you can make a report!” It uses Excel-style functions for everything, which means if you want to have branching conditional logic, you need to use the IIF function.