|
Brecht posted:SQL is already a DSL for (deep breath here) structured queries, if at the end of the day you're operating on structured data you're necessarily writing structured queries and you might as well do it with the tool that's been expressly designed for that purpose. You don't need another layer of abstraction for what is already a purpose-built layer of abstraction, the only possible consequence of that is you take a net loss. Not having to write SELECT FROM WHERE is a false economy when you just hide it behind the context-destroying façade of an ORM. The problem isn't SELECT FROM WHERE, it's "SELECT FROM WHERE." If you're using a language worth using in 2011 or C#, it's powerful enough to represent the same concepts as SQL without having to put quotation marks around it or jam yet another language into your app. I don't usually write my own ASM and I don't usually write my own SQL.
|
# ? Dec 11, 2011 17:04 |
|
|
# ? May 30, 2024 03:06 |
|
Brecht posted:tl;dr SQL isn't hard, use it SQL and database design must be harder for newer developers than the object-oriented languages they're used to. I don't have a better way to make sense of recent attitudes about relational databases. Combine that with attitudes from early in a development career like abstraction is good for its own sake, and everything has to be an object, and you inevitably get overuse of ORMs. Combine it with naive ideas about performance and scale and desire for silver bullets and you get overuse of schemaless data stores.
|
# ? Dec 11, 2011 17:06 |
|
A A 2 3 5 8 K posted:SQL and database design must be harder for newer developers than the object-oriented languages they're used to. I don't have a better way to make sense of recent attitudes about relational databases. Maybe it's the sudden realization that there are choices other than relational database or a bunch of files.
|
# ? Dec 11, 2011 17:17 |
|
Brecht posted:context-destroying façade of an ORM. I think people are kind of overlooking the O part of ORM. They don't just construct a SELECT, they handle the boring process of converting results into useful objects, which is cool if you're not just dumping results to a page. Also, no ORM aims to totally abstract a complex subquery. The point of wrapping a SELECT is that the majority of queries in the majority of applications are brainless boilerplate and the programmer shouldn't even have to think about how they're constructed, any more than they should have write i = 0; i++ in a foreach.
|
# ? Dec 11, 2011 17:21 |
|
tef posted:Hell is other peoples code. We are all the horror. There are only 2 real reasons to use an ORM. 1) To have further protection against SQL injection This can be mitigated with good code and sanitizing user input. The ORM just lets a coder be lazy and not give a poo poo, which is a good thing. Even WITH an ORM you should still write good code and sanitize user input. 2) Allows you to easily move from one database language to another. If you're never going to change your database language, you don't need to worry about this either. As for a REAL horror, this is a cross post from the SQL thread: Without going into too much detail, we have a database that stores a MARC record bibliography tag, and it's raw subfields. Basically data in a field that looks like this, but the [1F] is an invisible hex character you can't see unless you know it's there: [1F]aTitle of a book /[1F]b Subtitle[1F]cby Author Name I needed a way to select data within one subfield. This ended up being the solution thanks to having no better way of doing it in the abomination that is MS SQL 2000. code:
|
# ? Dec 11, 2011 17:25 |
|
should we start a orm/sql apologist thread? it's like tabs vs spaces in here
|
# ? Dec 11, 2011 18:05 |
|
tef posted:it's like tabs vs spaces in here Tabs vs. spaces are handled for you in a decent text editor like Emacs.
|
# ? Dec 11, 2011 18:08 |
|
tef posted:should we start a orm/sql apologist thread? it's like tabs vs spaces in here More like HLL vs assembly.
|
# ? Dec 11, 2011 18:13 |
|
Tabs save filesize and discourage devs from formatting their code in clever (terrible) ways. Four-width tabs are of course the best. HLL are the only real choice with the exception of areas where speed is of critical importance, like a realtime system, or things like video encoding and resource-intensive games. Everything else should be written in a HLL and use its standard library, and other libraries, before trying to recreate the wheel.
|
# ? Dec 11, 2011 18:40 |
|
hepatizon posted:More like HLL vs assembly. this is the thread that keeps giving.
|
# ? Dec 11, 2011 19:02 |
|
It's a shame RSF doesn't happen anymore, we could have had one that had a thread for each classic IT flamewar to keep them clear of all the other forums. Though I suppose that's what YOSPOS was meant to be...
|
# ? Dec 11, 2011 19:33 |
|
Frozen-Solid posted:sanitizing user input ... sanitize user input. Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooo
|
# ? Dec 11, 2011 20:43 |
|
Get this guys: sometimes I use an ORM and sometimes I use SQL. I'm loving crazy.
|
# ? Dec 11, 2011 21:17 |
|
Otto Skorzeny posted:Nooooooooooooooooooooooooooooooooooooooooooooooooooooooooo Hmm, sanitizing user input. That just means that you check that $('#thefield').val().indexOf('`') == -1 before submitting the form, right?
|
# ? Dec 11, 2011 21:49 |
|
Thermopyle posted:Get this guys: sometimes I use an ORM and sometimes I use SQL. You're literally a Class traitor.
|
# ? Dec 11, 2011 21:49 |
|
Ok, if you haven't figured it out yet, it's time for me to admit I was just kidding. I thought the gig was up when shrughes called me out, but no...
|
# ? Dec 12, 2011 01:17 |
|
Markov Chain Chomp posted:Ok, if you haven't figured it out yet, it's time for me to admit I was just kidding. I thought the gig was up when shrughes called me out, but no... Ahaha, yeah right, you just flipped positions and now you're back pedaling. You probably really didn't understand SQL. Now you better start worshipping a shrine of Victor.
|
# ? Dec 12, 2011 01:19 |
|
code:
|
# ? Dec 12, 2011 04:53 |
|
Janin posted:
Holy poo poo.
|
# ? Dec 12, 2011 05:42 |
|
edit: never mind
Deus Rex fucked around with this message at 07:18 on Dec 12, 2011 |
# ? Dec 12, 2011 07:15 |
|
What's that from? It's pretty obviously Haskell, I'm guessing it's some kind of funky metaprogramming stuff?
|
# ? Dec 12, 2011 08:00 |
|
yaoi prophet posted:What's that from? It's pretty obviously Haskell, I'm guessing it's some kind of funky metaprogramming stuff? Looks like part of some Template Haskell for some option-parsing library; that's producing a Haskell expression at compile-time by direct manipulation of syntax trees to serve some purpose. Template Haskell is pretty ugly to begin with, and the indentation is not helping at all, there.
|
# ? Dec 12, 2011 10:07 |
|
quote:Any decent ORM would ... is the new "sufficiently smart compiler".
|
# ? Dec 12, 2011 11:52 |
|
Frozen-Solid posted:
Emphasis mine. If you're attempting to sanitize input instead of using a prepared statement you are exactly the sort of person who should never be writing SQL manually. SQL is a lovely DSL that requires me to leave the language I prefer to write in, to write in another language. I use an ORM because I like writing in my preferred language and I like operating on objects. That being said anyone who thinks "Use the ORM Luke" is the only answer and you never need raw SQL (or that an ORM is always the answer at all) is an idiot. Any ORM worth using has a way of dropping to raw SQL and optionally populating the object(s) from that raw SQL. Because, surprise!, sometimes the ORM writes brain dead SQL and you need to write it your self if you don't want to bog your app down.
|
# ? Dec 12, 2011 13:49 |
|
Steampunk Hitler posted:Emphasis mine. There's more to sanitizing user input than just escaping quotes to prevent injection. Every piece of user input should be checked for validity long before it even sees SQL. The fact that people think SQL injection is the only reason for sanitizing user input is the horror here.
|
# ? Dec 12, 2011 14:20 |
|
Frozen-Solid posted:There's more to sanitizing user input than just escaping quotes to prevent injection. Every piece of user input should be checked for validity long before it even sees SQL. The fact that people think SQL injection is the only reason for sanitizing user input is the horror here. Now you're backpedaling, you explicitly said that you should sanitize input to prevent SQL Injections. There are other, valid, reasons to sanitize input but your statement didn't mention them, it only claimed that the "correct" way to handle App -> DB code was to sanitize input which it patently wrong.
|
# ? Dec 12, 2011 14:25 |
|
Steampunk Hitler posted:Now you're backpedaling, you explicitly said that you should sanitize input to prevent SQL Injections. There are other, valid, reasons to sanitize input but your statement didn't mention them, it only claimed that the "correct" way to handle App -> DB code was to sanitize input which it patently wrong. No, I said there are only 2 real reasons to use an ORM, and specifically stated that you should be sanitizing user input anyways. Yes, it was in relation to a comment about preventing injection, but the intent was that sanitizing is something you should be doing beyond just SQL injection and that user input should be validated and sanitized even if it's not going to be put anywhere near a database. Thus, an ORM to prevent injection is just another safety net.
|
# ? Dec 12, 2011 15:19 |
|
Steampunk Hitler posted:SQL is a lovely DSL that requires me to leave the language I prefer to write in, to write in another language. I use an ORM because I like writing in my preferred language and I like operating on objects. quote:Any ORM worth using has a way of dropping to raw SQL and optionally populating the object(s) from that raw SQL. Because, surprise!, sometimes the ORM writes brain dead SQL and you need to write it your self if you don't want to bog your app down.
|
# ? Dec 12, 2011 15:30 |
|
yaoi prophet posted:What's that from? It's pretty obviously Haskell, I'm guessing it's some kind of funky metaprogramming stuff? ShoulderDaemon posted:Looks like part of some Template Haskell for some option-parsing library; that's producing a Haskell expression at compile-time by direct manipulation of syntax trees to serve some purpose. Template Haskell is pretty ugly to begin with, and the indentation is not helping at all, there. It's part of an option parsing library I'm writing, which lets users define options using templates. the end result is pretty and nice to use, but the innards . This is my first time ever using template haskell, and I feel like some CS101 freshman confronted with a switch statement.
|
# ? Dec 12, 2011 20:02 |
|
Steampunk Hitler posted:SQL is a lovely DSL that requires me to leave the language I prefer to write in, to write in another language. Your complaint is that a different language requires you to use... a different language?
|
# ? Dec 12, 2011 20:27 |
|
Janin posted:yup Use AppE in `infix` position if you have to use it at all and it tends to get a bit more readable. If you're doing this a lot, just make an operator for it. You don't usually need to do things like ListE (map (LitE . StringL) longs) when you can just [|longs|]. I try to avoid LitE altogether. In general, TH looks a lot nicer if you use the quoters to do as much heavy lifting as possible. Remember that you can use Template Haskell in your Template Haskell. code:
|
# ? Dec 12, 2011 21:31 |
|
In Coffeescript: z = [0..2] becomes z = [0, 1, 2] z = [0..1] becomes z = [0, 1] z = [0..0] becomes z = [0] z = [0..-1] becomes z = [0, -1] Then there's z = [0...n], the secret feature which does what you want and isn't documented.
|
# ? Dec 12, 2011 21:54 |
|
shrughes posted:In Coffeescript: Nope: quote:Ranges can also be used to extract slices of arrays. With two dots (3..6), the range is inclusive (3, 4, 5, 6); with three dots (3...6), the range excludes the end (3, 4, 5).
|
# ? Dec 12, 2011 22:06 |
|
ShoulderDaemon posted:Remember that you can use Template Haskell in your Template Haskell. gonna clean all that up after work, thanks much
|
# ? Dec 12, 2011 22:18 |
|
"So hey, boss, since we're looking for a new guy, are we looking for a new grad, or someone more senior?" "New grad, if we hire someone with experience we'll have to make them unlearn all of their bad habits." The irony is blowing my loving mind.
|
# ? Dec 12, 2011 23:35 |
|
If only there was some process to weed out bad applicants.
|
# ? Dec 12, 2011 23:59 |
|
Looking at w00tz0r's post history in this thread, I don't think he was bothered by the concept (which is pretty legit) so much as the idea that there might be a risk of hiring people who actually manage to have worse habits than those the team already has in place.
|
# ? Dec 13, 2011 00:06 |
|
Zhentar posted:Looking at w00tz0r's post history in this thread, I don't think he was bothered by the concept (which is pretty legit) so much as the idea that there might be a risk of hiring people who actually manage to have worse habits than those the team already has in place. bingo.
|
# ? Dec 13, 2011 00:07 |
|
yaoi prophet posted:Nope: Nsry, that's the section on array slicing and not on ranges.
|
# ? Dec 13, 2011 01:23 |
|
|
# ? May 30, 2024 03:06 |
|
What section on ranges?
|
# ? Dec 13, 2011 01:26 |