VB .Net

Introduction to Programming

Objectives:

What is a computer? Examples? Hardware?

 

What is a program?

  • Sets of instructions that control processing data.
  • Guides the computer through orderly sets of actions specified by people called computer programmers.
  • Software: A set of instruction that hardware perform. (?)

 

What is a "good" program?

  • Readable
  • Modula
  • Efficient

Why do we learn Visual Basic?

What is Visual Basic? History.

Easy to learn and write.

Wide applications such as VBA, VBScript, ASP, and other Microsoft Products.

 

Object-Oriented Programming (OOP)
What could be an object in programming? : A bottle of water, a plastic bottle, a cap, a label, water.
Yun says, "The replicator in the starship Enterprise can make a cup of lemon tea because it is programmed in OOP". Do you agree?

What if the replicator does not use OOP?

The program has to specify EVERY details for composition of EVERY thing that constitutes the cup of tea. We are talking the level of molecular structures of every thing.

Using OOP, it may needs to state only a few specifications such as what kind of cup

Event-driven: "Computer, make me a cup of lemon tea." Or or pressing a button for an elevator.

 

Graphical User Interface (GUI): Using graphical images to run event-driven programs. The images on ATM machine.

 

The Program Development Life Cycle (PDLC) :

Programming is about developing a solution to an identified problem, and setting up a series of instructions that computer hardware to produce desired result. Careful analysis and design of a solution can reduce a lot of errors, time, and money.

Six Basic Steps in the Development of a Program
1. Define and analyze the problem. What are the inputs, outputs, and processing steps to produce the required outputs.

2. Design the program by outlining the solution for the problem.

  • Break the problem up into smaller tasks or steps such as:
  • Major processing steps involved: Algorithms

An Example of Algorithm. The following is a part of algorithm for calculating monthly payment of a loan:

Get rate, Term and Amount from text boxesdoublerate= dblrate / 12

for monthsdblrate = dblRate /100 'for percentdblTerm= dblterm * 12

for monthlycurpayment=PMT(dblRate,dblTerm,-dblamount)

the "-" converts the output to a positive numberlblpayment.caption = curpayment

 

  • Major subtasks: HIPO.

A Example of HIPO (Hierarchical Input Process Output):

 

  • Major control structures such as repetition loops: Flowchart.

An Example of a Flowchart:

 

  • Major variables and record structures.

 

  • Mainline logic: Algorithm, Flowchart.

 

  • Hierarchical or structural charts: Flowchart, HIPO.

 

  • Develop the outline into an algorithm. A set of precise steps that describe exact tasks to be performed and the order in which they are to be carried out, e.g. pseudocode, flowcharts.

    Examples of Pseudocode:

    • Add score to total_score
    • Divide total_score by student_count OR class_average = total_score / student_count
    • Compute C = (F - 32) * 5 /

 

  • Test the solution algorithms using actual data including extreme situations. Checking the algorithm for any major logic error early, so that they may be easily corrected. Test data needs to be walked through each step in the algorithm to verify that the instructions described in the algorithm will actually do what the developers intended.
3. Code the algorithm into a specific programming language. E.g. Visual Basic .Net. Document (internal) the logic and the purpose of major codes as comments in the codes.
4. Run the program on the computer. Using a program compiler and programmer-designed test data to machine test the code for syntax errors and logic errors. Debugging and Beta testing.
5. Deliver and install the program, run, and test.
6. Development and maintain the program. It is, in fact, an ongoing process from the initial definition of the problem to the final result. Continue on Internal and external documentation.