472,965 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,965 software developers and data experts.

desgin tables into objects or vice versa?

hi..

i'm a database kind of guy, when ever i apprached a new project i
always looked at it from tables point of view, how can normlize
correcly and them moved to the objects and desgined them accodging to
the tables..

i see that usually ppl go the other way, design objects and then desgin
the tables..

i was looking into my tables and usually i see i have column
type_of_somthing in it. like request_type in requests table or
order_type in orders tables, etc...
i was wondering, whenever i see this type of columns would it be right
to design a class tree according to it? for example abstract order
class and each subclass would correspond to an order type.

Jan 27 '06 #1
4 1240

"Elhanan" <em*****@hotmail.com> wrote in message
news:11*********************@g49g2000cwa.googlegro ups.com...
hi..

i'm a database kind of guy, when ever i apprached a new project i
always looked at it from tables point of view, how can normlize
correcly and them moved to the objects and desgined them accodging to
the tables..

i see that usually ppl go the other way, design objects and then desgin
the tables..

i was looking into my tables and usually i see i have column
type_of_somthing in it. like request_type in requests table or
order_type in orders tables, etc...
i was wondering, whenever i see this type of columns would it be right
to design a class tree according to it? for example abstract order
class and each subclass would correspond to an order type.


If different types must be processed differently then inheritance and
virtual methods are probably good.

If the processing is the same apart from some extra fields the probably best
not to bother.

If the fields differ other than by addition then processing must be
different and inheritance and polymorphism would be good.

Sometimes it can be better to handle these issues by sticking with a request
type but rather than using switch or if...then..else you use a dictionary to
look how to process the data. The advantage of this method is that the
dictionary can be populated using resource files and reflection.

Jan 27 '06 #2
I'm a database kind of guy, myself. As such, all my training and every
database design book I have ever read, and most developer books as well, have
started out with similiar scenarios: a brainstorming session with sticky
notes and big whiteboards on which everyone identifies objects, which become
tables, and attributes, which become fields or columns. From these sticky
notes, the designer does his magic and creates a database design that
developers write software around.

Well, your question shows that you suspect the books might be wrong.

You're right - they are wrong.

A better way is to start with gathering user and business requirements, from
these you create Use Case documents. Use Case documents are then used to
create static class diagrams.

Once you have a model of the classes necessary to implement the business
rules and requirements, you design a database schema to persist those
classes. That is the role of the database: to persist objects.

There are a lot of ORM (Object-Relational Modeling) products that try to
automate this process and some do a fair job but, so far, none will create an
optimized data model based on your class structure. You can use them as a
starting point and manually tweak the design or you can use the static class
diagram as input for manually creating a data model. Which you choose
depends on the scope of the project, budget, and personal (or team)
preferences.

I suggest searching for, and reading up on, Extreme Programming, Agile
Process, and Rational Unified Process. While there are many people who, for
their own good reasons, swear by one process or another, you should read up
on and understand all three.

HTH
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Elhanan" wrote:
hi..

i'm a database kind of guy, when ever i apprached a new project i
always looked at it from tables point of view, how can normlize
correcly and them moved to the objects and desgined them accodging to
the tables..

i see that usually ppl go the other way, design objects and then desgin
the tables..

i was looking into my tables and usually i see i have column
type_of_somthing in it. like request_type in requests table or
order_type in orders tables, etc...
i was wondering, whenever i see this type of columns would it be right
to design a class tree according to it? for example abstract order
class and each subclass would correspond to an order type.

Jan 27 '06 #3
i never view the database as just something to persist objects in, if
i did, i would just use hibernate and forget all about it, however i
always thinking on how other applications might to datamine my own
applications so i desgin the database to be optimal first then and
desing the classes around it (that's why i end up with a cloumns
object_type and not sub classe).

i've read several books like C# Objects, but i don't work in a team,
all this team effort of uses cases and meetings to create digagrams,
but in my reality , i have to leave from hand to mouth.

