Thursday, November 13, 2008

How I feel about SQL


I really tried hard to make friends with SQL, I even got a few books, and O'Reilly ones (they all sucked, but - hey - it's SQL we're talking about). I eventually came to cope with my feelings - if you gotta hate something, SQL ain't too bad a pick. Ain't too bad for poor SQL either, there's a whole lot of awesome indian dudes who love it to death. 
Maybe it's because I've been too lazy to install intellisense plugins for SQL Management Studio so far, maybe because of the cryptic error messages ("there's a fuck up around line 345" - jeez, Javascript is easier to debug) or maybe just because that's the way it is, you gotta hate it. 

P.S. There's been a lot going on lately - mostly going crazy with a solution that builds fine manually but fails to build through CruiseControl.NET - but I've been a lazy ass and didn't post anything about it. You can read about it here and here for now.

6 comments:

Anonymous said...

Dude, if your SQL statement is 345 lines long, you're doing it wrong.

SQL views allow for "functional" decomposition.

Just as you'd not a write a 345 line function, but rather one driver functoin that called other functions, you write SQL as a bunch of views.

Just as with functional decomposition, where each function does only one thing, and does that well, each view should do one thing: manage a join OR transform a column OR add a calculated column, etc.

Unknown said...

I know about views, functions, SPs, and "all that stuff" (which I eagerly use when I am not handed a legacy DB with scripts as tall as my-sorry-self).
All you say is basically correct, so let's say my error message is "there's a fuck-up around line 13".
I still do not like it.

Ben R said...

The chief problem with SQL is that stored procedures break very basic ideas about encapsulation. A database should be doing one thing: holding data. Application behavior should be handled elsewhere.

Reading through .NET code that constantly calls stored procedures rather than using LINQ is pretty frustrating.

John Rockefeller said...

Perhaps it might be more fair to say that you hate SQL Server rather than SQL in general. Working with MySQL is a dream come true. Consider switching sides ^_^

Anonymous said...

Hi,
As for SQL, it very bad, that this beast is still alive.
Unfortunately, I also must take care of one.
It completely breaks anything related to good design(or at least something usable for devs).

Test-placebholder said...

What is so bad about SQL???....Other than error handling it is ridiculously straight forward.