Tuesday, March 1, 2011

Programming Practices

VISUAL BASIC
Visual basic is a programming language developed by Microsoft in year 1998 and its successor is Visual Basic.net released March 2008. Visual Basic is user friendly because it has the same characteristics of     BASIC (also a programming language) which is suitable for the beginners.

SAMPLE PROGRAM
This is a sample program in creating a simple slot machine.

Sample Output


PROGRAMMING READABILITY

IDENTIFIERS>> Identifiers are used to declare variables.
In my program i use identifiers which is short,meaningful and easy to distinguish, for example:
intnum1- means I declare number 1 as integer and
dblBet - means i declare bet as double(integer with decimal value).

LOGIC STRUCTURE>>must be simple as possible to lessen the chance of errors.
Much shorter the program the more simpler it is, when the code is simple errors will lessen..
In my sample program I used if and else statement so that program is shorter and you can easily see what is wrong when your program is not working.

CODING PRACTICE>>Should be written in the code that will do what is needed.
intNum1  =  ""
intNum  =  ""
intNum3  =  ""
this is a part of the program which it's task is to clear the previous output of number 1,2,3.

NOTES AND COMMENTS>>
I didn't use comments and notes in this program.

PROGRAMMING DOCUMENTATION

PROGRAM LISTING>>use keywords and proper naming conventions.
In my 3 labels I use lblNum1,lblNum2 and lblNum3, lbl means label and num means number.
In my text 4(located at the side of the word enter your bet) I use txtBet because in that text you will input your bet. Txt means text.

PROGRAM SPECIFICATION>>Defines the course of the user specifications.
I used Visual Basic version 6.0 and Windows xp as my os in creating this program.

FILE LAYOUTS AND RECORD DESCRIPTION
Data types used:
a.Dim intNum1, intNum2 and intNum3 as Integer
b.Dim dblBet, dblWin as double

OPERATING INSTRUCTIONS
In using vb the names that you are trying to input must be simple and easy to understand because vb is case sensitive, once you input the name improperly the program you had created will not run and it will display an error.


No comments:

Post a Comment