Software Development

  Lecture Notes

Lift Simulator Program

This tutorial shows you how to create a simple lift simulator program in Visual Basic. By the end of it, you should also understand the importance of coding standards.

Introduction

Create a New Project

A Scenario


Introduction

Objectives

This tutorial will enable you to: -

  • Create another simple VB application

  • Understand the importance of adhering to the following coding standards

    • Naming Controls
    • Commenting Code
    • Indentation

Create a New Project

The program you will create simulates a lift moving between floors. Option buttons are used to control the floor to which the lift moves to.

Activity A

  1. If you wish to see the program running, click here.

Note: Not all systems will be able to run this program.

To start, open Visual Basic and create a new project. You should be able to find Visual Basic by clicking on the Windows Start button and then selecting Visual Basic from the Program Menu.  Select Standard.EXE and then click on the Open button.

As soon as the VB development environment appears, save your new project and form files to an empty folder. It is always advisable to save new project files to an empty folder and not save to a folder that already contains VB files from a different project.

Now you are ready to continue.


A Scenario

Consider the following scenario;-

A software development company was contracted to develop the 'Lift Simulator' program. Unfortunately, just as the implementation phase was completed and the testing phase was about to start, the main programmer left quite suddenly. Embarrassingly for the company, the project files and documentation for the 'Lift Simulator' program cannot be found and the programmer who left cannot be contacted. All they can find is a screen dump of the program running and the code. They have to work fast to recreate the program and have asked you to tackle the job.

~~Activity~~

Activity B

Your job is to recreate the program. You can use the screen dump to help you recreate the form. You also have the program code. Click the link below to see the screen dump and the program code.

Do you think you can recreate the program using these two documents.

Try it. Use the screen dump to figure out what controls you need on your form. Then paste the code into the form's coding window.

Do you have enough information to recreate the program?

After struggling with the recreation of the Lift Simulator program for a while, your program manager rushes in and informs you they have found more up-to-date documentation. The new documentation has been found to comply with coding standards. This means the program can be recreated much quicker and far more easily.

~~Activity~~

Activity C

The more up-to-date documentation includes a form design and code that adheres to standards. We have...

    • a slightly better form design
    • code showing control names
    • indented code
    • commented code.

Click the link below to see the better documentation.

Use the new form design to make adjustments to your form if necessary. The form design tells you which controls to use.

Delete all existing code and paste in the new code.

There is one last problem. The form design did not specify the control names. This means you will have to look through the code and try to figure out the name of all the controls by looking at the code. This should be relatively easy if you remember that control names all start with a three letter prefix.

Now do you have enough information to recreate the program?

 


Fini
 

 

 

   

  Unit Information

Assessment

Syllabus

Scheme of Work

Notes &Tutorials

Assignments

Quizzes

Books & Things

Links