|
-
Jan 18th, 2019, 07:18 AM
#1
I... Err... Wait... What?!
As a coder who often inherits other people work, I am not unfamiliar with the experience of coming across some strange piece of implementation that boggles my, admittedly already somewhat addled, mind. When I come across such a nugget I try to be generous. I try to be forgiving. Maybe the author had some deep insight which I lack; maybe they'd tried and exhausted all the more obvious solutions; maybe they were some abstract genius who could see the woman in the red dress and knew kung-fu... or maybe it was a Friday afternoon and they were drunk. We've all written some ingenious code on a Friday when we were drunk - I can forgive that.
But once in a very rare while I come across a glittering star of insanity, twinkling in the firmament of space. It's hard to offer the benefit of the doubt on these occasions because there can be no doubt. The sheer mind blasting craziness of the snippet I encounter precludes it. There can be no valid reaction to it beyond a dropped jaw and, possibly, a terrified sob.
On these occasions it would be remiss of me not to share. Not because I want to make you better coders but because I want to make you better human beings. It is only through the sheer horror engendered by the dawning knowledge that someone once wrote this and that they are still out there somewhere that we can truly learn how close we stand to the edge of the pit and what tentacled, bat winged monstrosities dwell therein, ready to be vomited forth upon the earth.
No... really... can anyone explain this to me. It's important because I'd like to sleep tonight:-
SQL Code:
CREATE FUNCTION [dbo].[f_GetDuration] (@SystemId tinyint, @IsAnnual bit, @StoredDuration int, @StartDate datetime, @EndDate datetime) RETURNS int AS BEGIN DECLARE @ActualDuration as int IF @IsAnnual = 1 BEGIN SET @ActualDuration = 365 END ELSE BEGIN SET @ActualDuration = @StoredDuration END RETURN @ActualDuration END
I recommend giving it multiple read-throughs. It's only short but it's subtle and layered. I've read it several times and each time I notice another nuance. Some subtlety that I'd missed on previous iteration - presumably because I was blinded by the retina melting glare of the larger insanities. Like a work of classic fiction, it gives, and gives again.
The best argument against democracy is a five minute conversation with the average voter - Winston Churchill
Hadoop actually sounds more like the way they greet each other in Yorkshire - Inferrd
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|