Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Database abstraction including data types

by sundialsvc4 (Abbot)
on May 20, 2012 at 22:43 UTC ( #971524=note: print w/ replies, xml ) Need Help??


in reply to Database abstraction including data types

First of all, I don’t “abstract away” a database too much.   I am probably going to write the application against a single database platform such that I probably will never change it.   (If I did, I would select DBIx::Class.)

What I am going to abstract-away is anything that cares what the particular column-name is; whether some business fact is captured by value x occurring in column y of table z.   I really want there to be just one piece of software in my application that “has to know” this.

Because, you know, if my code is littered with many copies of logic that queries the customer table and queries customer_type and checks for the value 'SC' to determine that the customer is a senior-citizen ... the true bugaboo is not precisely how I said that all those different times, but rather that I said it so many times in so many places.   That is what’s going to blossom into a maintenance problem that’s gonna bite me in the asterisk, no matter how exactly I said it.   A database table is not a business object.   You need to heavily and constantly focus your attentions on:   “what determinations are made, not how they are expressed in the current data model.”

to determine that the customer is a senior-citizen ... the true bugaboo is not precisely how I said that all those different times, but rather that I said it so many times in so many places.


Comment on Re: Database abstraction including data types
Re^2: Database abstraction including data types
by mbethke (Hermit) on May 22, 2012 at 06:03 UTC

    I agree completely; "DB abstraction layer" is just a fancy term for that piece of centralized code that speaks SQL to the database and business objects to the rest. The original coughphpcough code has just the problem you mentioned: it needs to know which column is a boolean and treat that specially in quite a lot of places to account for MySQL vs. PostgeSQL differences, and I don't want to go there.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://971524]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (11)
As of 2014-12-18 07:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (44 votes), past polls