visual c++ programming: concepts and projects chapter 1a introduction (concepts)
TRANSCRIPT
Objectives
Visual C++ Programming
2
• Learn about the fundamental concepts of object-oriented programming
• Explore the fundamental hardware components of a computer
• Learn about the fundamental types of software• Study important people and events in the
history of computer hardware and software development
• Learn about the program compilation process and the project design methodology
Objectives (continued)
Visual C++ Programming
3
Explore the Visual Studio IDE Create your first Microsoft Visual C++
program Create and use TextBox and Button
controls Write and run C++ code that responds
to a button click Read and interpret error messages
Object Oriented Programming
Visual C++ Programming
4
Visual C++ is A programming language used to write
software Developed by Microsoft for Windows
computers Derived from the standard version of C++
Visual C++ is an object-oriented programming language
Object Oriented Programming (continued)
Visual C++ Programming
5
Object oriented programming languages create objects that can be manipulated, for example… Visual objects (like buttons you can click on) Data objects (like a list of exam scores)
Objects Have attributes and operations (called
methods) associated with them Are based on definitions (called class
definitions)
Object Oriented Programming (continued)
Visual C++ Programming
8
Visual C++ is used to create programs that present a Graphical User Interface (GUI)
A GUI is an object (called a form) Typical attributes include
Button objects to click on Textbox objects to enter or display data
Typical methods include Programs that carry out tasks when a button is
clicked
Hardware Fundamentals
Visual C++ Programming
10
Fundamental hardware components Input
Means of getting data into the computer Examples: mouse, keyboard
Output Means of displaying results Examples: display, printer
Hardware Fundamentals
Visual C++ Programming
11
Fundamental hardware components Processing (Central Processing Unit – CPU)
Arithmetic/Logic Unit – handles numerical tasks and comparisons
Controller – handles task scheduling Memory
Microchips used to store data temporarily while program is running
Storage Stores data permanently, even when computer
is turned off Examples: CDs, DVD, flash drives, hard drives
History of Hardware Development
Visual C++ Programming
13
Modern computing required… The invention of electronic binary methods
of computing The development of machines that were
able to store their own programs The advent of large-scale electronic
circuitry
History of Hardware Development (Continued)
Visual C++ Programming
14
Four generations of hardware development First generation (1930’s-1950’s)
Vacuum tube technology Computers were large and subject to frequent
component failure Example: ENIAC (WWII project at U of
Pennsylvania) Second generation (late 1950’s – 1960’s)
Transistorized technology Complex wiring
History of Hardware Development (Continued)
Visual C++ Programming
16
Four generations of hardware development (continued) Third generation (late 1960’s – 1970’s)
Integrated circuit (IC) technology Mass-produced, small-scale integration of
components Fourth generation (late 1970’s – today)
Microprocessors Very large scale integration of components on a
single microchip Made microcomputers possible
Software Fundamentals
Visual C++ Programming
17
Types of software Systems software
The operating system (UNIX, Mac OSX or Microsoft Windows for example)
Utility programs used to manage files read from input devices control output to the screen
System software interfaces directly with hardware components
Software Fundamentals (Continued)
Visual C++ Programming
18
Types of software (continued) Applications software
Purpose is tied to the needs of the user Uses the resources provided by the operating
system General-purpose
May be used by different users for different purposes
Word processors, spreadsheets, databases, e-mail programs, and Web browsers for example
Dedicated purpose Used to carry out specific tasks only
History of Software Development
Visual C++ Programming
25
Machines language Consists of binary codes (0’s and 1’s)
Assembly language Uses short commands to stand for specific
machine language tasks High-level language
English-like Portable from one computer to another C++ and Visual C++ are high-level
languages
History of Software Development (Continued)
Visual C++ Programming
26
Procedural languages 1950’s
FORTRAN, COBOL, LISP 1960’s
BASIC 1970’s
C, Pascal Object oriented
Simula (1967), SmallTalk (1980), C++ (1983), Java (1995)
The Programming Process
Visual C++ Programming
27
Source code is a program written in a high-level programming language (like Visual C++)
Object code is low level code (binary level, machine language)
Computers require low-level instructions Compilers turn source code into object code
If errors are found compilation ceases The program must be debugged and
recompiled
Types of Errors
Visual C++ Programming
30
Syntax Detected by the compiler
Warnings and fatal errors Usually typographical and easy to fix
Logic Program compiles and runs but results are
incorrect Often requires redesign of program logic
Runtime Program stops running unexpectedly Usually the result of an illegal operation
Example: division by 0
A Project Development Strategy
Visual C++ Programming
31
Problem Analysis Identification of program requirements
Design Interface sketch and development of solution
strategy Development
Coding in high-level language Testing
Testing the solution under different scenarios
The Visual Studio IDE
Visual C++ Programming
33
Visual C++ is supported by the Visual Studio IDE An Integrated Development Environment (IDE)
contains Solution Explorer window
Shows the file structure of your solution Form layout window and Design tab (Design window)
Allows you to create your interface Toolbox
contains control objects you can put on the interface Properties window
Shows attributes of each object you have selected Toolbars and menus
Summary
Visual C++ Programming
34
• Object Oriented Programming• Class definition• Objects based on class definition• Objects have attributes and methods
• Hardware• Five fundamental components of a computer• Four generations of hardware development
• Software• System software and applications software
Summary (continued)
Visual C++ Programming
35
• The Visual Studio IDE• Integrated programming environment
• Programming• Source code is written in a high-level
language• The compiler translates source code into
object code so that it can execute• Types of errors: syntax, logic and runtime
• The program development process• Four stages: problem analysis, design,
development, testing
Summary (continued)
Visual C++ Programming
36
Visual C++• The Toolbox contains controls for your program• The Properties window allows you to change
control properties• Event-handlers are methods that belong to
particular objects• Visual C++ code is written for each event
handler• Assignment statements assign the value on the
right of the = operator to the location on the left