473,499 Members | 1,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1252

"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
3284
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
10850
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
6817
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
4452
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
6705
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
1664
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
3458
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
3403
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
8147
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...
0
7169
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7385
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5467
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4917
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4597
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3096
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1425
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.