Solved

organising vb project

Posted on 2002-03-26
1
131 Views
Last Modified: 2010-05-02
I am trying to plan a project that has multiple tables with related parts

so far i have these tables

On an Add form i'm going to get the user to input

Part Number (required)
Accessory, Series,Type (optional)
Bearing,Block,Chain,Disc,DriveShaft,Gear,Roller (one required)

when this is input the program should add a new record into all the related tables

Transmission will always be updated with

Part Number
TransTypeID (Series + Type values checked - if they exist in database then get the ID for record and record it here.          Otherwise add a new record to Transmission Type + record TransTypeID here)

TransDescID (Bearing, Block etc are checked for values. If Block value entered, program checks Transmission Descriptions Table for correct TransDescID for a Block. This value is entered here. The Block Table is then updated.

So i think i have all this clear in my head. But i'm not sure how i should organise the project? Should i have a class for each of these tables. Or should i have one class that represents all Transmission parts?



Transmission

Part Number     text
Accessory     text
TransTypeID     number
TransDescID     number

Transmission Type

TransTypeID     number
Series          text
Type          text

Transmission Descriptions

TransDescID     text
Description     text

Bearing

Part Number     text
Description     text

Block

Part Number     text
Description     text

Chain

Part Number     text
Description     text

Disc

Part Number     text
Description     text

DriveShaft

Part Number     text
Description     text

Gear

Part Number     text
Description     text

Roller

Part Number     text
Description     text

0
Comment
Question by:jhaigh
1 Comment
 
LVL 18

Accepted Solution

by:
mdougan earned 100 total points
ID: 6896404
Early on, it was popular to try to have a class for every table.  The idea was that the class was just a server of the data.

But, the problem with that is that it means that the programmers using the class have to have a lot more knowledge about how all the classes fit together to form the more complex "object" in this case, the transmission, and that's really more than should be required.

In a well designed application, you should encapsulate all of the stuff related to a transmission into a single class.  Bury all of the details about what tables have to be updated inside of the class.  Then, in the future, programmers using your class will just have to provide the attributes of a transmission, and your class will, behind the scenes, make sure they all get to the proper tables.

This has the added advantage that the database might change in structure, and if you just change the "implementation" (the code inside) of your class, without changing the "interface" (the public function that users of your class are calling) then it will keep from breaking all of the applications that use your class...
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now