Recent Articles

Oct 2005

Doing What You Say, Saying What You Do

by in Feature Articles on

Diogo is part of a "specialist" team that was brought in to replace a handful of other developers who had spent the past year or so unsuccessfully building an accounting system. Since the project was months behind deadline and had never produced a working deliverable, management dismissed the team and handed the "specialists" the code with the hopes that they could "just make it work." Looking at the code from the old team, I think this should be a fairly easy task; after all, everything is completely self-documenting.


Not Just Another RLB o'PCC

by in Feature Articles on

RLB o'PCC (or for those not acronym acquainted, Really Long Blocks of Pointless Conversion Code) are pretty common place. They're the type of code that goes something like If SomeInt = 4 Then SomeStr = "4", If SomeInt = 5 Then SomeStr = "5", .... If you haven't seen your fair share of this in the wild, you could find more than your fair share in examples I've posted over the year. Today's code (from Dan Fisch) might look at first glance like every other RLB o'PCC. But take a closer look; each of those Let* functions opens up to another 30-line RLB o'PCC that sets its character's ASCII value to an integer. I'll leave what those RLB o'PCC look like to your imagination ...


The Millisecond Converter

by in Feature Articles on

Given the problem of converting milliseconds to minutes, I imagine that most of us would simply divide the number of milliseconds by 60,000. That's because most of us are not experts in the art of complexification. We've all certainly seen the work of such "artists" on this site before and, I have to say, that they never fail to impress. Take, for example, how Jesper's predecessors solved the "millisecond conversion" problem. Impressive, eh?


The Simpleton Design Pattern

by in Feature Articles on

Andrew Smith was attending a presentation on design patterns and ran into a fellow programmer he knew from college. While they were chatting, the colleague asked Andrew a rather curious question: "what pattern do you think is most useful?" Andrew thought about it for a little bit, and said that he had found the Singleton pattern very helpful on some recent projects.

A few months later, Andrew received an email from his colleague telling him that he was wrong about singeltons; he used the pattern and it just doesn't work. Andrew was a bit thrown off by this and asked for some clarification. His colleague replied back with his project code attached; it was filled almost entirely with classes like this ...


The Return of IHBLRIA

by in Feature Articles on

