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

  • Home
  • SEARCH
  • 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 899933
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T15:18:10+00:00 2026-05-15T15:18:10+00:00

Can someone describe the main difference between table data gateway (TDG) and data access

  • 0

Can someone describe the main difference between table data gateway (TDG) and data access object (DAO) ?

TDG can operate with all row for that table but so and DAO (DAO can save, delete the specified object, but also can do operations on entire table)

Regards

  • 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-15T15:18:11+00:00Added an answer on May 15, 2026 at 3:18 pm

    In my view the main difference is that TDG is database (persistance) centric, while DAO’s are business / object instance centric.

    TDG acts as a facade (of sorts) to the database table – and is table centric (change the table and you’d change the TDG).

    DAO’s are an abstract view usually represent a specific instance of an object (not the whole table, in a table centric perspective – in fact they aren’t persistence centric at all); DAO’s are often designed around business concepts.

    TDG would be useful in situations where you simply need to build an access layer on top of a database – where the project was all about the database (getting access to it for other app’s etc – say a legacy system).

    DAO’s would be used in more ‘normal’ situations where you’re building a new business / logic focused solution from scratch.

    TDG Example (Pseudo Code)

    Your starting point would be the database, e.g: a table with 3 rows of data:

    ContactsTable
    --------------------
    Id | Name | Ph 
    --------------------
    01 | Bob  | 192837
    02 | Joe  | 564738
    03 | Ali  | 483957
    

    Your next step would be to build a layer of code that handled the physical data access, and the data you return would be no more and no less than what the table offers. If you have multiple tables they would be exposed separately (I think – I need to check). As a consumer of the data you’d have to join up stuff in your logic (in code outside of the TDG itself).

    How your code returns the data is largely up to you – you could even use an object:

    Class ContactTableRecord
    [
       Id
       Name
       Ph
    ]
    

    So now you have a representation of the data in code; your app can use the data however it likes. But if the database structure changes you’d also change the code layer to match – in this case the ContactTableRecord class. So design decisions around how the data is expose are driven by the data source.

    DAO Example (Pseudo Code)

    First you’d design your system around concepts – like customer, licenses, permits, purchases, endorsements, locations and so on; you’d then (probably) model relationships between those. Lets say we had some classes in our core Business Logic which we defined as:

    Class Customer
    [
       Id
       Name
       Ph
       Purchases
       ListAllPurchases()
       SendInvoice()
    ]
    
    Class Purchase
    [
       Id
       ItemDescription
       Customer
       DateOfPurchase
    ]
    

    Up until this point we haven’t accessed any data, we might not even know what our data source is going to be. If we’re thinking ahead we’ll abstract the data access out using Dependancy Inversion (DI).

    Of central importance to DI is the interface between the BL and DAL; we might specify an interface that included something like this:

    GetPurchaseDetails() - returns a PurchaseDetails object
    

    The PurchaseDetails object we’ve defined, which we intend to pass between the BL and DAL – or between our application and another application is a DAO – it’s a representation of the data which makes up the Purchase and Customer. Because its center of gravity is the BL it’s not constrained by the structure of the database (in fact we haven’t even got to that yet – we don’t need to for the DAO to exist).

    // This is our DAO: 
    Class PurchaseDetails
    [
       CustomerId
       Name
       Ph
       PurchaseId
       ItemDescription
       DateOfPurchase
    ]
    

    For another opinion see: Table Data Gateway vs. Data Access Object

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

Sidebar

Ask A Question

Stats

  • Questions 446k
  • Answers 446k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Why don't you try using a premade control like the… May 15, 2026 at 7:23 pm
  • Editorial Team
    Editorial Team added an answer what is happening here? You get ahead of the normal… May 15, 2026 at 7:23 pm
  • Editorial Team
    Editorial Team added an answer To be honest I am not aware of an XSS… May 15, 2026 at 7:23 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.