15
Lecture 1 Getting Started with Programming using Visual Studio

Lecture 1 Getting Started with Programming using Visual Studio

Embed Size (px)

Citation preview

Page 1: Lecture 1 Getting Started with Programming using Visual Studio

Lecture 1Getting Started with Programming

using Visual Studio

Page 2: Lecture 1 Getting Started with Programming using Visual Studio

What is Software?

Page 3: Lecture 1 Getting Started with Programming using Visual Studio

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

Page 4: Lecture 1 Getting Started with Programming using Visual Studio

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

Page 5: Lecture 1 Getting Started with Programming using Visual Studio

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.

Page 6: Lecture 1 Getting Started with Programming using Visual Studio

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.

Page 7: Lecture 1 Getting Started with Programming using Visual Studio

We want (need) to see the File Extensions

Page 8: Lecture 1 Getting Started with Programming using Visual Studio

Building a Console Application

Page 9: Lecture 1 Getting Started with Programming using Visual Studio
Page 10: Lecture 1 Getting Started with Programming using Visual Studio
Page 11: Lecture 1 Getting Started with Programming using Visual Studio

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.

Page 12: Lecture 1 Getting Started with Programming using Visual Studio

Dragging and Dropping Controls onto a Form

Page 13: Lecture 1 Getting Started with Programming using Visual Studio

Changing the Properties of a Control

Page 14: Lecture 1 Getting Started with Programming using Visual Studio

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.

Page 15: Lecture 1 Getting Started with Programming using Visual Studio