Zawodny: Database Abstraction Layers Must Die (at least for PHP)
jeremy.zawodny.com
Zawodny: Database Abstraction Layers Must Die (at least for PHP)
1–10 of 25 posts
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#2I worked on at least 3 large projects where we went through a lot of trouble to make them work on multiple databases. All that effort was wasted as all of them ended up running on Postgres only. Unless you're absolutely sure that you're going to need support for multiple databases, my suggestion is that you use the technique from the end of the article: put all of your DB access code in separate classes so you can easily swap them with different ones should the need arise. Until then, save yourself some trouble and make your product work really well with one database engine.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#3DB 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 CREATE statements and it worked.
On a side note I also agree with the "PHP is the best templating languge" idea. I just use a template class for it that has a similar API to Smarty.
So yes, I use abstraction layers in both cases. I guess that is more convenient because I do not work on any one web application for too long and I need to carry my libraries and knowledge painlessly from place to place. If I had only one application to build and support at one location... who knows, maybe I would even write php extensions for it in C.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#4Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#5this seem to me like "I'm paranoid about unknown code but I can't accept the truth SO I reinvent the wheel over and over again putting my code in my library and I say everyone this is cool cause it's faster and performance and bla bla blah"
the truth: abstraction -> helps think about the logic that matters in your program library -> helps not to reinvent the wheel and use code tested by everyone
his logic: abstraction -> ZOMG unknown stuff HEEELP, let's think about every algorithm in my program from scratch and let's justify this to me by saying I'm saving 3-4 intermediate function calls
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#6I think this is just ridiculous. I'm not necessarily gung-ho about using database abstraction layers myself, but the author only argues against it on the basis of one of the benefits of using an abstraction layer. On top of that, he then admits that he uses a database abstraction layer himself, albeit a seemingly thin one.
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?
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#7Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#8If you write your app using an abstraction layer (or even a simple class wrapper), adding caching is almost trivial. If you are using the low level DB function calls it becomes a large task to cache any of your requests.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#9Database abstraction, like many other things, serves a purpose under the right conditions (when flexibility and portability are needed to serve customers). Get over it.
Re: Zawodny: Database Abstraction Layers Must Die (at least for PHP)
#10I think this is just ridiculous. I'm not necessarily gung-ho about using database abstraction layers myself, but the author only argues against it on the basis of one of the benefits of using an abstraction layer. On top of that, he then admits that he uses a database abstraction layer himself, albeit a seemingly thin one.
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?