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
  • 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 100

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 100

Expert Comment

ID: 12118151
Glad I could help


Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

929 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now