Skip to content

Extracting DB layer when introducing more applications to the project #67

Answered by benbjohnson
Algebra8 asked this question in Q&A
Discussion options

You must be logged in to vote

@Algebra8 No problem on the long question. Thanks for the code examples—they help to give context.

I wouldn't personally abstract out the database itself. I've tried that on projects in the past but there are typically two issues. First, most applications only need use a single type of database (e.g. Postgres) so abstracting it doesn't provide any benefit. Second, abstraction requires that you cater to the lowest common denominator and each database can be quite different in what it provides. For example, many databases provide transactions but some do not. Also, if you do abstract out a DB type then do you also need to abstract out a Tx type?

Another benefit to keeping the abstraction at…

Replies: 1 comment 3 replies

Comment options

You must be logged in to vote
3 replies
@Algebra8
Comment options

@luqmansen
Comment options

@benbjohnson
Comment options

Answer selected by benbjohnson
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants