?
Solved

organising vb project

Posted on 2002-03-26
1
Medium Priority
?
144 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 400 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

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

850 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