Title: Lecture 1 Hardware, Software and Control Structures
1Lecture 1Hardware, Softwareand Control
Structures
- ENGR17 Engineering Programming
- Section 1
- Fall 2001
8/30/01
2Outline
- History of PC
- Components of PC
- History of Programming Languages
- Object-oriented languages
- Control Structures
3Microcomputer Systems
- First appeared in marketplace in the mid 70s
(Altair) - Also called personal computers
- Composed of hardware and software
- Hardware
- Physical components of the system
- Software
- Programs (step-by-step instructions) that tell
the hardware how to perform a task - Apple had first broadly successful personal
computer - Based on proprietary hardware and software
- IBM followed with the AT in early 80s
- Operation System Microsoft DOS
- Microprocessor Intel 8088
4Microcomputer Systems
5Hardware and Software
- Hardware
- System unit
- Internal memory (RAM and ROM)
- Central processing unit (CPU)
- Input devices
- Output devices
- Peripheral devices
- Software
- Operating system software
- Application software
6System Unit
7System Unit Internal Memory
8RAM and ROM
- Random-Access Memory (RAM) chips
- User can read and write to memory
- Volatile
- Read-Only Memory (ROM) chips
- User can only read from memory
- Nonvolatile
9Main Memory (RAM)
SIMM (Single In-line Memory Modules) most PCs
DIMM (Dual In-line Memory Modules) higher end
Laptop Memory usually proprietary
10CPU/Microprocessor
- Brain of the computer
- CPU resides on a microprocessor chip
- CPU contains two components
- Control unit
- Makes sure the computer correctly processes
program instructions and data stored in internal
memory - Arithmetic/Logic Unit (ALU)
- Performs arithmetic calculations and logic
operations - Microprocessors
- Intel 32-bit 2GHz Pentium 4 (desktop) Xeon
(servers) - Intel 64-bit Itanium Family (servers)
- Sun Microsystems SPARC
- Hewlett Packard PA-RISC
- IBM PowerPC
- DEC Alpha
11Intel Pentium 4
12Operating System Software
- Manages computer and its peripheral devices
- Allows communication between user and computer
- Examples
- Windows 98, NT, ME, 2000, CE, XP (hits shelves in
October) - UNIX
- Linux
- DOS (obsolete)
- OS/2 (obsolete)
- For personal computers
- Windows 98, 2000, or XP
- For workstations, servers, and other big-iron
- Windows NT or 2000
- UNIX (HPUX, Berkeley, etc.)
- Linux (Red Hat, etc.)
13Application Software
- Word processors
- Spreadsheets
- Databases
- Graphics programs
- Programming languages
14History of Programming Languages
- Machine languages
- Assembly languages
- High-level procedure-oriented languages
- Object-oriented languages
15Machine Languages
- Are based on the binary number system
- Use combination of 0s and 1s to communicate
directly with the computer - Are tedious and error-prone require highly
trained programmers - Machine Language Example
16Machine Languages
17Assembly Languages
- Allow programmers to use mnemonics in place of 0s
and 1s in the program - Require an assembler (a program to convert
assembly instructions into machine code) - Are easier to write than machine language, but
still tedious and require highly trained
programmers - Assembly Language Example
18Assembly Languages
19High-Level Procedure Languages
- Allow programmers to use instructions that more
closely resemble English - View a problem solution as a set of ordered steps
(correct sequence is critical) - Use top-down design approach
- Require a compiler to translate the program into
machine language - Do not require a great amount of technical
expertise to write simple programs - Examples COBOL, BASIC, Pascal, C
- Procedure language example
20High-Level Procedure Languages
21Object-Oriented Languages
- View a problem solution as a set of interacting
objects - Use object-oriented design methodology
- Require a compiler to translate high-level
instructions into machine code - Examples
- C
- Visual Basic
- Object-Oriented Language Example
22Object-Oriented Languages
23Advantages of OO Languages
- Allow programmer to use familiar objects to solve
problems - Because each object is viewed as an independent
unit, an object can be used in more than one
application, with little or no modification
24OOP Terminology
- OOP
- OOD
- Object
- Attributes (data) and behaviors
- Class
- Instance
- Encapsulation
- Abstraction
- Hidden/exposed
- Inheritance (derived class and base class)
25Illustration of OOP Terms
26Control Structures
- Control the flow of a programs logic
- Also called logic structures
- Three basic structures
- Sequence
- Selection
- Repetition
27Sequence Structure
- Directs the computer to process the instructions,
one after another, in the order listed in the
program - Are found in every program
- Algorithm
- Step-by-step instructions to solve a problem
- Sequence Example
28Sequence Structure
29Repetition Structure
- Directs the computer to repeat one or more
instructions until some condition is met - Repetition Example
30Repetition Structure
31Repetition Structure
32Selection Structure
- Directs the computer to make a decision, and then
select an appropriate action based on that
decision - Also called the decision structure
- Selection Example
33Selection Structure
34Selection Structure
35Summary
- Components of a microcomputer system
- Relationship between hardware and software
- History of programming languages
- Object-oriented languages
- Control structures
- Sequence structure
- Repetition structure
- Selection (decision) structure
36Questions
- Microcomputer System is composed of what two
components? - Hardware and Software
- System Unit is composed of what two components?
- Memory and CPU
- Two types of Memory?
- Random Access Memory Read Only Memory
- CPU is composed of what two components?
- Control Unit Arithmetic/Logic Unit
- Which microprocessor did your instructor help
design? - Itanium
- Three examples of an operating system?
- Windows, UNIX, Linux
37Questions
- 4 types of programming languages?
- Machine, Assembly, High-Level Procedural,
Object-Oriented - Advantages of High Level languages?
- Closer to English
- Ordered steps
- Top-down design
- Advantages of object-oriented?
- Code reuse
- Easier to solve some problems
- Three control structures?
- Sequence, Repetition, Selection
- Whats your favorite control structure and why?
- Selection
38Questions
- Write an algorithm using all three control
structures to instruct someone to - Walk to the light switch
- Turn the all the switches on if any are off
otherwise turn the 1st switch off - Return to their chair