Recent Articles

Apr 2005

It's a Bit Defective

by in Feature Articles on

A little while back, I bought one of those pressed-wood laminate entertainment-center-in-a-box things from my local Wal*Mart. After lugging the giant box inside and putting half of it together, I was disappointed (to say the least) when I found out that they neglected to include a bag of those custom Twist-Lock® fasteners things. It was quite a challenge getting the furniture put together without those things.

But, having gone through that experience, I can totally sympathize with M.P.'s colleague. Just imagine his frustration when he found out that they forgot to include bitwise operators in his copy of C# ...


It's Always the Case

by in Feature Articles on

Dan Duda got a call from a client that was getting more and more frustrated with their custom-built software. Gwen was an employee at the client who was responsible for forwarding emails from the system to others in her group. Unfortunately, she left, requiring someone else to contstantly check her email box. The client was pretty adamant that Dan's predecessor (who developed the system) constantly told them that the system was designed to send an email to the correct employee, but that they need to configure it to do that.

After a bit of research, Dan tracked down the problem. Now, ignoring for the moment that this was written in VB well before databases, flat files, and every other disk-storage method was invented, note why the method always bothered poor Gwen ...


... wait ... that's it?!?

by in Feature Articles on

Some of the code posted here leads to the "hmph, well that sure is a creative way of doing that" reaction. Other code seems to elicit the "my parakeet codes better" response. I didn't quite get either reaction from the Java snippet C.M. sent me. No, after puzzling over what it did for a little bit, I had the classic "you have got to be kidding me, that's it?!?" response. Take a look your self ... I've posted the (one-line) answer in the comments ...


From WTF to -ism

by in Feature Articles on

I'm sure that we all have created "WTF" of our own and learned from the experience one way or another. Me, I had to maintain my own code. That wasn't fun. But, I do know that I (and hopefully, most others here) have never erred so badly and frequently as to be honored with an -ism. You know what I'm talking about ... you're looking through code and come across the all-too-common egregious implementation from a certain you-know-who. That's an {insert your colleagues name}ism.

Now that Rik has long departed from Steve Wahl's Team, Steve was kind enough to share a Rikism. But not all was lost -- they use their old Rikisms to gauge candidates' reactions: the more pain and disgust, the more desirable the candidate became.


Dimensioning the Dimension

by in Feature Articles on

It's not too uncommon to see a Java programmer write a method to get the name of a month based on the month number. Sure, month name formatting is built in via SimpleDateFormat, but the documentation can often be hard to read. And since there's really no other place to find the answer, it's excusable that a programmer will just write a quick method to do this.

I have to say though, Robert Cooper's colleague came up with a very interesting way of doing this: adding an[other] index to an array ...


A Pop-Up Potpourri

by in Pop-up Potpourri on

Hope ya don't mind another code-free day, but these pop-up messages were too good to pass up ... feel free to share your favorites in the comments.

Our first comes from Corey A. Spitzer. I have honestly never had such a strong desire to click an OK button in my life ...


A Truly Selective Case

by in Feature Articles on

Some of you may remember when we discovered the for-case paradigm (or revisited more recently) a while back. I'm very excited today to announce the discovery of yet another "switch/case" structure abuse: the true-case paradigm. We can thank Chris for finding this "truly" creative misuse within his company's VB/ASP system ...


IFormatProvider? Oh no, not me ...

by in Feature Articles on

One of the cooler features of higher level languages is the built-in support for the ever-so-common task of formatting numbers. The .NET Framework provides the rather ubiquitous String.Format() method to help out with formatting numbers, dates, and everything else. VB.NET makes it even easier, carrying over the Format() method from previous versions of visual basic. That said, Ant Day was a bit surprised to a plethora of examples like this in a VB.NET solution developed from a highly-paid consulting company that "adapts leading-edge technology, best practices, and experience to help customers realise their business objectives:"


Doing The Splits

by in Feature Articles on

Phone number validation can be a bit tricky, especially considering the coutnless separation schemes people use to split area-code/exchange/number. My personal favorite was from a graphic designer I knew: "216/555^1234" Boy, if that's not a creative permutation of the limited symbols avaiable, I don't know what is. Anyway, to get around these, a lot of developers will just split the phone number into three separate input boxes. Peter noticed that his company did that on their contact form, too ...


Another Friday Mishmash

by in Feature Articles on

And a code-free one at that, too ...

First, if you've ever questioned the effectiveness of offshore programming outsourcing, consider this example of just how closely your outsourcing partners listen when you specify "Name consists of three fields: First name, Middle name, and Last Name":


Next Time, Try TryParse

by in Feature Articles on

It's always entertaining to see a programmer insist upon implementing his own version of built-in functionality. Especially when the built-in method is literally right infront of you (thanks to Intellisense):


When Good Practices Go Bad

by in Feature Articles on
I'm we were all nagged about similar things when we were younger: wear your coat outside, elbows off the table, and use constants instead of string literals. It would seem though that not every one (James Watson's colleague especially) doesn't quite get the gist of these "best practices" we were all taught ...

