Investigating Visual Programs

Authors Avatar
BTEC Visual Programming Unit 32

Title: Investigating Visual Programs

Task 1

As you investigate the programs, List and explain the differences you find as you work in the environments.

Explain the benefits of working in a visual environment instead of a non-visual environment? P6

Visual Basic

Visual Basic is probably the most popular and powerful of all. It has many advanced features which allow you to write great programs in a short time with a minimum of code and sometimes no code at all from your part if you're to use the application wizard.

QBasic

QBasic (a name derived from QuickBASIC, BASIC being an acronym for Beginner's All-purpose Symbolic Instruction Code) is a variant of the BASIC programming language. The source code is compiled to an intermediate form within the integrated development environment (IDE), and this intermediate form is immediately interpreted on demand within the IDE.

QBasic and VB are really just sets of commands to tell the computer what to do. There are significant differences between QBasic and VB.

The first and most obvious difference between Qbasic and Visual basic is that a Qbasic is a dos program whereas VB (Visual Basic) is a windows program. That means that while they both have successful communities of enthusiastic a programmer, Qbasic is old. And while it is perfectly good as a programming language, the operating system that it works and compiles in is getting less and less compatible with modern computers. So while the programs it makes might be intrinsically flawless, they are not useful. On the other hand since VB is a newer programming language, it can be used to make programs that can be distributed and possibly sold because the programs it makes are compatible with modern computers. Even programs that are not so good can be useful if made by VB.

A second difference is in the way the programs are and can be made. VB is preloaded with all kinds of buttons and boxes, however mostly it is limited to these as forms of input and output. Qbasic is not preloaded with any user interface at all, let alone one with preset functionality, but can be programmed to take input anywhere and anyhow, if you can figure out a way to put it into code. But while VB can use many colours, Qbasic can only handle 16 of them.

The third and most important difference is in the way the languages run. Whereas as Qbasic runs like a flowchart and in fact could be written into one, Visual Basic is a series of scripts for events. So, while Qbasic is processing lines of code one by one, VB is waiting for something to happen. Conversely, while VB is recognising a click on a button and running through the event's script, Qbasic is still trotting through its code, unaware that anything happened because it was not told to check.

Benefits of working in a visual environment instead of a non-visual environment

* Extremely popular due to ease of use.

* Uses same interface as Microsoft's other Visual Studio Products.

* Can be run either interactively as an interpreted language or compiled into an executable.

* Permits Rapid Application Development (RAD) due to its object oriented - event driven design.

VB is Event-Driven

* In event-driven programs the user dictates the order of program execution.

* For example, in the Move Ball Program by clicking on a button with the mouse (the event), user chooses how the ball will move.

* Because of this user control, event-driven programs are considered to be "user friendly."

Object Oriented Programming

* A Class defines under what circumstances an object can be created.

* An Object is an instance or example of a class.

* Objects have properties (attributes) and methods (procedures), the details of which are hidden within the object

Procedures

* The best way to build and maintain a large program is to use the "divide and conquer" technique.

* The project is made up of modules.

* Each module is made up of Procedures.

* 4 type of Procedures:

o Event Procedures (e.g., button click)

o VB Procedures and Functions (e.g., IsNumeric)

o User Defined Sub Programs

o User Defined Functions

Objects make programming much easier

* Instead of having to do everything through statements, Objects make programming much easier.

* Objects can be manipulated through their properties and methods.

* Code can be associated with an action upon an object through the objects built-in event procedures.

Comments & Naming Conventions

* The distinction between the label the computer users to track an object (I.e. name) and the label the user sees (I.e., caption) sometimes makes it difficult for the programmers to keep track of which objects they are using.

* Especially difficult for programmers who are working on code that they did not write.

* Need for comments and naming conventions.

Recommended Techniques to Minimize "Bugs"

* Setting "Option Explicit" to force explicit declaration of variables

* Commenting the code

* Using the syntax checker

* Using the recommended naming conventions

* Setting a tight scope on the variables and procedures

* Perform range and validity checking of the variables and data
Join now!


Debugging

* Many programming errors can be eliminated through a careful program development process and structured programming techniques.

* However, no matter how carefully a program is developed, the code will invariably contain errors which must be eliminated through the process of Debugging before the program can be deployed.

Standard Debugging Techniques

Standard Debugging Techniques include:

* Using print statements to view the progress of a program the errors

Commenting out sections of the code to isolate VB Debugger

* Break Points can be used to halt execution ...

This is a preview of the whole essay