Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > C# and C > C# 2005 > BOOK: Beginning C# 2005 Databases
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
BOOK: Beginning C# 2005 Databases
This is the forum to discuss the Wrox book Beginning C# 2005 Databases by Karli Watson; ISBN: 9780470044063
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning C# 2005 Databases section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old October 16th, 2008, 12:43 PM
Registered User
Join Date: Aug 2008
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Multi Layered Design


I am working on a program that takes multiple fields from several databases, about 160 to be more specific, and writes the values to a text file. My question is in designing a multi layered app I have it where each DB in the program gets it's own data class and a corresponding business class. Is this the better approach or should I have one data class that uses a join and one business class that is a class of the result set?

  #2 (permalink)  
Old October 19th, 2008, 11:29 AM
Friend of Wrox
Points: 1,166, Level: 13
Points: 1,166, Level: 13 Points: 1,166, Level: 13 Points: 1,166, Level: 13
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Sep 2008
Location: Indianapolis, IN, USA.
Posts: 234
Thanks: 0
Thanked 32 Times in 30 Posts

There's a bazillion ways to do this, but I favor a three-tier design in situations like this.

1. The first tier is the user interface. It contains the code that the end user sees and interacts with.

2. The second tier contains the rules that dictate how you want to interact with the data. For example, if the user interface has a login screen, perhaps each person has a different security access code. That way, one employee might have access to some data, but is denied access to other data. This tier enforces those rules.

3. The third tier contains the code that interacts with the data. The sole purpose of this tier is to service the second tier's request for (or edits to the) data. Even though you are working with multiple DB's or tables, I would put everything that talks with the business rules tier in this tier. This decouples the rules from the data server. The advantage is that you isolate the tiers so each becomes a "black box" to the other tiers. Therefore, if you make changes in the data tier, the rules tier need not even know about it.

(WARNING: Ad to follow)
My C# book designs and implements a simple card game in Chapter 10. The user interface is what the player sees (tier 1). The second tier contains the rules for the game (which includes betting), and the third tier is the data server. In this case, rather than being a DB, the data server tier is a deck of cards, with methods for creating the deck, shuffling it, and dealing out cards, etc. While your problem is not a one-to-one match, it can be modeled as such.

I hope this helps...

Dr. Purdum

Jack Purdum, Ph.D.
Author: Beginning C# 3.0: Introduction to Object Oriented Programming (and 14 other programming texts)

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Layered Applications Muhammad Zeeshan General .NET 5 July 25th, 2007 04:08 AM
Adding Multiple Event to button in layered PopUp saqlain.abbas ASP.NET 1.0 and 1.1 Professional 1 June 28th, 2007 04:05 AM
Multi-field entry design and reporting Nanette Access 2 October 26th, 2006 11:02 AM
multi-multi-multiple Insert with subquery??? jmjyiannis SQL Server 2000 1 May 5th, 2006 02:20 PM
Java Design issue with UML and Design Patterns the_logical_way Apache Tomcat 0 May 31st, 2004 04:02 AM

All times are GMT -4. The time now is 05:30 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.