Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old March 15th, 2003, 11:28 AM
jakuza's Avatar
jakuza jakuza is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Posts: 65 jakuza User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 46 m 52 sec
Reputation Power: 6
Abstraction vs application level

Hi there,
my goal is to describe in a single database a booking system for different kinds of resources.

Let's suppose only three kinds of 'facilty': hotels, restaurants and car rental.
The need is for implementing a uniform fares scheme.

create table facility (
# it describes every single facility (hotel, restaurant, car rental)
id int,
name varchar,
category int,
address varchar,
.....
)

create table categories (
id int,
name varchar # [hotel | restaurant | car rental | ...]
)

create table resources (
# it should describe hotel rooms but also restaurant menus and cars to rent with relative fares...
id int,
facility int,
name,
type,
price
)

create table calendar (
resource int,
start timestamp,
end timestamp
)

The problems in this (absolutely not-working) design are:
- 'type' field should express the differences between a menu and a room but then where to store explicitely those differences?
In another DB table or in the application layer?
- 'price' field is not uniform: a menu is a one-shot price, a room is calculated on a per-day basis, a car on a per-hour basis.
- 'start' and 'end' timestamps in the calendar are a good way to express the use of every kind of resource, but there
are problem on the user side: a menu has no duration (it could be defaulted in the back-end, anyway) but a room has a
per-day scheduling while a car has not...

I don't think there's an easy way to have an abstract scheme to describe every kind of resource, maybe there's not. I'd only
like to see if there's a good idea out there or a simple one that I'm just missing....

I also thought of implementing a different logic at application level depending on the categoriy value of the facility but I dont'
want to (I'd like not to) write a new and different piece of code every new category the application user creates...

What about this all?

Bye bye

Reply With Quote
  #2  
Old March 15th, 2003, 12:53 PM
darkwave darkwave is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Location: Rome
Posts: 1 darkwave User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Lightbulb

For the price problem:

you can store the "1 unit price" and then you moltiply it per days or items. In this way you solve the problem linked to a menu item.
You have to store the items number and the single item price!

Calendar:

You don't need to store calendar information for every Resource. It's an information needed only on some kind of Res so why to store it when is not applicable?

Type field for resources:
A new table with description and other informations. For example you can store there if calendar is applicable or if is a "one-shot priced".

Ciao,
DARKWAVE

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > Abstraction vs application level


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway