Lecture 1 - It works!

advertisement
Lecture 1
Getting Started with Programming
using Visual Studio
What is Software?
Implementing a Program is NOT the Hard Part
An aging maintenance man at an engineering plant was forced into retirement as a money-saving measure following extensive
modernization of the plant. Soon after leaving, he was called back to help fix some of the equipment that had broken down and
was not responding to the trouble-shooting methods being recommended by the newly installed automated control system. The
elderly maintenance man walked into a maze of pipes, took out a hammer and gave one of the pipes a sturdy whack. The
machinery immediately starting running. The maintenance man sent the plant manager the following invoice:
Fee for service................................................. $1,000.00
Hitting pipe with hammer.................................. $
1.00
Knowing which pipe to hit................................. $ 999.00
Software Development Process
Calculate your car’s gas mileage.
We need two odometer readings, and the number of gallons of gas used between them.
1.
2.
3.
4.
5.
6.
Fill tank
Record first odometer reading
Drive a while
Fill tank and note number of gallons required.
Record second odometer reading
Divide difference in odometer readings by the number of gallons used.
Live demo in Class
What types of things should we test?
Structured Procedural Programming
In a structured program, the computer controls the sequence of operations. When the program
needs input from the user, a message is displayed and the program will wait for the user to respond.
Otherwise the program moves through the program step-by-step until the intended results are ready
to be displayed to the user or stored for later use. Structured procedural programs can be
implemented as console applications.
Object-Oriented Programming
In this course we are going to side-step a lot of the “hoopla”
associated with object-oriented programming. As stated in
the (Doyle) textbook,
The concept behind object-oriented programming
(OOP) is the applications can be organized
around objects rather than processes.
While there is a lot of other aspects of OOP, they are more
about the theory than the practice of writing programs. For
our purposes we note that the graphical elements in a
graphical user interface (GUI) program such as buttons,
textboxes, counters, sliders, menus, etc...are objects. We will
write software that performs specific functions whenever the
user interacts with these objects. These functions and
methods are known as event-handlers. The sequence of
operations in a GUI application are controlled by the user
rather than the computer.
We want (need) to see the File Extensions
Building a Console Application
Building a Windows Forms Application
For the class desktop computers
we will need to change the working
directory...
Using the Desktop will make it
easier for us to find the project.
Dragging and Dropping Controls onto a Form
Changing the Properties of a Control
Adding an Even-Handler to a Control
Double-clicking the “Click Me” button
creates code for a click event handler.
We add the MessagBox.Show line to
the body of this method.
Now we are ready to run this program.
Click on the green triangle under the
Debug menu.
Download