Recent Articles

Mar 2025

Tomorrow

by in Error'd on

It's only a day away!

Punctual Robert F. never procrastinates. But I think now would be a good time for a change. He worries that "I better do something quick, before my 31,295 year deadline arrives."


An Argument With QA

by in CodeSOD on

Markus does QA, and this means writing automated tests which wrap around the code written by developers. Mostly this is a "black box" situation, where Markus doesn't look at the code, and instead goes by the interface and the requirements. Sometimes, though, he does look at the code, and wishes he hadn't.

Today's snippet comes from a program which is meant to generate PDF files and then, optionally, email them. There are a few methods we're going to look at, because they invested a surprising amount of code into doing this the wrong way.


Wrap Up Your Date

by in CodeSOD on

Today, we look at a simple bit of bad code. The badness is not that they're using Oracle, though that's always bad. But it's how they're writing this PL/SQL stored function:

  FUNCTION CONVERT_STRING_TO_DATE --Public
    (p_date_string IN Varchar2,
       p_date_format IN Varchar2 DEFAULT c_date_format)
    Return Date

   AS

   BEGIN

    If p_date_string Is Null Then
        Return Null;
      Else
        Return To_Date(p_date_string, p_date_format);
      End If;

   END;  -- FUNCTION CONVERT_STRING_DATE

The Sales Target

by in Feature Articles on

The end of the quarter was approaching, and dark clouds were gathering in the C-suite. While they were trying to be tight lipped about it, the scuttlebutt was flowing freely. Initech had missed major sales targets, and not just by a few percentage points, but by an order of magnitude.

Heads were going to roll.


An Alerting Validation

by in CodeSOD on

There are things which are true. Regular expressions frequently perform badly. They're hard to read. Email addresses are not actually regular languages, and thus can't truly be validated (in all their many possible forms) by a pure regex.

These are true. It's also true that a simple regex can get you most of the way there.