I was a bit disappointed that the acronym IHBLRIA (Invented Here, But Let's Reinvent It Anyway) did not seep into the general techo-nonsense-babble-buzzword lexicon. Rarity doesn't seem to be the problem: today's code (from Manni) is the third case of IHBLRIA I've posted. I think it's non-usage stems from the fact that IHBLRIA is completely unpronounceable. I don't know if I should be saying ib-le-ree-ah (rhyming with, appropriately, diarrhea) or just stumbling with a new pronunciation every time, like i-hib-el-ar-ee (your guess is as good as mine).

In any case, as you check out this Frontpage-generated reimplementation of FileSystemObject::FileExists(), try to remember the real lesson of IHBLRIA: when making up acronyms, make sure that they pronounceable or, at a bare minimum, contain the letter X.


What Is Truth?

by in Feature Articles on

The problem with "logic" is that it makes things out to be nothing but simple dualities. Proponents of logic want us to believe that everything is true or false, black or white, yes or no, paper or plastic, etc. Thankfully, there are some among us, like Mark Harrison's colleague, who are not afraid to stand up to these logic advocates and shout "no, I will not succumb to your false dichotomies!" Today, I think we all should salute those few brave people ...


Stand Back, I'm Educated!

by in Feature Articles on

Today felt like a great day to share this fun story from Todd H ...

I work with an engineer at my office that never fails to amuse. He's a young guy (about twenty years younger than me) and is convinced that he's twenty times smarter that us older guys because, and he's very fast to point this, he went to Purdue. And not only did he go to Purdue, but he has two (yes, two!) degrees: Mechanical Engineering and Computer Science.


Magic Number Superstition

by in Feature Articles on

John was maintaining a client management system written a few years before his time and noticed that the original coder had a strange belief about magic numbers. He believe that any number less than three was not "magic" and, therefore, perfectly acceptable to hard code. But numbers three and above ... hard-coding those was just a flat-out bad practice. Everyone knows that you should use strings for those ...


Argument About Argument Validation

by in Feature Articles on

Steve D. has the pleasure of working with an attritioned[1] senior programmer; you know, the guy who not really a great programmer, and definitely not management material, yet who's been there so long that he's somehow attained a "senior" title. Since none of the project leads want him developing new code, the senior programmer (we'll call him Jed) has taken up a "quality" role. Jed will browse through the project teams' code and write up recommendations on how to improve the quality.

Every once in a while, Jed will take it upon himself to "tidy up" the code and fix things. Steve noticed his validation unit tests were failing one day, and soon realized that he was victim to Jed's quality assurance. In addition to all 250+ opening curly braces being moved to the same line as the method/if/while statement, the argument validation was just no longer working.


Slowed Fusion

by in Feature Articles on

One of Fregas' clients was frustrated with their ColdFusion-based inventory & accounting system. They had paid another company with "a team of specialized ColdFusion experts" to custom-build their system, but were having problems as the system kept getting slower and slower. They were especially annoyed with this problem because they were sold on the fact that ColdFusion was very fast. While "speeding up" the system, Fregas came across quite possibly the slowest way to do a table record count ...


Having a Hard Time Switching

by in Feature Articles on

For those who "grew up" programming in a language without it, a Switch/Case statement might seem to be a bit foreign. When "transitioning" programmer brought code to a review, O.C. rejected it and requested that he use a switch statement instead of the numerous elseif blocks. The same programmer returned to the next day's code review but didn't quite seem to understand the finer points of the switch statement ...


Pop-up Potpourri: Arcade Edition

by in Pop-up Potpourri on

These never get old for me. And surprisingly, I was able to collect a decent mix since the last Pop-up Potpourri.

We'll start with my personal favorite, from Craig Bowes ...


Automatic Updates

by in Feature Articles on

Deaper visits a software vendor's website every once in a while to check if they've announced any new products, services, rates, or the like. One thing he noticed was bit silly about their site is that, although content is updated every few weeks, they had a big block of text stating that the last update just happened to be done on the same day you were visiting the site.

Of course that's really notable in the grand scheme of things. But on a more recent visit, Deaper noticed that their page did claim to be updated on the same day of the visit, just on the previous year. Curious as to how this might have happened, Dearper did a quick view source on the page and found these fun bits of JavaScript ...


Working Around Yourself

by in Feature Articles on

Mike Jervis was maintaining a case management system and came across a rather peculiar workaround involving a stored procedure and a COM method. Both were checked in to source control around the same time. Both were created for the same feature on the same release. Both were "owned" and developed by the same programmer. Both exclusively call each other. This of course raises the age old question, what came first, the stored proc or the COM?

Stored Procedure Code:


The Trouble With Seven

by in Feature Articles on

It's been a little while since I've done a code-free post, so I thought today would be a great opportunity to share a news story that Wiebe Tijsma stumbled upon while reading NU.nl. I haven't seen this article (warning: Dutch) "make its rounds" across the Internet yet, so I apologize if you've seen this already. Setting aside the complete lack of testing, while you read this English translation, try to imagine what code you would have to write to cause this to occur ...

Number 7 blocks Belgian ATM machines
5 October 2005


Five Wrongs Don't Make A Right

by in Feature Articles on

Let's say you were given the requirement "ensure that all five lines of a shipping address contains valid characters." How do you suppose you would go about implementing such a requirement? Let's hope your solution would be far, far away from Buri's coworker's implementation which not only has a separate function for each address but manages to have an astonishingly unique method of testing for bad characters ...


There's More Than One Way To Validate An Email

by in Feature Articles on

A number of submissions I get are duplicates. Not duplicates as in the same code, just more along the lines of "same concept, different code." Sort of like the For-Case Paradigm. To keep things fresh, I avoid posting duplicates unless they somehow manage to trump the quality of the original concept. Although we certainly have seen an interesting email validator before, I think I think it may be a little while before we see a third email validation example after Keith Lawrence's find ...


It Never Hurts To Ask

by in Feature Articles on

... just so long as you already know what the answer will be. Well that, and that the answer is "Yes." Otherwise, you'll get yourself caught up in some trouble. Some Execptional trouble. Jacob Robertson found that out the hard way when he used the isAlphaNumeric() method from their framework library to validate user input. But now he does the right thing; he makes sure things are valid before trying to validate them ...

public class FieldFormat {


It's Payback Time!

by in Feature Articles on

And no, I don't mean the colloquialism describing revenge. I'm talking about Payback, the every-so-ironically named internal accounting system now making its fourth appearance (see 1, 2, and 3) on this site. One area of the application we haven't yet covered is the UI experience. And it certainly is an experience.

First, a quick look at the design view of a fairly typical Payback form ...


Enumerating The Possibilities

by in Feature Articles on

All of us cope with loss in our own personal ways. I know it can be tough to think about, but have you ever thought about how you would deal with the loss of something near and dear? Something that you have grown to love and cherish? Something that has helped you maintain strong cohesion and enforce data integrity throughout your applications?

But it could happen. No, really, it could; some languages don't support enumerations. And you need to be prepared to program in one of those languages. In your time of grieving, you don't want to go and program something like this ...


Alone In The Code

by in Feature Articles on

It can be a pretty frightening prospect to take the helms, full time, as the Sole Maintainer of a system. Being all alone in the system ... it can ... it can make programmers do things .... terrible things ... unspeakable things. Let's hope J Rojas doesn't succumb to the same fate as his predecessor, who proudly concocted this twisted tally system for indices of object arrays throughout the system ...