Hilarious Tweets? You betcha.
Four things I didn't create? What is this? Tumblr? Let's get started.
I had one of those hard-on-the-brain kind of days at work today. All I needed to do was adapt some SQL code so that it would do something slightly different, right? Well, that would have been too easy. I started to read into the code before I tried to do it and it was the weirdest and seemingly dumbest thing ever.
(Don't worry, this doesn't get very technical.)
One of the most basic things you do with SQL is say, "I want to make a new table with the lines from this table, but only the ones that meet this certain criteria." After you do that, whenever you work with your new table, you don't have to re-specify those criteria. So why was this happening ALL OVER THE DAMN PLACE IN THIS CODE.
There are very is ways to say, "I want all the lines that DON'T fall into these categories." So why did the person who wrote this do it in THE MOST CONFUSING WAY POSSIBLE. Allow me to explain. He made a table of all the thing that he doesn't want, left joined it with the original table under the criterion original.(unique identifier)=(stuff I don't want).(unique identifier) and then specified the criteria that he only wanted the lines where original.(unique identifier)!=(stuff I don't want).(unique identifier). I know most of you are confused by that and you think it's just because you don't know SQL. Well guess what, it's confusing to people who do know SQL also. It works, it's just bad.
And none of this is commented, none of it at all. To make sense of it, I had to PRINT IT OUT and WRITE ON IT WITH A PENCIL. I had to summarize sections of code so I knew what they meant. He created tables that he literally never used at all. They were just dropped at the end of the code. Which, by the way, isn't supposed to be done as
DROP TABLE1; DROP TABLE2; DROP TABLE3; ...It's supposed to be done as
DROP TABLE1, TABLE2, TABLE3...;Lastly, the names of the tables that were created were not helpful. Such tables were "BASE9", "BASE8", "BASE81", "BASE181", "BASE281", and so on. Using the suffix 'BASE' is ok, but why not number them with 1, 2, 3, 4, and so on. It would work tons better for me.
It wasn't very fun. And, of course, none of it was commented. I just don't get it. Tomorrow, I'm going to rewrite the shit out of that code.