* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Overview
Structured programming wikipedia , lookup
Go (programming language) wikipedia , lookup
Programming language wikipedia , lookup
Abstraction (computer science) wikipedia , lookup
History of compiler construction wikipedia , lookup
Object-oriented programming wikipedia , lookup
Interpreter (computing) wikipedia , lookup
An Introduction to Programming with C++, Third Edition Overview Lecture Notes Overview This overview reviews the basic components of a microcomputer system and the relationship between hardware and software. In addition, a brief history of programming languages is presented taking the student from machine language to current high-level languages. Objectives After completing the overview, the student will be able to: Describe the components of a microcomputer system Explain the relationship between hardware and software Explain the history of programming languages Instructor Notes An Introduction to a Microcomputer System In the mid-1970s the first microcomputers, also called personal computers, appeared in the marketplace. In a very short amount of time these devices have become a permanent part of how we do business today. For many tasks that used to take a large amount of time manually, now take only seconds to accomplish with a microcomputer. A microcomputer system is composed of both hardware and software. Hardware refers to the physical components of the microcomputer system, while software refers to the programs that tell the hardware how to perform a task. An Overview of Hardware and Software Hardware consists of such items as the system unit, peripheral devices, internal memory, and the CPU. The system unit itself is the case that holds the main circuit boards, storage devices, and peripheral devices. A peripheral device is attached to the system unit and is designed to extend the capabilities of the computer system. A peripheral device also gives the user a means by which to communicate with the computer. The three categories of peripheral devices are input, output, and auxiliary storage. O-1 An Introduction to Programming with C++, Third Edition Overview An input device allows the user to communicate with the computer by entering data into it. Examples of an input device include a keyboard, mouse, and scanner. An output device allows the computer to communicate with the user by displaying or printing information. Examples of output devices include a monitor and printer. An auxiliary storage device allows you to store information permanently. Examples of an auxiliary storage device include a floppy disk and hard disk. Internal memory is an ordered sequence of memory cells contained on chips (integrated circuits residing on silicon). The two basic types of internal memory are RAM and ROM. RAM (Random Access Memory) can read from and write to memory cells while the computer has power, and is volatile (must have power to retain contents). ROM (Read-Only Memory) can only read from memory cells while the computer has power, and is non-volatile (does not require power to retain contents). The CPU (Central Processing Unit) functions as the brain of the computer and is composed of the ALU and control unit. The ALU (Arithmetic Logic Unit) performs the arithmetic calculations and logic operations for the computer. The control unit directs the flow of information from one part of the computer to another. It is also responsible for making sure that the computer correctly processes the program instructions and data is stored in memory. The two main categories of software are systems software and applications software. Systems software manages the computer and its peripheral devices. Examples of systems software include the operating system (e.g. Windows, DOS, Unix), device drivers, utilities, and programming languages. Applications software allows the user to take a task that would otherwise be performed manually and carry out the same task with a computer. Examples of applications software include word processors, spreadsheets, databases, entertainment software (computer games), and educational software. Quick Quiz 1. __________ refers to the physical components of the microcomputer system. Answer: Hardware 2. A(n) __________ device is a device attached to the system unit, and extends the capabilities of the computer system. Answer: peripheral 3. Floppy disk drives, hard disk drives, and CD-ROM drives are examples of __________ __________ devices. Answer: auxiliary storage 4. RAM stands for __________ __________ __________. Answer: random access memory 5. The two main categories of software are __________ software and __________ software. Answer: systems, applications A Brief History of Programming Languages It is important to understand the relationship between three terms in programming: programs, programmers, and programming. The directions that humans give to computers are called programs. The people who create these directions are called programmers. And finally, the set of directions (programs) that programmers write are written in a programming language. There are many different types of programming languages. This text will discuss machine languages, assembly languages, high-level procedure-oriented languages, and high-level objectoriented languages. O-2 An Introduction to Programming with C++, Third Edition Overview Machine language is a language that uses bits/bytes to form instructions to communicate with a computer. Each computer has its own instruction set (set of instructions it understands). Machine language uses binary, which is a number system using 1’s and 0’s to represent data (base two). Each digit in binary is commonly called a bit (binary digit) and eight bits form a byte. Each character entered into the computer will be represented by a unique code consisting of 1’s and 0’s. ASCII (American Standard Code for Information Interchange) is a popular data representation code using bits to represent numbers, letters, and symbols. (See the appendix for an ASCII character table). Because of all the 1’s and 0’s, programming in machine language is very tedious and prone to committing errors. Assembly language is a language using mnemonics in place of 1’s and 0’s. Mnemonics are symbols used to represent the actual machine language instructions. Since the only instructions that the computer understands are machine language instructions, an assembler is required to convert the assembly language code to machine code before being executed by the computer. Note that each assembly language instruction is translated into one machine language instruction. It is easy to see that programming in assembly language is preferred to programming in machine language; however programming in assembly language can also be very tedious. High-level procedure-oriented languages allow the programmer to use instructions that more closely resemble the English language. Still the only instructions that the computer can understand are machine language instructions, therefore a compiler is required to convert the high-level code to machine code before being executed by the computer. Unlike assembly language, each high-level language instruction may produce many machine code instructions. The emphasis of high-level procedure-oriented languages is on accomplishing a task. The programmer determines and controls the order in which the computer will process the instructions. The order of execution of these instructions is extremely important and should be well designed. A design methodology called top-down design is typically used with procedure-oriented programs. Top-down design begins with a general statement describing the purpose of the program. This purpose is then broken down into smaller, more manageable tasks, and eventually into the actual high-level procedure-oriented language instructions. Some popular procedure-oriented languages include COBOL, BASIC, Pascal, and C. High-level procedure-oriented languages make a vast improvement over machine and assembly languages. High-level object-oriented languages view a problem solution as a set of interacting objects, where high-level procedure-oriented languages view the problem solution as a set of ordered steps. Like procedure-oriented languages, object-oriented languages require a compiler to convert the high-level instructions into machine code, and each high-level object-oriented language instruction may produce many machine language code instructions. Unlike procedure-oriented languages, with object-oriented languages a design methodology called OOD (ObjectOriented Design) is used. OOD, like top-down design, begins with a statement describing the purpose of the program; however unlike top-down design the programmer then divides the program into one or more objects. Objects in an object-oriented program may take on many forms, examples being menus, options buttons, and command buttons. Objects may also take on real-life meanings, such as an employee, date, and a time card. Some popular object-oriented languages include Visual Basic and C++. One main advantage of object-oriented languages over procedure-oriented languages includes allowing a programmer to use familiar objects to solve a problem. Then because these objects are viewed as independent units, they may be used in more than one application with little or no modification. O-3 An Introduction to Programming with C++, Third Edition Overview Quick Quiz 1. __________ write computer programs. Answer: Programmers 2. C++, Java, Visual Basic, and COBOL are examples of __________ __________. Answer: programming languages 3. Microcomputers typically use a coding scheme called ___________ for character representation. Answer: ASCII 4. A(n) __________ is used to convert assembly language instructions to machine language. Answer: assembler 5. A(n) __________ is used to convert high-level language instructions to machine language. Answer: compiler Discussion Topics/Classroom Activities Discuss with the class which operating systems and application software are available in your labs on your campus. Also discuss why they were chosen. Discuss with the class which programming languages are taught in your curriculum and why they were chosen. Show students examples of code from various programming languages and discuss with them the advantages and disadvantages of each. If students have taken classes utilizing some of these languages make sure to let them share their experiences. Have students write their first and last name in ASCII code. Discuss with them (even though it is apparent) why we do not continue to program in machine language. Projects to Assign Review questions at the end of the Overview Exercise #2 to better understand their own computer system Exercise #4 to show they understand the difference between the two types of language designs Exercise #7 to begin to lay a foundation for later assignments O-4 An Introduction to Programming with C++, Third Edition Overview Key Terms ALU (Arithmetic Logic Unit) - performs the arithmetic calculations and logic operations for the computer. Applications Software - acts as an interface between the user and the systems software, and allows the user to perform specific tasks. ASCII (American Standard Code for Information Interchange) - 7 bit code used for representing characters. Assembler - used to convert Assembly Language instructions to Machine Language. Assembly Language - a language using mnemonics in place of 1's and 0's, as with Machine Language. Auxiliary Storage Device - allow you to store information permanently (examples include a floppy disk and a hard disk). Compiler - a software program that coverts High-Level Procedure-Oriented and Object-Oriented program instructions into Machine Language. Control Unit - directs the flow of information from one part of the computer to another, and is responsible for making sure that the computer correctly processes the program instructions stored in memory. CPU (Central Processing Unit) - functions as the brains of the computer and is composed of the ALU and Control Unit. High-Level Procedure-Oriented Language - allows the programmer to use instructions that more closely resemble the English language. Input Device - allow the user to communicate with the computer by entering data into it (examples include a keyboard, mouse, and scanner). Internal Memory - ordered sequence of memory cells contained on chips. Machine Language - a language that uses bits/bytes to form instructions to communicate with a computer system. Mnemonics - symbols used to represent actual Machine Language instructions. Non-Volatile - retains contents with loss of power (opposite of volatile). Object-Oriented Language - a language that views a problem solution as a set of interacting objects. Operating System - a collection of software program that is the link between the computer and the user (examples include Windows, DOS, OS/2, and UNIX). Output Device - allows the computer to communicate with the user by displaying or printing information (examples include a monitor and a printer). Peripheral Devices - attached to the system unit, designed to extend the capabilities of the computer system, and gives the user a means to communicate with the computer RAM - (Random Access Memory) - can read from or write to memory cells while the computer has power, and is volatile. O-5 An Introduction to Programming with C++, Third Edition Overview ROM - (Read-Only Memory) - can read from memory cells while the computer has power, and is nonvolatile. System Unit - case that holds the main circuit boards, storage devices, and peripheral devices. O-6