Programming is Hard

by in Editor's Soapbox on

A bit ago, I popped into an “Explain Like I’m 5” thread to give my version of the differences between C, C++, Objective-C and C#. In true Reddit fashion, I had the requisite “no five year old could understand this” comments and similar noise. One thing that leapt out to me was that a few commenters objected to this statement: “Programming is hard.”

The most thorough objection read like this:

Every Possible Case

by in CodeSOD on

Road cases 2

From reader Frank comes this delightful Java-flavored head-scratcher:

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.


by in Feature Articles on

Steven worked for Integrated Machinations, a company that made huge machines to sell to manufacturers so they could actually manufacture stuff. He didn't build the machines, that would require hard physical labor. Instead, he wrote computer programs that interfaced with the machines from the comfort of the air-conditioned office. One such program was a diagnostic app used to log the performance of Integrated Machinations products. The machines didn't break down often, but when they did, logging was very important. Customers wouldn't be in a mood to hear that IM didn't know why the equipment they dropped fat stacks of cash on failed.

Text-xml file-type image Steven also had a subordinate named Thomas, who was foist upon Steven in an effort to expand the small development team. Steven could have easily handled everything himself, but Thomas needed something to do so he was given the simplest part of the diagnostic app - the downloader. Steven's code handled the statistical compiling, number-crunching, and fancy chart-making aspects of the application. All Thomas had to do was make the piece that downloaded the raw files from the machines to pass back.


by in Error'd on

"In life, there are good surprises and bad surprises, but Microsoft fails to differentiate," writes Rob

As The World Ternaries

by in CodeSOD on

Ah, the ternary operator. At their worst they’re a way to obfuscate your code. At their best, they’re a lovely short-hand.

For example, you might use the ternary operator to validate the inputs of a function or handle a flag.

Cache Congestion

by in Feature Articles on


Recently, we featured the story of Alex, who worked in a little beach town trying to get seasonal work. But Alex isn't the only one with a job that depended entirely on the time of year.

Exceptional Condition

by in CodeSOD on

“This is part of a home-grown transpiler…”, Adam wrote. I could stop there, but this particular transpiler has a… unique way of deciding if it should handle module imports.

Given a file, this Groovy code will check each line of the file to see if it includes an import line, and then return true or false, as appropriate.