Object Oriented Design and databases

Posted on 2004-09-20
Last Modified: 2013-11-23
I am currently reading "Beginning C# Objects: From Concepts to Code" It is pointing me down the right path of writting more object oriented programs. However the book doesn't really talk about integrating w/ a database.  The example they give is a student registration program, where students register for college classes. It talks about having a Person Class w/ all the attributes of person and then Student class and a Professor class that inherits from the Person class. Does this mean in my database I should have 3 tables, Person, Strudent , and Prof? Also, I'm somewhat familiar w/ how does this all tie in?  If I have 2 tables to do CRUD (Create, Read, Update, and delete) when working w/ a Student or a Prof it seems like more work to do?
Question by:lyptus
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
LVL 37

Assisted Solution

gregoryyoung earned 50 total points
ID: 12108235
I would take a look at object persistance. A great framework can be found for free in (a quick google brings it right up).

if you by chance prefer to buy things, is definately worth a look at.

Gentle uses C# attributes on your classes to map them back to the database, it will also handle the brokerring of your objects.

Another one I recently saw which looked decent is the WilsonORMapper (again a google brings it up)


LVL 101

Accepted Solution

mlmcc earned 200 total points
ID: 12108821
>>Does this mean in my database I should have 3 tables, Person, Strudent , and Prof?
This really depends on the database.  In a relational database you would build
Person - All common information on a person (Name, address, etc)
Prof - Unique information for a professor and link to person (Department, full/assist/assoc etc)
Student - Unique information on stuidents and link to person (YearGrad,credits, courses, etc)

I haven't worked with an O-O database but it seems to me you would have similar table structure but you would create a student which would also create the person record.

>>If I have 2 tables to do CRUD (Create, Read, Update, and delete) when working w/ a Student or a Prof it seems like more work to do?
Actually the only truly additional work is the adding the link to the student or prof table and creating the record in the student or prof table.  Since the common information is in the person table it is entered only once.

LVL 101

Expert Comment

ID: 12118151
Glad I could help


Featured Post

Transaction Monitoring Vs. Real User Monitoring

Synthetic Transaction Monitoring Vs. Real User Monitoring: When To Use Each Approach? In this article, we will discuss two major monitoring approaches: Synthetic Transaction and Real User Monitoring.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A short article about a problem I had getting the GPS LocationListener working.
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question