On 19/12/07 20:01 Peter da Silva wrote: > I think any time SQL is involved in a hate, you need to hate the people > who designed SQL for trying to make it "user-friendly" and english-like > instead of defining a statement syntax that clearly distinguished > components of a statement and sticking to it. > [...] > I'd love to access a database using code like: > > (select column-list selector-expression) > (with table selector-expression) > [...]
It isn't the syntax that makes SQL hateful. It's that data is partitioned into columns in tables (read: fields in flat files). SQL is 50s-era syntax for 50s-era technology (invented in the 70s, of course). Objects (despite their hatefulness) are a better way of organising data. It's much better to say something like person = database.fetch_by_name("Example", "Peter"); person.email = "pe...@example.com"; than to do some kind of query to find Peter Example in a table and update his e-mail address (possibly on a separate related table). It's not a matter of hiding the gory details of how the data is stored. It's about storing the data in a way that relates to how it will be used. Why not use an underlying technology that's based on objects (with some form of inheritance, etc.) and allows retrieval of arbitrary objects by arbitrary properties (i.e.. search by any field)? If you want to retrieve or update data, it's a matter of (de)serialisation, not about connecting linked tables. (If one is stuck using tables, then it's nice to create a wrapper module that provides some kind of object-centred interface so that programmer doesn't have to worry about SQL... it also makes it much easier to change databases or the structure of them later.) But people keeping their data in relational databases because of tradition: that's how everybody does it, and how everybody has always done it, so how can there be another way to do it? End of rant. Rob