The First Rule of Enterprise Software is: don't talk about enterprise software. The Second Rule of Enterprise Software is: when you do talk about enterprise software, make references to stylish dramas from the '90s starring Brad Pitt and Edward Norton to make it seem more exciting. However, the most important rule of enterprise software by far is Rule Number Three: Even the simplest little things can't be simple. Arthur was reminded of Rule Number Three on a recent trip into his employer's company-wide database.
The codebase Arthur maintained had a method for just about everything. "Hah!" You're probably thinking. "I bet it doesn't have a method that returns an array containing the letters of the English alphabet!" Well, Hah! yourself: stumbling across a call to
GetAlphabetForHouseCombinedPortfolios in the bloated, inappropriately-generic
UploadingTool class, Arthur was curious. Would it contain a hard-coded list of letters? A complex mathematical formula dependent on the current date that would baffle everyone by returning Hebrew when the clock switched out of daylight-savings time? No, like all proper enterprise solutions, the method invoked a stored procedure in the database. And that's why Arthur is proud to present
-- get alphabet and ids for each letter SELECT N.Number_ID AS [Filtering_ID], CHAR(N.Number_ID) AS [Filtering] FROM dbo.stbl_Number N WHERE N.Number_ID >= 65 AND N.Number_ID <= 90
The best thing about this solution is how easily it can be modified to support the exciting new lowercase letters that are starting to gain traction in some forward-looking businesses.
The perfect coda to this story is the
stbl_Number table definition itself, which Arthur found to be thoroughly documented:
CREATE TABLE [dbo].[stbl_Number] AS ( Number_ID INT NOT NULL, -- Number ID. Should always match the value in the Number field Number INT NOT NULL, -- The number Number_Text VARCHAR(50) NULL, -- Textual representation of the number Number_Roman VARCHAR(50) NULL, -- Roman numeral representation of the number Number_GUID UNIQUEIDENTIFIER NOT NULL -- Globally unique identifier for the number )
Arthur wanted us to point out that the
Number_Text field sometimes contained a value like "nine", and other times contained a value like "17". Arthur, we feel your pain. Just don't forget the First Rule of Enterprise Software.