August Meme Monday – Crap Code

Categories: Meme Monday, News, Professional, SSC
Comments: 3 Comments
Published on: August 1, 2011

Interesting topic this month posted by Thomas LaRock.  This month he has chosen “crap code” as the topic.  I think it is interesting because there really are so many different ways to take this.

Knowing that there are so many qualifications for crap code, I personally like that of readability.  I know everybody has their own interpretation on how code should be written and what is readable.  However, I have to say that soooo many styles out there are not very good.  The style is sooooooo hard to read and follow.  For me, it is a coding nightmare to see code that is poorly formatted or not formatted at all.

[codesyntax lang="tsql"]


That code is just flat out difficult for me to read.  SQL Server handles white space just fine so a little formatting doesn’t hurt anything.  Better yet, it very well could help improve the readability of your code to more people than just you.  Something like the following helps.

[codesyntax lang="tsql"]


Now, for simplicity sake, I also introduced something in both of these code samples that I don’t like too much either.  In both cases I use a “Select *”.  This is bad form!  One really should also denote each column that you want to be returned.  Not only is it good for readability, but it can be useful for the query optimizer and indexing purposes.


So what do you consider to be crap code?

3 Comments - Leave a comment
  1. Mark says:

    It bothers me when people use column names (or other user named elements) that happen to be commands or functions. I’ll admit it – I’ve been guilty of it myself, but I avoid it. “SELECT AVG from Mytable.” Noooo! Crap code.

  2. jonmcrawford says:

    Lack of documentation/comments. What the code does != what the code is supposed to/assumed to do.

Leave a comment

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

August 2011
« Jul   Sep »


  • @n9ljx: sorry (3/2) description is 'Method not found:System.Collections.Generic.IEnumerable`1< #sqlhelp
  • @muad_dba: @SQL_Padre what do you have max server memory set at? #sqlhelp
  • @n9ljx: gives cryptic error about a deprecated sp, but the sp isn't listed. How do I find the broken sp? #sqlhelp (2/2)
  • @n9ljx: on a 2008r2 instance we have several databases in 90 compatibility mode. running upgrade advisor on these DBs (1/2) #sqlhelp
  • @Ko_Ver: this time a lookup with no cache caused the issue. I guess the system is being haunted with an anti-RBAR spirit... #sqlhelp
  • @Ko_Ver: yet another package with the same issue. This time no OLE DB command. Weird stuff is going on... #sqlhelp
  • @Ko_Ver: another similar package with an OLE DB command is suddenly facing the same issue. I wish I could punch #ssis in the face... #sqlhelp
  • @SQL_Padre: #SQLHelp all T-SQL commands are queued and will not execute until application is forced closed --2/2
  • @SQL_Padre: #SQLHelp Can HEAVY read I/O cause enough CPU (or memory) pressure to cause the OS to stop working? No RDP or console login -- 1/2
  • @jeffrush: SSIS row count / script component issue (video for more detail) #sqlhelp #ssishelp

Welcome , today is Tuesday, September 23, 2014