private static final String 
  SELECT_MAPS = 
    SELECT + DOC_TYPE + COMMA + PARTNER + COMMA + PRIORITY + COMMA + ERROR + COMMA + 
    ERROR_DETAIL + COMMA + ACCEPT_REJECT + COMMA + PROCESS_CODE + COMMA + 
    RESULT_STATUS_CHANGE + FROM + ERROR_MAPS + WHERE,
  WHERE_PARTNER_SETTINGS = 
    DOC_TYPE + EQUALS + PARAMETER + AND + PARTNER + EQUALS + PARAMETER,
  NULL_PARTNER_SETTINGS = 
    DOC_TYPE + NULL + AND + PARTNER + NULL,
  WHERE_STATUS_CHANGE_DEPENDENCY_PREFIX = 
    " NOT EXISTS " + OPEN_PARENTHESIS + SELECT + "'X'" + FROM + STATUS_CHANGE_DEPENDENCY + 
    WHERE + MAP_ID + EQUALS + ERROR_MAPS + "." + MAP_ID + AND + STATUS_CHANGE + " NOT IN " 
    + OPEN_PARENTHESIS,
  WHERE_STATUS_CHANGE_DEPENDENCY_SUFFIX = 
    CLOSE_PARENTHESIS + CLOSE_PARENTHESIS,
  ORDER_BY = " ORDER BY 1, 2, 3";

Try. Catch. Throw Up.

by in Feature Articles on

With a title like that, you know it's time once again visit the wonderful world of exceptions. Our first (yes, first; it's a two-for-one day!) example is from production code that Valdas found which demonstrates a very perverse (yet intriguing) way of abusing not only try/catch blocks, but regular exceptions as well ...


Reinvent This

by in Feature Articles on

Galmeida was reviewing the deliverables from their offshore outsourcing partner and noticed a very strange pattern throughout the code. I usually able to come up with some stretch of an explanation for why a programmer did what he did, but I'm a total loss this time .... any ideas?


A Hodgepodge of Naming

by in Feature Articles on

It's time for one of those posts again. Today's topic (as if it wasn't obvious from the title) is Naming! Feel free to share your memorable naming sightings too ...

Ilia Trendafilov spotted this one. As it turns out, Steve requested a new rule be added to the system. Of course, you'd have to ask him if you really want to find out what that rule is ...


Lifes A Batch. Then You Maintain One.

by in Feature Articles on

Immagine how exciting it must have been for Peter "batchwizard" Gibbons* to take over development and support for his company's "software distribution, configuration management, and auditing" system. Afterall, it would seem to be an excellent opportunity to learn more about Microsoft SMS, and how it's used and expanded upon in a large organization. Now, just try immagine how quickly excitement turned into dissapointment when Peter learned that the entire system was developed in Windows batch code. In over sixty-five command files.


Loonily Coupled

by in Feature Articles on

It's gotta be a relief for our dear friend Nikolay Simeonov to scream "WTF" at today's example of coupling. Not only is it not as horrendous as other things he's come across, but this time he was actually in a position to stop this from ever making it to production. Here's what he discovered in the source tree from one of his employees...

Notice how well commented this code is, and how it actually prints a report by writing it to a file then calling the print function which takes the filename, reads it and then does the actual printing. And no, the printing function wasn't taken from another system, nor was done so but another reason - it was just the only way to send information between different functions, which this lady found out for the moment.


A Y'ed Gap

by in Feature Articles on

Schien Dong came across this function that calculates the spacing of numbers on the Y-axis of a charting component. It works, but in a very mysterious way ....

CHALLENGE POINT: Post a better (or worse) way of accomplishing this roundabout way of rounding.


Party Like It's 1969

by in Feature Articles on

A lot of former mainframe people will tell you that it was a pretty rough transition from the good ole' days of COBOL and VMS to the modern paradigm of Object-Oriented C++/Java/.NET development. Some have stuck around, fighting over the handful of jobs maintaining the remaining systems. Others are still in denial, believing that "minicomputers" are just a fad and that we will soon return to the heyday of mainframes.

A few have actually snuck into our world, trying to undermine and transform it into a world of flat files, and fixed-length strings. Be on the look out for these developers. Fortunately, their M.O. is easy to spot: who can miss UPPR_CSE_EVRYTHNG? But the sure-fire way of telling is to look for a single underlying string for all data storage, such as this code from James Watson's JavaBOL-based system:


A Database's Database

by in Feature Articles on

Every once in a while we're treated with the rare opportunity to get a glimpse into the system that never should have been. The system whose architecture diagram alone would be a grossly inappropriate April Fool's Day joke. The system whose code quality is actually lower than what a hundred lemurs randomly pounding on keyboards would produce. The system whose stench even surpasses that produced by a hundred lemurs together in a room. And today, dear readers, we shall once again experience one of these systems thanks to Mike O.

Most systems require one, or at most, a handful of databases for its backend. But not this one. Like the rings on a tree, the number of databases this system requires to run grows by the day. Each day, a new database was dynamically generated to process and finalize the manufacturer's work schedule. A typical installation of this system is measured in the hundreds of databases ...