Solved

organising vb project

Posted on 2002-03-26
1
134 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

856 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