Zawodny: Database Abstraction Layers Must Die (at least for PHP)
11–20 of 25 posts
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#12Based on my experience, I do not agree with the author. DB Abstraction layer has helped me reuse the same libraries on different DB engines more than once. I had one occurance when I needed to install my new webapp in a hurry (for demonstration purposes) and couldn't arrange for a database with the server administrator fast. Well... I just changed "mysql" to "sqlite" in my DB config, fixed a few problems with SQL CRE…
I'm also kind of tired of programmers who complain and complain about others taking the easy way out, people don't program like they used to, etc.; the whole reason for having abstractions is to take some of the 'real' programming out of the equation and let you focus on the actual task you want to accomplish. It may not be the most efficient method of programming, but there are only so many hours in a day...
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#13I don't know much about PHP abstration layers, but Django's ORM makes an app pretty damn portable from DB to DB. I know, without a doubt, that I could roll out my CMS/blog/documentDB in a heart beat to MySQL, Postgres, Oracle, and SQLite with nothing but a change to the settings file. I have to think that Django is by no means unique in this regard, and that PHP has the equivalent.
That's certainly one way to go, and it makes sense if your product is a Framework intended to be used by thousands of developers on thousands of projects, many of which will require that kind of portability. If, however, your product is a product, then maybe it's not so important.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#14I don't know much about PHP abstration layers, but Django's ORM makes an app pretty damn portable from DB to DB. I know, without a doubt, that I could roll out my CMS/blog/documentDB in a heart beat to MySQL, Postgres, Oracle, and SQLite with nothing but a change to the settings file. I have to think that Django is by no means unique in this regard, and that PHP has the equivalent.
Anyway, I just find his argument totally unconvincing.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#15I don't know much about PHP abstration layers, but Django's ORM makes an app pretty damn portable from DB to DB. I know, without a doubt, that I could roll out my CMS/blog/documentDB in a heart beat to MySQL, Postgres, Oracle, and SQLite with nothing but a change to the settings file. I have to think that Django is by no means unique in this regard, and that PHP has the equivalent.
Django pulls this off by being specifically designed to do it. There's a ton of code back there running for every query you execute, adding a tiny bit of overhead to everything you do, just on the off chance that maybe one day you might want to migrate to another DB. That's certainly one way to go, and it makes sense if your product is a Framework intended to be used by thousands of developers on thousands of project…
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#16Earlier quoted context omitted.
Yeah, I couldn't understand that either. He goes on saying "database abstraction layers" are bad but then, at the end says he uses a "library" that abstracts away database issues such as persistent connections, replication awareness and load balancing. How is that not a database abstraction layer?
The way I understand it the phrase "abstraction layer" is usually used to refer to the layer between your SQL and the database and is supposed to allow you to run the same SQL using multiple database engines (at least in theory). While the author's DIY library abstracts the database, I would say its main purpose is isolation, not abstraction. This makes it easier to port apps to new DB engines because it's not that h…
His library is akin to separating the 'M' from the 'C' in MVC. He is saying that people go to the trouble of using these DB abstraction layers so they can proceed with spagetti coding the model (persistence layer in his terms) and the controller (business logic layer in his terms) together.
I'm not sure how valid that argument is though. Anyone I know that bothers to use an abstraction layer also separates the model from the controller.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#17Earlier quoted context omitted.
Yeah, I couldn't understand that either. He goes on saying "database abstraction layers" are bad but then, at the end says he uses a "library" that abstracts away database issues such as persistent connections, replication awareness and load balancing. How is that not a database abstraction layer?
The way I understand it the phrase "abstraction layer" is usually used to refer to the layer between your SQL and the database and is supposed to allow you to run the same SQL using multiple database engines (at least in theory). While the author's DIY library abstracts the database, I would say its main purpose is isolation, not abstraction. This makes it easier to port apps to new DB engines because it's not that h…
mysql_query("SELECT something FROM table WHERE that='" . mysql_real_escape($var) . "'"); is just terribly ugly and annoying, especially if the query gets complex.
I've never put any faith in the whole database portability claim for exactly the reason he points out. Any even moderately complex app is going to leverage database-specific performance enhancements that can't be abstracted away.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#18I don't think that's it, or if it is, it's not a very good reason. Using a templating system that's less than a full programming language keeps you from putting too much logic in your templates. Most of us prefer that logic and presentation be separated. PHP's HTML embedding tempts people to do the Wrong Thing in that regard.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#19Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#20So why do folks [make templating systems like Smarty]? Because PHP is also a programming language and they feel the need to "dumb it down" or insulate themselves (or others) from the "complexity" of PHP. I don't think that's it, or if it is, it's not a very good reason. Using a templating system that's less than a full programming language keeps you from putting too much logic in your templates. Most of us prefer tha…