Download presentation
Presentation is loading. Please wait.
Published byOsborne Hancock Modified over 9 years ago
1
COS120 Software Development Using C++ AUBG Fall semester 2010 Ref book: Problem Solving, Abstraction and Design Using C++ Authors: Frank Friedman, Elliot Koffman, http://www.aw.com/cssupport Course lecturer: Assoc. Prof. Stoyan Bonev, PhD
2
Lecture 1: Introduction to Computers, Problem Solving and Programming
3
3 Lecture Contents: t Computers t Computer Hardware; t Computer Software; t Computer Program; t Numeric Systems; t Software Development Method; t Algorithms (Definition, Examples, Classification).
4
4 t Computer - “A device for counting or computing” t Dr. John Atanasoff - 1st computer t ENIAC 1946 at U of Penn t Dr. John Von Neumann - Princeton –Stored program concept –Memory rather than wires and switches t Computing History 1.1 Overview of Computers
5
5 t Von Neumann architecture basis for today's computers t VLSI Technology made computers affordable, small and available to the public t How programming has changed over time Overview of Computers
6
6 Categories of computers – based on size & performance t Microcomputers or Personal Computers –Pocket PCs (Windows Mobile Classic, Windows Mobile Professional) –Laptops –Notebooks –Palmtops –Desktops –Workstations t Minicomputers t Mainframes t Supercomputers
7
7 Computer = Hardware + Software t Hardware – computer equipment, electronic components like IC, transistors, capacitors, resistors; t Software – the set of programs associated with a computer; t Program – a list of instructions that enables a computer to perform a specific task; t Binary number – number whose digits are only 0s and 1s; Bit – BI nary digi T :0or1; t Byte – 8 bits. Amount of storage to store a single character.
8
8 t Every computer is organized roughly into six parts –CPU - central processing unit Where decisions are made, computations are performed, and input/output requests are delegated –Main Memory Stores information being processed by the CPU –Secondary Memory Stores data and programs 1.2 Computer Hardware
9
9 –Input devices Allows people to supply information to computers –Output devices Allows people to receive information from computers –Network connection Modems / Ethernet interface Computer Hardware
10
10 Computer Components
11
11 Main Memory -27.2 l 354 l.005 75.62 l Address l Contents 0 1023 1
12
12
13
13 Main Memory t Stores –programs –data, input data to be processed –data, results or output data –data, intermediate values t Types –RAM –ROM
14
14 Secondary Memory & Storage t Semi permanent data-storage capability –Magnetic Hard disk Floppy disk Tape –Non-magnetic CD-ROM memory stick, flash t Secondary memory has much more storage capacity
15
15 Memory (storage) dimensions 1KB= 1024 bytes= = 2 10 bytes 1MB= 1024 KB = 1024 x 1024 bytes = = 2 20 bytes 1GB= 1024 MB = 1024 x 1024 KB = 1024 x 1024 x 1024 bytes = = 2 30 bytes 1TB= 1024 GB = 1024 x 1024 MB = 1024 x 1024 x 1024 KB = 1024 x 1024 x 1024 x 1024 bytes = 2 40 bytes
16
16 Java Programming: From Problem Analysis to Program Design, 4e Memory (storage) dimensions
17
17 CPU t “Brain” of the computer –Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU –Control Unit decodes and executes instructions t Arithmetic operations are performed using binary number system or binary numeric system
18
18 CPU t Fundamental building block is a switch –Switches are made from ultrasmall transistors t Modern processors contain –about more than 7-8 million transistors
19
19 Input / Output Devices t Accessories that allow computer to perform specific tasks –Receiving information for processing –Return the results of processing –Store information t Common input and output devices –PrinterJoystickCD-ROM –KeyboardMonitorMouse
20
20 Computers t Used as a single device (stand-alone processing). Computer used only by one person is a computer. t Used in a network (distributed processing). Computer that provides resources such as files, printers or Internet access to other computers is a server.
21
21 Computer Networks Computers are linked together in networks so they can communicate with one another. Network categories (classification): t LAN - Local Area Network t WAN - Wide Area Network
22
22 Computer Networks - LAN t LAN - Local Area Network –Computer and other devices in a building are connected via cables, allowing them to share information and resources such as printers, scanners, HDD
23
23 Computer Networks - WAN WAN - Wide Area Network –A network that links many individual computers and LANs over a large geographic area –Internet is the most well known WAN, a network of university, corporate, government and public- access networks –The most widely used aspect of the Internet is the WWW, the universe of Internet accessible resources, that are navigable through the use of GUI (Graphic User Interface).
24
24 What is Internet t Internet is the connection of many thousands of networks around the world. t Each network consists of one or more computers and one or more routers. t Router is a device or a computer that is connected to two or more networks. It allows computers on one network to send and receive information to computers on another network. t All computers and routers on the Internet use a standard communications language called TCP/IP (Transmission Control Protocol/Internet Protocol)
25
25 World Wide Web t Introduced 1989 t Developed by CERN –European Laboratory for Particle Physics t Web browser –IE (Internet Explorer)
26
26 What is World Wide Web t WWW is a vast collection of info stored on servers throughout the Internet known as Web servers. t Internet users use a program known as Web browser or Web client to access info from a Web server. t Web servers and Web browsers communicate with each other using a protocol HTTP (Hyper Text Transfer Protocol). t Introduced 1989, Developed by CERN –European Laboratory for Particle Physics t Web browser IE (Internet Explorer)
27
27 How WWW differs from the Internet t The Internet is being used to access documents on the World Wide Web. t The best way to understand this distinction is to think of the Internet as analogous to telephone network. Over telephone lines we can call each other to talk, dial up to a computer over a modem, or send a fax. t Likewise, over the Internet, we might send email, access a Web page, chat using an instant messenger program, or download a file. t Though we might most often use the Web, just as a phone is most often used for talking to people.
28
28 Helpful search Engines t www.google.com t www.accoona.eu t www.wikipedia.org t www.answers.com
29
29 1.3 Computer Software t Operating System t Booting a computer t Application t Machine language, Assembly language, HLL t Source file, Object file t Syntax of a programming language t Compiler, Linker, Loader t IDE, Software packages
30
30 t Application software –Programs designed to perform specific tasks that are transparent to the user t System software –Programs that support the execution and development of other programs –Two major categories Operating systems Translation systems 1.3 Computer Software
31
31 Application Software t Application software is the software that has made using computers indispensable and popular t Common application software –Word processors –Desktop publishing programs –Spreadsheets –Presentation managers –Drawing programs
32
32 t Controls and manages the computing resources t Important services that an operating system provides –File system –Commands that allow for manipulation of the file system –Ability to perform input and output on a variety of devices –Management of the running systems t Examples –MSDOS ®, Windows ®, Unix ®, Linux ® Operating System
33
33 Programming Languages t Machine Language –“Native tongue” of the computer –Binary 0s and 1s that specify what to do 0010 0000 0000 0100 1000 0000 0000 0101 0011 0000 0000 0110 t High - Level Languages –Resemble human language (C++, C, C#, VB) cost = price + tax;
34
34 Programming Languages t Language Standard –Syntax (grammatical form) (rules) –Portable programs used without modification t Source Program t Object Program t Executable Program
35
35 Object Oriented Programming (read alone or skip slides 35-47) t OOP derived from C t Bjarne Stroustrup t Popular because of reuse –Classes –Objects t Organized in a Hierarchy –Super Classes –Sub Classes
36
36 OO Programming and Structured Programming t Object-oriented design and programming supports good software engineering t Object-oriented design promotes thinking about software in a way that models the real world
37
37 OO Programming and Structured Programming t Algorithms are the basis for the procedural sections (Structured Programs) –Highly structured –Top-down design –Step-wise refinement
38
38 Object Oriented Design t Abstraction –Extract the relevant properties of an object while ignoring inessential details t Encapsulation –Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner
39
39 Object Oriented Design t Modularity –Dividing an object into smaller pieces or modules such that the object is easier to understand and manipulate t Hierarchy –Ranking or ordering of objects based on some relationship between them
40
40 t Process of extracting only the relevant properties of an object t Extracted properties define a view of the object Abstraction
41
41 t Car dealer views a car from selling features standpoint –Price, warranty, color, etc. t Mechanic views a car from systems maintenance standpoint –Oil, oil filter, spark plugs, etc. Abstraction
42
42 Encapsulation t Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner t By hiding the information its representation and content can be changed without affecting other parts of the system
43
43 Encapsulation t Example - car radio –Controlled by switches and knobs –The details of how it works are hidden
44
44 Modularity t Dividing an object so that the object holds useful information and it is easier to understand t Most complex systems are modular –Cooling System –Ignition System –Fuel System
45
45 Modularity t Example - Automobile can be decomposed into subsystems –Cooling system Radiator Thermostat Water pump –Ignition system Battery Starter Spark plugs
46
46 Hierarchy t Ranking or ordering of objects based on some relationship between them t Hierarchies facilitate understanding complex organizations and systems –Example - a company hierarchy helps employees understand the structure of their company and their positions
47
47 OO Classes t Later we will use data abstractions –C++ language t Will apply OO techniques –Structured Programming –Object Oriented Programming t Model our own objects or abstractions
48
48 1.4 Processing a High-Level Language Program t Set of programs used to develop software t A key component is a translator t Types of translators –Compiler –Linker t Examples –g++, Borland C++ ®, Microsoft Visual C++ ®
49
49 Processing a Program t Editor used to enter the program –Source program (file.cpp) –UNIX vi text editor t Compiler translates the source program –Displays syntax errors (not descriptive) t Linker/Loader to combine object file with other object files –Executable program
50
50 Processing a Program t Major activities –Editing –Compiling –Linking with pre-compiled files Object files Library modules –Loading and executing –Viewing the behavior of the program
51
51 Process Cycle
52
52 Software Development Method – Software Life Cycle – Program Development Cycle Many programmers plan their programs using a sequence of steps, referred to as SDMorSLCor PDC Following such a step-by-step process enables developers to use their time efficiently and helps them design error-free programs that produce the desired output.
53
53 Software Development Method – Software Life Cycle – Program Development Cycle t Version 1: –Specify the problem requirements; –Analyze the problem; –Design the algorithm to solve the problem; –Implement the algorithm; –Test and verify the completed program; –Maintain and update the program.
54
54 Software Development Method – Software Life Cycle – Program Development Cycle t Version 2: –Systems Analysis; –Systems Design; –Systems Implementation; –Systems Support.
55
55 Software Development Method – Software Life Cycle – Program Development Cycle t Version 3: –Analyze: Define the problem –Design: Plan the solution to the problem –Choose the interface: Select text boxes, buttons, etc –Code: Translate the algorithm into a Prog Lan –Test & Debug: Locate and remove any errors in program –Complete documentation: Organize program description
56
56 1.5 Software Development Method t Problem Analysis - (Correct Problem) –Identify data objects –Goal to model properties –Determine Input / Output data –Constraints on the problem t Design –Decompose into smaller problems –Top-down design (divide and conquer) –Develop Algorithm (Desk check)
57
57 Software Development Method t Implementation –Writing the algorithm t Testing –Verify the program meets requirements –System and Unit test t Documentation –Key part in the development process
58
58 Algorithms t Origin of term. t Basic idea: the solution to any computing problem involves executing a series of actions in a specific order.
59
59 Algorithms definitions Definition1: A procedure for solving a problem in terms of 1. the actions to be executed, and 2. the order in which these actions are to be executed is called an algorithm. Definition2: An algorithm is a list of steps for solving a problem.
60
60 Algorithms definitions Definition 1: A step-by-step problem-solving process in which a solution is arrived at in a finite amount of time Definition 2: A procedure for solving a problem in terms of 1. the actions to be executed, and 2. the order in which these actions are to be executed is called an algorithm. Definition 3: An algorithm is a list of steps for solving a problem.
61
61 Classification of algorithms: Linear or Sequence algorithms; Branch algorithms; Loop algorithms.
62
62 Algorithms description One way to document algorithms is by using flowcharts (control flow diagrams). Typical components to build a flowchart (control flow diagram): Begin; End; Activity (action, processing); Selection (binary condition) (two versions); Program input (specific activity); Program output (specific activity).
63
63 Boxes as flowcharts’ building blocks
64
64
65
65 Software Development Method t Software engineering –Area of computer science concerned with building large software systems t Challenge –Tremendous advances in hardware have not been accompanied by comparable advances in software
66
66 Software Engineering Goals t Reliability –An unreliable life-critical system can be fatal t Understandability –Future development becomes very difficult if software is hard to understand t Cost Effectiveness –Cost to develop and maintain should not exceed profit
67
67 Software Engineering Goals t Adaptability –System that is adaptive is easier to alter and expand t Reusability –Improves reliability and maintainability, and reduces development costs
68
68 1.7 Professional Ethics for Computer Programmers t Privacy and Misuse of Data t Computer Hacking t Plagiarism and Software Piracy t Misuse of a Computer Resource
69
69 Before lecture end Lecture: Introduction to Computing More to read: Friedman/Koffman, Chapter 01 Or Coming approx. 20 slides
70
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers, Problem Solving, and Programming Problem Solving, Abstraction, and Design using C++ 5e by Frank L. Friedman and Elliot B. Koffman
71
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 71 Computer Hardware CPU - central processing unit –Where decisions are made, computations are performed, and input/output requests are delegated Main Memory –Stores information being processed by the CPU Secondary Memory (Mass Storage) –Stores data and programs
72
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 72 Computer Hardware Input devices –Allow people to supply information to computers Output devices –Allow people to receive information from computers Network connection –Modems –Ethernet interface
73
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 73 Figure 1.2 Computer components
74
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 74 Memory Stores –programs operating system applications –data Types –RAM - volatile –ROM Composed of bits, which are combined into bytes
75
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 75 Memory Cells AddressContents -27.2 354 0.005 -26 H X 75.62 RTV 001... 0 1 2 3 4 5 6... 999
76
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 76 Secondary Memory Semi permanent data-storage capability –Magnetic Hard disk Floppy disk Tape –Non-magnetic CD-ROM memory stick, flash Secondary memory usually has much more storage capacity than main memory
77
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 77 CPU “Brains” of the computer –Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU –Control unit decodes and executes instructions –Registers hold information and instructions for CPU to process Arithmetic operations are performed using binary number system
78
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 78 Input / Output Devices Accessories that allow computer to perform specific tasks –Receiving information for processing –Return the results of processing Common input and output devices –Keyboard JoystickScanner –Printer MonitorSpeaker
79
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 79 Computer Networks Allows multiple computers to connect together to share resources and/or data LAN - Local area network –Organizational WAN - Wide area network –Internet Requires additional hardware –modem –network interface
80
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 80 1.3 Computer Software Operating system Other system software –utilities –programming language systems Applications
81
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 81 Operating System E.g. Windows ®, Unix ® Controls –the interaction of system with the user –hardware interactions Part is usually stored on ROM, rest on hard drive –This arrangement requires booting the system
82
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 82 Some OS Responsibilities Communicating with the user; receiving user commands Managing allocation of memory, processor time, file system, and other resources Collecting input from keyboard, mouse, etc. Conveying output to screen, printer, etc. Writing data to secondary storage devices
83
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 83 Application Software Does the “real” work Common application software –Word processors –Desktop publishing programs –Spreadsheets –Presentation managers –Drawing programs
84
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 84 Programming Languages Machine Language –Most fundamental language of the computer –Unique for each processor type –Binary 0s and 1s that specify what to do 0010 0000 0000 0100 1000 0000 0000 0101 0011 0000 0000 0110
85
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 85 Table 1.2 A Program in Machine and Assembly Language
86
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 86 High - Level Languages Resemble human language –C++, C, Pascal, FORTRAN, Ada a = a + b; More compact and human understandable than machine language Must be translated into machine language
87
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 87 Object Oriented Programming C++ derived from C by Bjarne Stroustrup Popular because of reuse –Classes –Objects –Methods Organized in a Hierarchy –Super Classes –Sub Classes
88
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 88
89
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 89 Object Oriented Design Abstraction –Extract the relevant properties of an object while ignoring inessential details Encapsulation –Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner
90
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 90 1.4 Processing a High-Level Language Program Set of programs used to develop software A key component is a translator –Compiler Examples –g++, Borland C++ ®, Microsoft Visual C++ ® Other programs needed –Editor –Linker –Loader
91
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 91 Processing a Program Editor used to enter the program –Like minimal word processor –Creates source program file Compiler translates the source program –Displays syntax errors –Creates (usually) temporary object code file Linker/Loader to combine object file with other object files and execute program –Creates final executable program
92
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley 92 Executing a Program CPU –examines each program instruction in memory –sends out command signals required to carry out the instruction Special instructions used to –input data into memory for the program to use –output data to display or printer (or other device)
93
93 Thank You For Your Attention!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.