Solved

Object Oriented Design and databases

Posted on 2004-09-20
3
257 Views
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/ ADO.net 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?
0
Comment
Question by:lyptus
  • 2
3 Comments
 
LVL 37

Assisted Solution

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

if you by chance prefer to buy things, dataobjects.net 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)

Cheers,

Greg
0
 
LVL 100

Accepted Solution

by:
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.

mlmcc
0
 
LVL 100

Expert Comment

by:mlmcc
ID: 12118151
Glad I could help

mlmcc
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 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…

708 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

18 Experts available now in Live!

Get 1:1 Help Now