Remy Porter

Remy is a veteran developer who writes software for space probes.

He's often on stage, doing improv comedy, but insists that he isn't doing comedy- it's deadly serious. You're laughing at him, not with him. That, by the way, is usually true- you're laughing at him, not with him.

Zero Competence

by in CodeSOD on

Michael had a co-worker who was new to the team. As such, there was definitely an expected ramp-up time. But this new developer got that ramp up time, and still wasn't performing. Worse, they ended up dragging down the entire team, as they'd go off, write a bunch of code, end up in a situation that they couldn't understand why nothing was working, and then beg for help.

For example, this dev was tasked with adding timestamps to a set of logging messages. The logs had started as simple "print" debugging messages, but had grown in complexity and it was time to treat them like real logging.


The Saddest Words: What If

by in Coded Smorgasbord on

Conditional statements, we would hope, are one of the most basic and well understood constructs in any programming language. Hope, of course, is for fools and suckers, so let's take a look at a few short snippets.

Our first installment comes from Jonas.


One Month

by in CodeSOD on

Joseph sends us a tried and true classic: bad date handling code, in JavaScript. We've all seen so much bad date handling code that it takes something special to make me do the "confused dog" head tilt.

		var months=new Array(13);
		months[1]='January';
		months[2]='February';
		months[3]='March';
		months[4]='April';
		months[5]='May';
		months[6]='June';
		months[7]='July';
		months[8]='August';
		months[9]='September';
		months[10]='October';
		months[11]='November';
		months[12]='December';
		var time=new Date();
		var lmonth=months[time.getMonth() + 1];
		var date=time.getDate();
		var year=time.getFullYear();
		document.write(lmonth + ' ');
		document.write(date + ', ' + year);

A Little Extra Padding

by in CodeSOD on

Today's anonymous submitter supplies us with a classic antipattern: padding via switch:

string TransactionOrder = (string)dr["TransactionOrder"].ToString().Trim();

switch (TransactionOrder.Length)
{
        case 1:
                TransactionOrder = "000" + TransactionOrder;
                break;
        case 2:
                TransactionOrder = "00" + TransactionOrder;
                break;
        case 3:
                TransactionOrder = "0" + TransactionOrder;
                break;
        default:
                TransactionOrder = TransactionOrder;
                break;
}

Ready Xor Not

by in CodeSOD on

Phil's company hired a contractor. It was the typical overseas arrangement: bundle up a pile of work, send it off to another timezone, receive back terrible code, push back during code review, then the whole thing blows up when the contracting company pushes back about how while the code review is in the contract if you're going to be such sticklers about it, they'll never deliver, and then management steps in and says, "Just keep the code review to style comments," and then it ends up not mattering anyway because the contractor assigned to the contract leaves for another contracting company, and management opts to use the remaining billable hours for a new feature instead of finishing the inflight work, so you inherit a half-finished pile of trash and somehow have to make it work.

Like I said, pretty standard stuff.


A Set of Mistakes

by in CodeSOD on

One of the long-tenured developers, Douglas at Patrick's company left, which meant Patrick was called upon to pick up that share of the work. The code left behind by Douglas the departing developer was, well… code.

For example, this block of Java:


While This Works

by in CodeSOD on

Rob's co-worker needed to write a loop that iterated across every element in an array. This very common problem, and you'd imagine that a developer would use one of the many common solutions to this problem. The language, in this case, is JavaScript, which has many possible options for iterating across an array.

Perhaps that buffet of possible options was too daunting. Perhaps the developer thought to themselves, "a for each loop is easy mode, I'm a 10x programmer, and I want a 10x solution!" Or perhaps they just didn't know what the hell they were doing.


Enterprise Code Coverage

by in CodeSOD on

Alice has the dubious pleasure of working with SalesForce. Management wants to make sure that any code is well tested, so they've set a requirement that all deployed code needs 75% code coverage. Unfortunately, properly configuring a code coverage tool is too hard, so someone came up with a delightful solution: just count how many lines are in your tests and how many lines are in your code, and make sure that your tests make up 75% of the total codebase.

Given those metrics, someone added this test:


Archives