for example i created a small desktop application in vb6 which uses an
object model dll (which i also created) to calulcate pension, then they
wanted it to be able to receive data from another web page (the reason
why it wasn't web from the first place was the reqiruiment it should
operate on a stand alone basis with field agents and laptops). ok, i
said give me 2-3 weeks to have web interface around the dll (the dll
need around 150 fields to enter) , they gave me 2-3 DAYS. so i had to
be 'creative' and according to a microsoft article of microsoft, i
created a new 'proposal' protocol, so each time a user enters something
like:
proposal:servername/proposal.asp, the desktop application is lanched ,
uses the proposal asp (it got from the command line) which behind the
scenes uses the same dll to persist data and send it as xml, to it's
clone brother in the desktop application which loads back the data.

so i got to 'reuse' my software. and have stand into conflicting
requirements, the same products needs to be able to compeletly cut off
from any central sysem, but still be able to recieve data from a
central system (actually few of them, one in oracle, another from
access, last from as400) each with a diffrerent data format.

Jan 28 '06 #4
That's what happens when you live and work in the real world, huh? All
those things that "ought to be" just don't always happen that way. :)
--
Dale Preston
MCAD C#
MCSE, MCDBA
"Elhanan" wrote:
i never view the database as just something to persist objects in, if
i did, i would just use hibernate and forget all about it, however i
always thinking on how other applications might to datamine my own
applications so i desgin the database to be optimal first then and
desing the classes around it (that's why i end up with a cloumns
object_type and not sub classe).

i've read several books like C# Objects, but i don't work in a team,
all this team effort of uses cases and meetings to create digagrams,
but in my reality , i have to leave from hand to mouth.

for example i created a small desktop application in vb6 which uses an
object model dll (which i also created) to calulcate pension, then they
wanted it to be able to receive data from another web page (the reason
why it wasn't web from the first place was the reqiruiment it should
operate on a stand alone basis with field agents and laptops). ok, i
said give me 2-3 weeks to have web interface around the dll (the dll
need around 150 fields to enter) , they gave me 2-3 DAYS. so i had to
be 'creative' and according to a microsoft article of microsoft, i
created a new 'proposal' protocol, so each time a user enters something
like:
proposal:servername/proposal.asp, the desktop application is lanched ,
uses the proposal asp (it got from the command line) which behind the
scenes uses the same dll to persist data and send it as xml, to it's
clone brother in the desktop application which loads back the data.

so i got to 'reuse' my software. and have stand into conflicting
requirements, the same products needs to be able to compeletly cut off
from any central sysem, but still be able to recieve data from a
central system (actually few of them, one in oracle, another from
access, last from as400) each with a diffrerent data format.

Jan 28 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dharmendra Singh | last post by:
Hi I'm using .Net(C#) and working on the form(Screen) which have text boxes for both arabic and english data to store. So i want to change the language at run time from arabic to english and...
5
by: Megan | last post by:
Hi everybody- I'm helping a friend with a music database. She has an old one and is creating a new one. She wants to compare records and fields in the old database with records and fields in the...
2
by: Steve - DND | last post by:
Just wondering if anyone out there has any code to convert a plural word to it's singular form and vice versa. Most of our database tables are named in a plural fashion. When we go to create...
1
by: serge | last post by:
I am running SQL Server Best Practices on a SQL 2000 database and it is recommending me to change the temp tables inside SPs to table variables. I had read already in other places to use table...
10
by: Robert | last post by:
How do you get an accurate count of the number of records returned from a query when using linked tables. I have an access 2003 database as a front end to another access 2003 database that...
5
by: MORALBAROMETER | last post by:
Hi all, I have two tables that are not link. But their content are interrelated. I want to find out what is in one table that is not in the other and vice-versa. how can archieve this in c# or...
22
by: amygdala | last post by:
Hi, I'm trying to grasp OOP to build an interface using class objects that lets me access database tables easily. You have probably seen this before, or maybe even built it yourself at some...
1
by: bluereign | last post by:
Thank you for your assistance. I am a novice looking to JOIN and append or combine records from 2 current Tables into 2 new Tables named below. I have been able to JOIN Tables with the script...
167
by: darren | last post by:
Hi I have to write a multi-threaded program. I decided to take an OO approach to it. I had the idea to wrap up all of the thread functions in a mix-in class called Threadable. Then when an...
2
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 4 Oct 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.