lecture 1 getting started with programming using visual studio

Post on 17-Jan-2016

225 Views

Category:

Documents

0 Downloads

Preview:

Click to see full reader

TRANSCRIPT

Lecture 1Getting Started with Programming

using Visual Studio

What is Software?

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

Implementing a Program is NOT the Hard Part

Calculate your car’s gas mileage.

We need two odometer readings, and the number of gallons of gas used between them.

1. Fill tank2. Record first odometer reading3. Drive a while4. Fill tank and note number of gallons required.5. Record second odometer reading6. Divide difference in odometer readings by the number of gallons used.

Live demo in Class

What types of things should we test?

Software Development Process

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 computerswe will need to change the workingdirectory...

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” buttoncreates code for a click event handler.

We add the MessagBox.Show line tothe body of this method.

Now we are ready to run this program.

Click on the green triangle under theDebug menu.

top related