7 ms·
I can think of a couple reasons not to like SQL. First, it's ugly. It's from an era when it was popular to try to make programming languages look like English.
by Zak 17y ago
I can think of a couple reasons not to like SQL.
First, it's ugly. It's from an era when it was popular to try to make programming languages look like English. Most people have since decided that trying to make code look like English text is a Bad Thing.
Second, it is very common to create SQL queries by splicing together strings in whatever language you're using for the rest of the application. That's a horrible way to write any kind of code. ORM is, I think as much an attempt to avoid that as an attempt to avoid SQL itself. CLSQL provides SQL semantics with Lisp syntax that can be used directly in Lisp programs. I'm not sure what other languages have similar tools, but that seems more like the Right Way to me.
- hello_moto 17y ago> Most people have since decided that trying to make code look like English text is a Bad Thing. Back when Rails exploded, this is one of the selling point of using Ruby...
- bobbyi 17y agoFor python, the SQLAlchemy library provides excellent ways of programmatically building SQL queries rather than splicing strings together. It also offers an ORM, but that is an additional layer on top of the SQL stuff that you don't have to use.
- didip 17y agoThe ruby equivalent for it would be Sequel.
- eplanit 17y agoAh, the Invasion of the Amateurs continues. Yeah, SQL is bad because it's aesthetically "ugly". SQL is bad because of how some people use it (not using prepared statements, and simply concatenating strings yup is very amateurish). And somehow this leads to LISP as the savior? Note that the savior is to make SQL be LISP! That clue lends meaning to: "trying to make code look like English text is a Bad Thing". The LISP crowd loves obfuscation and esoteric syntax....it makes the programmer seem smart. Keep studying, you have lots of good things to learn yet.
- astine 17y agoWay to absolutely miss the point. The previous poster is speaking about code generation, particularly that of generating appropriate SQL statements for given programs. He mentions a specific Lisp library as one solution and suggests ORM as another. Prepared statements are a better solution if the database supports them, yes, though occasionally, you might want to do more than just plug in search values. When you attempt to make a language more like English, you inadvertently make it's parse tree more complex, therefore making attempts to manipulate that code more difficult. SQL, which is often generated on the fly, is affected by this.