Visual C++ Programming: Concepts and Projects Chapter 1A Introduction (Concepts)
Objectives 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 Visual C++ Programming
Objectives (continued) 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 Visual C++ Programming
Object Oriented Programming 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 Visual C++ Programming
Object Oriented Programming (continued) 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) Visual C++ Programming
A Robot Object Visual C++ Programming
Robot Design Specifications Visual C++ Programming
Object Oriented Programming (continued) 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 Visual C++ Programming
Program Interface (Form) Object Visual C++ Programming
Hardware Fundamentals Fundamental hardware components Input Means of getting data into the computer Examples: mouse, keyboard Output Means of displaying results Examples: display, printer Visual C++ Programming
Hardware Fundamentals 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 Visual C++ Programming
Fundamental Components Visual C++ Programming
History of Hardware Development 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 Visual C++ Programming
History of Hardware Development (Continued) 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 Visual C++ Programming
The ENIAC Visual C++ Programming
History of Hardware Development (Continued) 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 Visual C++ Programming
Software Fundamentals 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 Visual C++ Programming
Software Fundamentals (Continued) 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 Visual C++ Programming
Types of Software Visual C++ Programming
Windows Visa Operating System Visual C++ Programming
Windows Vista Start Menu Visual C++ Programming
Windows Vista Control Panel Visual C++ Programming
Windows PC Hardware Information Visual C++ Programming
The Hardware/Software/User Relationship Visual C++ Programming
History of Software Development 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 Visual C++ Programming
History of Software Development (Continued) Procedural languages 1950’s FORTRAN, COBOL, LISP 1960’s BASIC 1970’s C, Pascal Object oriented Simula (1967), SmallTalk (1980), C++ (1983), Java (1995) Visual C++ Programming
The Programming Process 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 Visual C++ Programming
The Debugging Process Visual C++ Programming
Successful Program Compilation Visual C++ Programming
Types of Errors Syntax Logic Runtime 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 Visual C++ Programming
A Project Development Strategy 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 Visual C++ Programming
The Project Development Cycle Visual C++ Programming
The Visual Studio IDE 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 Visual C++ Programming
Summary Object Oriented Programming Hardware Software 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 Visual C++ Programming
Summary (continued) The Visual Studio IDE Programming 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 Visual C++ Programming
Summary (continued) 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 Visual C++ Programming