1 / 48

Chapter 1: Introduction

Chapter 1: Introduction. Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA 99258 chen@gonzaga.edu. Problem. C++ Solution. O-O (UML). C++ Features. Problem. C++ Solution. 1.2 Computer Hardware.

eliot
Download Presentation

Chapter 1: Introduction

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 1: Introduction Jason C. H. Chen, Ph.D. Professor of MIS School of Business Administration Gonzaga University Spokane, WA 99258 chen@gonzaga.edu

  2. Problem C++ Solution

  3. O-O (UML) C++ Features Problem C++ Solution

  4. 1.2 Computer Hardware • 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

  5. Computer Hardware • Input devices • Allows people to supply information to computers • Output devices • Allows people to receive information from computers • Network connection • Modems / Ethernet interface

  6. Computer Components

  7. Processing Input Devices CPU • Major components of a computer • CPU or Central Processing Unit • Primary (internal) memory • Secondary (external memory) • Control Unit • Arithmetic Logic Unit • Input devices • Output devices Control Unit Arithmetic-Logic Unit Output Devices Main Memory External Memory Network

  8. Central Processing Unit HARD DISK CPU Bus CD-ROM FLOPPY MEMORY RAM DISK Ethernet Random Access Memory Computer Components

  9. CPU • “Brains” of the computer • Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU • Control unit decodes and executes instructions • Arithmetic operations are performed using binary number system • Fundamental building block is a switch • Switches are made from ultrasmall transistors • Examples • The Pentium ® processor contains about three million transistors • The Pentium Pro ® has about 5.5 million transistors

  10. Main Memory • Address • Contents • Logical Address age -27.2 0 sum • 354 1 • .005 75.62 1024

  11. Main Memory • Stores • programs • data • results • Types • RAM • ROM • Address • Contents -27.2 0 • 354 1 • .005 75.62 1024

  12. Secondary Memory & Storage • Semi permanent data-storage capability • Tape or Disk (Sequential vs. Direct) • Hard disk • CD ROM • Secondary memory has much more storage capacity

  13. Computer Networks • LAN - Local area network • Organizational • MAN - Metropolitan area network • WAN - Wide area network • Internet • WWW

  14. 1.3 Computer Software • Application software • Programs designed to perform specific tasks that are transparent to the user • System software • Programs that support the execution and development of other programs • Two major types • Operating systems • Translation systems (compilers)

  15. Application Software • Application software is the software that has made using computers indispensable and popular • Common application software • Word processors • Desktop publishing programs • Spreadsheets • Presentation managers • Drawing programs

  16. Operating System • Controls and manages the computing resources • 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 • Examples • MSDOS ®, Windows ®, Unix ®

  17. Programming Languages • 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 • High - Level Languages • Resemble human language (C++, C, Pascal) • cost = price + tax; 1. Machine Language 2. Assembly Language 3. Procedure-Oriented Language (3GL) 4. Non-Procedure Language (4GL)

  18. Programming Languages • Language Standard • Syntax (grammatical form) (rules) • Portable • programs used without modification • Source Program (e.g., *.cpp) • Object Program (*.obj) • Executable Program (*.exe)

  19. Object Oriented Programming • OOP derived from C • Bjarne Stroustrup • Popular because of reuse • Classes • Objects • Organized in a Hierarchy • Super Classes • Sub Classes

  20. OO Programming and Structured Programming • Object-oriented design and programming supports good software engineering • Object-oriented design promotes thinking about software in a way that models the real world • Algorithms are the basis for the procedural sections (Structured Programs) • Highly structured • Top-down design • Step-wise refinement

  21. Object Oriented Design • Abstraction • Extract the relevant properties of an object while ignoring inessential details • Encapsulation (Information Hiding) • 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

  22. Object Oriented Design • Modularity - (Divide and Conquer) • Dividing an object into smaller pieces or modules such that the object is easier to understand and manipulate • Hierarchy • Ranking or ordering of objects based on some relationship between them

  23. Abstraction • Process of extracting only the relevant properties of an object • Extracted properties define a view of the object Abstraction is the process of temporarily ignoring underlying details so we can focus on the most important features (or big picture) of the large problem at hand.

  24. Abstraction • Car dealer views a car from selling features standpoint • Price, warranty, color, etc. • Mechanic views a car from systems maintenance standpoint • Oil, oil filter, spark plugs, etc.

  25. 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 • By hiding the information its representation and content can be changed without affecting other parts of the system • Example - car radio • Controlled by switches and knobs • The details of how it works is hidden

  26. Modularity (Divide and Conquer) • Dividing an object so that the object holds useful information and it is easier to understand • Most complex systems are modular • Cooling System • Ignition System • Fuel System

  27. Ranking or ordering of objects based on some relationship between them Hierarchies facilitate understanding complex organizations and systems Example - a company hierarchy helps employees understand the structure of their company and their positions Hierarchy

  28. OO Classes • Later we will use data abstractions • C++ language • Will apply OO techniques • Structured Programming • Object Oriented Programming • Model our own objects or abstractions

  29. Object-Oriented Programming Table 1.4 (p.17) Class vs. Object

  30. 1.4 Processing a High-Level Language Program • Set of programs used to develop software • A key component of a is a translator • Types of translators • Compiler • Linker • Examples • g++, Borland C++ ®, Microsoft Visual C++ ®

  31. Processing a Program • Editor used to enter the program • Source program (file.cpp) • UNIX vi text editor • Compiler translates the source program • Displays syntax errors (not descriptive) • Linker/Loader to combine object file with other object files • Executable program

  32. Processing a Program • Major activities • Editing • Compiling • Linking with pre-compiled files • Object files • Library modules • Loading and executing • Viewing the behavior of the program

  33. C++ Sources Object/ Binary Code #include ".. void fn() { ... ... } // end main() #include ".. class Bank { ... ... }; Executable Program Linker C++ Compiler #include ".. int main() { ... ... } // end main() C++ Libraries Error list Component Libraries Process Cycle *.obj *.exe #include <…> *.cpp

  34. C++ Sources Object/ Binary Code #include ".. void fn() { ... ... } // end main() #include ".. class Bank { ... ... }; Executable Program Linker C++ Compiler #include ".. int main() { ... ... } // end main() C++ Libraries Error list Component Libraries Process Cycle *.obj *.exe #include <…> *.cpp

  35. 1.5 Software Development Method • Problem Analysis - (Correct Problem) • Identify data objects • Goal to model properties • Determine Input / Output data • Constraints on the problem • Design • Decompose into smaller problems • Top-down design (divide and conquer) • Develop Algorithm (Desk check)

  36. Software Development Method • Implementation • Writing the algorithm (coding) • Testing • Verify the program meets requirements • System and Unit test • Documentation • Key part in the development process • Conversion

  37. Software Engineering Goals • Reliability • An unreliable life-critical system can be fatal • Understandability • Future development becomes very difficult if software is hard to understand • Cost Effectiveness • Cost to develop and maintain should not exceed profit • Adaptability • System that is adaptive is easier to alter and expand • Reusability • Improves reliability and maintainability, and reduces development costs

  38. 1.6 Applying the Software Development Method • Case Study: Converting Miles to Kilometers (p. 26) • Problem  Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion.

  39. Applying the Software Development Method • Analysis  The first step in solving this problem is to determine what you are asked to do. You must convert from one system of measurement to another, but are you supposed to convert from kilometers to miles, or vice versa? The problem states that you prefer to deal in metric measurements, so you must convert distance measurements in miles to kilometers.

  40. Applying the Software Development Method • Design  The next step is to formulate the algorithm that solves the problem. Begin by listing the three major steps, or sub problems, of the algorithm. • Implementation  To implement the solution, you must write the algorithm as a C++ program. • Testing  How do you know the sample run is correct?

  41. // miles.cpp // Converts distance in miles to kilometers. #include <iostream> // class for stream input/output using namespace std; // use the standard namespace int main() // start of main function { const float KM_PER_MILE= 1.609; // 1.609 km in a mile float miles, // input: distance in miles kms; // output: distance in kilometers // Get the distance in miles. cout << "Enter the distance in miles: "; cin >> miles; // Convert the distance to kilometers. kms = KM_PER_MILE* miles; // Display the distance in kilometers. cout << "The distance in kilometers is " << kms << endl; return 0; } //Note that C++ program iscase-sensitive

  42. A new folder of “Debug” containing: • *.obj • *.exe • *.pdb • *.ilk • *.pch • *.idb What files are created after the program are successfully executed? • *.dsp *.dsw • *.ncb *.opt • *.htm (web resource) Double click on delvc++

  43. Contents in delvc++.bat: del *.dsp del *.dsw del *.ncb del *.opt del *.plg del *.htm rem *** cd debug del *.obj del *.bak del *.ilk del *.pch del *.pdb del *.idb

  44. Miles_for_exe.cpp • What is difference? • What is the purpose?

  45. Problem C++ Solution

  46. O-O (UML) C++ Features Problem C++ Solution

  47. 1.7 Professional Ethics for Computer Programmers • Privacy and Misuse of Data • Computer Hacking • Plagiarism and Software Piracy • Misuse of a Computer Resource

  48. Your Responsibilities … • It is your responsibilities (and for your benefit) to do the exercises in each chapter to gain deep understanding about the topics in addition to required assignments. (there are answers to Odd numbered exercises at the end of the text).

More Related