Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Object Oriented Design and databases

Posted on 2004-09-20
3
Medium Priority
?
267 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
[X]
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
3 Comments
 
LVL 37

Assisted Solution

by:gregoryyoung
gregoryyoung earned 200 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 101

Accepted Solution

by:
mlmcc earned 800 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 101

Expert Comment

by:mlmcc
ID: 12118151
Glad I could help

mlmcc
0

Featured Post

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

A short article about problems I had with the new location API and permissions in Marshmallow
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
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…
Suggested Courses

688 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