Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6106927
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:07:55+00:00 2026-05-23T14:07:55+00:00

In OOP design of the database abstraction layer, is it proper to create a

  • 0

In OOP design of the database abstraction layer, is it proper to create a wrapper object for the original DB object that uses it? To supply all the user,pass within itself and create an active connection so that other objects such as CRUD could inherit it and already have an open connection?

<– EDIT –>

some background: what i’m trying to build here is a good separation between the db-logic and the business-logic
so i thought of creating a table CRUD object to be inherited by other business logic objects
but the problem arises when i thought of how would the connectivity to the DB would transfer
between those objects. it didnt feel so right to just pass it as parameters like

class TableCrud(AbstractDb $db) {...}
class BusinessObject(TableCrud $tc) { ... }

also another approach that doesnt feel so right to have an object that contains the DB user credentials, within it that open a connectivity and let TableCrud inherit it.

i’m sure that i’m missing some in between object mechanics here.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:07:56+00:00Added an answer on May 23, 2026 at 2:07 pm

    When I write database models, it typically goes like this:

    Model.php:

    include('connect.php');
    
    class Model{}...
    

    connect.php:

    include('Database.php');
    include('dblogin.db');
    
    $db = new Database( $user, ...);
    

    Database.php:

    class Database{}
    

    dblogin.db:

    $user = user;
    ...etc...
    

    tl;dr: Yes, that’s how you might add an abstraction layer on top of your DAL.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How should I implement items that are normalized in the database in object oriented
I've recently became interested in proper OOP design in web applications. I think I
MVC/OOP design patterns say you don't set a property, per se, you ask an
I'm reading a lot about good and bad practices in OOP design. It's nice
As I learn more and more about OOP, and start to implement various design
Perl has OOP features, but they are somewhat rarely used. How do you create
How should columns in a database table that have a PK/FK relationship be named?
I'm fairly new to database design, but I understand the fundamentals. I'm creating a
I'm trying to wrap my head about how to properly implement an OOP design
The problem is mostly OOP design problem. I have a class which handles the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.