Magical Destruction

by in CodeSOD on

Pretty much all object oriented languages have some concept of "destruction": objects need to release any resources they acquired at construction. In a lot of cases, we don't need to customize this terribly much, but when we do, it's vitally important to do it correctly.

Nancy's co-worker perhaps didn't understand the "correctly" part. So this was the standard pattern of C++ destructor that they wrote:


Requirements in Technicolor

by in Feature Articles on

Managing the requirements for an application is a huge challenge. The hardest part of the challenge is that, very frequently, the user's don't know what they really want or need. Prying it out of them, and giving them an application that actually solves the real problem they have, is an art.

The worst situation is when the users are absolutely certain that they do know what they want. This was the situation that Irini found herself in.


Filling

by in Error'd on

We got quite a few irregular submissions this week from regular contributors. Which is to say routine contributors. We're not qualified to make judgements about whether or not anyone is what what most folks would call normal.

First up, Isaac D. is struggling with localization, kvetching "Apparently this number format is ALIVE and WELL in parts of India and Afghanistan, but us poor Australians on desktop browsers also seem to be visually assaulted with it. I wonder if the Zuck will pay me $1,00,000 for reporting it or do real country borders mean nada in the Metaverse? ;)" This would ordinarily be controlled by some operating system or browser configuration, would it not?


The Properties of Contract Development

by in CodeSOD on

James's management had more work than they had staffing for, so they did what any company would do in that situation: expand their staff. No, of course not, I'm kidding. They bundled up a pile of work and shipped it off to the contractor who gave them the lowest bid, provided absolutely no oversight or code-quality standards in the contract, and hoped for the best.

What they got back was a gigantic pile of code that compiled. That is the only positive thing one can say about the code, because it certainly didn't work. Within a few weeks of starting reviewing the gigantic pile of garbage the contractors turned in, the dev team reached the decision that it would be quicker to rewrite from scratch than it was to try and pick apart the trashpile and reshaped the refuse into something approaching their actual requirements.


Going to Great Len(gths)

by in CodeSOD on

Mira was trawling through some old Python code. This particular block of code needed to load some data from JSON. The data was an array, and the code needed to know how long the array was.

Python has a handy len function that does this on anything enumerable. If our developer had used len, we'd be looking at different code today.


Terning On a Control

by in CodeSOD on

One of Tim's co-workers needed to handle a simple condition: if a control in their web app was enabled, show it, otherwise hide it.

Now, if you or I were writing that, we might write some awfully verbose code, like:


A False Comparison

by in CodeSOD on

Iterating across a list is a very simple task. It's a CS-101 type thing, and if anything, it's the one thing I'd expect any developer to be able to do without confusing me too much.

Brendan has a co-worker that wants to change my mind about this.


Nothin Doin

by in Error'd on

IBM Profs was introduced in 1980 including both email and calendaring support. Online calendaring is now old enough to have grandchildren, but we still can't get the simplest things right.

As our friend Romeo rhetorically wonders "Million dollar question: What calendar does Microsoft use?"


Archives