Tuesday, March 1, 2011

Programming Practices

PROGRAM READABILITY
a.) Meaningful Identifiers

      Dim mAccessCode As Long       
           Dim message As String

Declaires the variable mAccessCode as type Long. Like Integer , Long stores whole numbers (w/o decimal point). the rage of the values that can be stored in a Long are-- 2,147,483,648 to 2,147,483,647.
The Long is a type of character &. with m allows them to be identified easily.

b.) Logic Practice 


    Select Case mAccessCode
         Case Is < 1000
             message = "Access Denied"
             Beep
         Case 1645 To 1689
             message = "Technician Personnel"
         Case 8345
             message = "Custodial Services"
         Case 55875
             message = "Special Services"
         Case 999898, 1000006 To 1000008
             message = "Specific Personnel"
         Case Else
             message = "Access Denied"
  End Select
Placing a larger value on the left side of keyword To in a Case is a logic error and is ignored at run-time.
When using the optional Case Else statement in a Select Case structure, not placing the Case Else as the last statement is a syntax error.

c.) Coding Practice

      Case Is < 1000
Keywords Is along with the comparison operator < , specifies the rage of values to test.

d.) Notes and Comments

    Dim message As String

   mAccessCode = txtDisplay.Text
   txtDisplay.Text = ""

PROGRAM DOCUMENTATION

a.) Program Listing

    Private Sub cmdZero_Click()
        txtDisplay.Text = txtDisplay.Text & "0"
  End Sub

I listed the properties for cmdZero, Although i did not use other numbered buttons, they have the same property settings.

b.) Program Specification

Security Keypad
-A Simple Vb Programming, Easy Operation
- It can also a Security Access Control Keypad ( Company User )-For switching locks,entry and security systems.
-Has a limited Users codes.

Numbers combinations are possible for the 4 independent user codes: 
1645 to 1689 (Technician Personnel)
8345 (Custodial Services) 
55875 (Special Services)
999898, 1000006 to 1000008 (Scientific Personnel).
User code 1000 can be altered to act as a Panic code for reporting panic to an "Access Denied".


c.) File Layouts and Record Description

I listed the properties for cmdZero, Although i did not use other numbered buttons, they have the same property settings.

Tthe variable mAccessCode as type Long. Like Integer , Long stores whole numbers (w/o decimal point). 
The rage of the values that can be stored in a Long are-- 2,147,483,648 to 2,147,483,647.
The Long is a type of character &.

 1stLogEntry.AddItem Now & Space$ (3) & message

-It has the ability to record the time and date to the text box and it tells as if it is "Access Denied" or granted.
 Now is the current system time and date.
function Space$(3) creates and returns a string containing spaces.


d.) Operating Instruction

including the Case Else statement focuses the programer on the need to process exceptional conditions.  In some situation s, no Case Else processing is needed.
The required End Select terminates the Select Case structure, such indentation improves program readability.


Look at the file layouts and the Instructions. ( Security Keypad Program GUI ) 


Initial GUI at execution.


User entering an access code.




















GUI after user has pressed Enter.


-Code Listing-






 Visual Basic 0.6






  

No comments:

Post a Comment