Download presentation
Presentation is loading. Please wait.
Published byNathaniel Barrett Modified over 8 years ago
1
611 18200 計算機程式語言 Lecture 01-1 國立台灣大學生物機電系 林達德 1 1 Introduction to Computers, the Internet and World Wide Web
2
611 18200 計算機程式語言 Lecture 01-2 國立台灣大學生物機電系 林達德 1.1 Introduction 1.2 What Is a Computer? 1.3 Computer Organization 1.4 Early Operating Systems 1.5 Personal, Distributed and Client/Server Computing 1.6 The Internet and the World Wide Web 1.7 Machine Languages, Assembly Languages and High-Level Languages 1.8 History of C and C++ 1.9 C++ Standard Library 1.10 History of Java 1.11 FORTRAN, COBOL, Pascal and Ada 1.12 Basic, Visual Basic, Visual C++, C# and.NET 1.13 Key Software Trend: Object Technology 1.14 Typical C++ Development Environment 1.15 Notes About C++ and C++ How to Program, 5/e 1.16 Test-Driving a C++ Application 1.17 Software Engineering Case Study: Introduction to Object Technology and the UML (Required) 1.18 Wrap-Up 1.19 Web Resources
3
611 18200 計算機程式語言 Lecture 01-3 國立台灣大學生物機電系 林達德 OBJECTIVES In this chapter you will learn: Basic hardware and software concepts. Basic object-technology concepts, such as classes, objects, attributes, behaviors, encapsulation and inheritance. The different types of programming languages. Which programming languages are most widely used. A typical C++ program development environment. The history of the industry-standard object-oriented system modeling language, the UML. The history of the Internet and the World Wide Web. To test-drive C++ applications in two popular C++ environments—GNU C++ running on Linux and Microsoft's Visual C++ ®.NET running on Windows ® XP.
4
611 18200 計算機程式語言 Lecture 01-4 國立台灣大學生物機電系 林達德 1.1 Introduction Software –Instructions to command computer to perform actions and make decisions Hardware Standardized version of C++ –United States American National Standards Institute (ANSI) –Worldwide International Organization for Standardization (ISO) Structured programming Object-oriented programming
5
611 18200 計算機程式語言 Lecture 01-5 國立台灣大學生物機電系 林達德 1.2 What is a Computer? Computer –Device capable of performing computations and making logical decisions Computer programs –Sets of instructions that control computer’s processing of data Hardware –Various devices comprising computer Keyboard, screen, mouse, disks, memory, CD-ROM, processing units, … Software –Programs that run on computer
6
611 18200 計算機程式語言 Lecture 01-6 國立台灣大學生物機電系 林達德 1.3 Computer Organization Six logical units of computer 1.Input unit “Receiving” section Obtains information from input devices –Keyboard, mouse, microphone, scanner, networks, … 2.Output unit “Shipping” section Takes information processed by computer Places information on output devices –Screen, printer, networks, … –Information used to control other devices
7
611 18200 計算機程式語言 Lecture 01-7 國立台灣大學生物機電系 林達德 1.3 Computer Organization Six logical units of computer 3.Memory unit Rapid access, relatively low capacity “warehouse” section Retains information from input unit –Immediately available for processing Retains processed information –Until placed on output devices Memory, primary memory 4.Arithmetic and logic unit (ALU) “Manufacturing” section Performs arithmetic calculations and logic decisions
8
611 18200 計算機程式語言 Lecture 01-8 國立台灣大學生物機電系 林達德 1.3 Computer Organization Six logical units of computer 5.Central processing unit (CPU) “Administrative” section Supervises and coordinates other sections of computer 6.Secondary storage unit Long-term, high-capacity “warehouse” section Storage –Inactive programs or data Secondary storage devices –Disks Longer to access than primary memory Less expensive per unit than primary memory
9
611 18200 計算機程式語言 Lecture 01-9 國立台灣大學生物機電系 林達德 1.4 Early Operating Systems Early computers –Single-user batch processing Only one job or task at a time Process data in groups (batches) Decks of punched cards Operating systems –Software systems –Manage transitions between jobs –Increased throughput Amount of work computers process ENIAC, a machine built by John Mauchly and J. Presper Eckert that improved by 1,000 times on the speed of its contemporaries. Start of project 1943 Completed: 1946 Programmed plug board and switches Speed 5,000 operations per second.
10
611 18200 計算機程式語言 Lecture 01-10 國立台灣大學生物機電系 林達德 1.4 Early Operating Systems Multiprogramming –Many jobs or tasks sharing computer’s resources –“Simultaneous” operation of many jobs Timesharing –1960s –Special case of multiprogramming –Users access computer through terminals Devices with keyboards and screens Dozens, even hundreds of users –Perform small portion of one user’s job, then moves on to service next user –Advantage: User receives almost immediate responses to requests
11
611 18200 計算機程式語言 Lecture 01-11 國立台灣大學生物機電系 林達德 1.5 Personal, Distributed and Client/Server Computing Personal computers –1977: Apple Computer –Economical enough for individual –1981: IBM Personal Computer –“Standalone” units Computer networks –Over telephone lines –Local area networks (LANs) Distributed computing –Organization’s computing distributed over networks
12
611 18200 計算機程式語言 Lecture 01-12 國立台灣大學生物機電系 林達德 1.5 Personal, Distributed and Client/Server Computing Workstations –Provide enormous capabilities –Information shared across networks Client/server computing –File servers Offer common store of programs and data –Client computers Access file servers across network UNIX, Linux, Microsoft’s Window-based systems
13
611 18200 計算機程式語言 Lecture 01-13 國立台灣大學生物機電系 林達德 1.6 The Internet and the World Wide Web Late 1960s: ARPA –Advanced Research Projects Agency Department of Defense –ARPAnet –Electronic mail (e-mail) Packet switching –Transfer digital data via small packets –Allow multiple users to send/receive data simultaneously over same communication paths No centralized control –If one part of network fails, other parts can still operate
14
611 18200 計算機程式語言 Lecture 01-14 國立台灣大學生物機電系 林達德 1.6 The Internet and the World Wide Web TCP/IP –Transmission Control Protocol (TCP) Messages routed properly Messages arrived intact –Internet Protocol (IP) Communication among variety of networking hardware and software Current architecture of Internet Bandwidth –Carrying capacity of communications lines
15
611 18200 計算機程式語言 Lecture 01-15 國立台灣大學生物機電系 林達德 1.6 The Internet and the World Wide Web World Wide Web –1990: Tim Berners-Lee (CERN) –Locate and view multimedia-based documents –Information instantly and conveniently accessible worldwide –Possible worldwide exposure Individuals and small businesses –Changing way business done
16
611 18200 計算機程式語言 Lecture 01-16 國立台灣大學生物機電系 林達德 1.6 The Internet and the World Wide Web World Wide Web Consortium (W3C) –1994: Tim Berners-Lee –Develop nonproprietary, interoperable technologies –Standardization organization –Three hosts Massachusetts Institute of Technology (MIT) France’s INRIA (Institut National de Recherche en Informatique et Automatique) Keio University of Japan –Over 400 members Primary financing Strategic direction
17
611 18200 計算機程式語言 Lecture 01-17 國立台灣大學生物機電系 林達德 1.6 The Internet and the World Wide Web Recommendations –3 phases Working Draft –Specifies evolving draft Candidate Recommendation –Stable version that industry can begin to implement Proposed Recommendation –Considerably mature Candidate Recommendation
18
611 18200 計算機程式語言 Lecture 01-18 國立台灣大學生物機電系 林達德 1.7 Machine Languages, Assembly Languages and High-level Languages Three types of computer languages 1.Machine language Only language computer directly understands “Natural language” of computer Defined by hardware design –Machine-dependent Generally consist of strings of numbers –Ultimately 0s and 1s Instruct computers to perform elementary operations –One at a time Cumbersome for humans Example: +1300042774 +1400593419 +1200274027
19
611 18200 計算機程式語言 Lecture 01-19 國立台灣大學生物機電系 林達德 1.7 Machine Languages, Assembly Languages and High-level Languages Three types of computer languages 2.Assembly language English-like abbreviations representing elementary computer operations Clearer to humans Incomprehensible to computers –Translator programs (assemblers) Convert to machine language Example: LOADBASEPAY ADD OVERPAY STORE GROSSPAY
20
611 18200 計算機程式語言 Lecture 01-20 國立台灣大學生物機電系 林達德 1.7 Machine Languages, Assembly Languages and High-level Languages Three types of computer languages 3.High-level languages Similar to everyday English, use common mathematical notations Single statements accomplish substantial tasks –Assembly language requires many instructions to accomplish simple tasks Translator programs (compilers) –Convert to machine language Interpreter programs –Directly execute high-level language programs Example: grossPay = basePay + overTimePay
21
611 18200 計算機程式語言 Lecture 01-21 國立台灣大學生物機電系 林達德 1.8 History of C and C++ History of C –Evolved from two other programming languages BCPL and B - Ken Thompson - 1970 –“Typeless” languages –Dennis Ritchie (Bell Laboratories) Added data typing, other features –Development language of UNIX –Hardware independent Portable programs –1989: ANSI standard –1990: ANSI and ISO standard published ANSI/ISO 9899: 1990
22
611 18200 計算機程式語言 Lecture 01-22 國立台灣大學生物機電系 林達德 1.8 History of C and C++ History of C++ –Extension of C –Early 1980s: Bjarne Stroustrup (Bell Laboratories) –“Spruces up” C –Provides capabilities for object-oriented programming Objects: reusable software components –Model items in real world Object-oriented programs –Easy to understand, correct and modify –Hybrid language C-like style Object-oriented style Both
23
611 18200 計算機程式語言 Lecture 01-23 國立台灣大學生物機電系 林達德 1.8 History of C and C++ Because C is a standardized, hardware-independent, widely available language, applications written in C often can be run with little or no modification on a wide range of computer systems. Portability Tip 1.1
24
611 18200 計算機程式語言 Lecture 01-24 國立台灣大學生物機電系 林達德 1.9 C++ Standard Library C++ programs –Built from pieces called classes and functions C++ standard library –Rich collections of existing classes and functions “Building block approach” to creating programs –“Software reuse”
25
611 18200 計算機程式語言 Lecture 01-25 國立台灣大學生物機電系 林達德 1.9 C++ Standard Library Use a “building-block” approach to create programs. Avoid reinventing the wheel. Use existing pieces wherever possible. Called software reuse, this practice is central to object-oriented programming. Software Engineering Observation 1.1
26
611 18200 計算機程式語言 Lecture 01-26 國立台灣大學生物機電系 林達德 1.9 C++ Standard Library When programming in C++, you typically will use the following building blocks: Classes and functions from the C++ Standard Library, classes and functions you and your colleagues create and classes and functions from various popular third- party libraries. Software Engineering Observation 1.2
27
611 18200 計算機程式語言 Lecture 01-27 國立台灣大學生物機電系 林達德 1.9 C++ Standard Library Using C++ Standard Library functions and classes instead of writing your own versions can improve program performance, because they are written carefully to perform efficiently. This technique also shortens program development time. Performance Tip 1.1
28
611 18200 計算機程式語言 Lecture 01-28 國立台灣大學生物機電系 林達德 1.9 C++ Standard Library Using C++ Standard Library functions and classes instead of writing your own improves program portability, because they are included in every C++ implementation. Portability Tip 1.2
29
611 18200 計算機程式語言 Lecture 01-29 國立台灣大學生物機電系 林達德 1.10 History of Java Java –1991: Sun Microsystems Green project –1995: Sun Microsystems Formally announced Java at trade show –Web pages with dynamic and interactive content –Develop large-scale enterprise applications –Enhance functionality of web servers –Provide applications for consumer devices Cell phones, pagers, personal digital assistants, …
30
611 18200 計算機程式語言 Lecture 01-30 國立台灣大學生物機電系 林達德 1.11 FORTRAN, COBOL, Pascal and Ada FORTRAN –FORmula TRANslator –1954-1957: IBM –Complex mathematical computations Scientific and engineering applications COBOL –COmmon Business Oriented Language –1959: computer manufacturers, government and industrial computer users –Precise and efficient manipulation of large amounts of data Commercial applications
31
611 18200 計算機程式語言 Lecture 01-31 國立台灣大學生物機電系 林達德 1.11 FORTRAN, COBOL, Pascal and Ada Pascal –Prof. Niklaus Wirth –Academic use Ada –Developed under the sponsorship of U.S. Department of Defense (DOD) –Multitasking –Named after Lady Ada Lovelace
32
611 18200 計算機程式語言 Lecture 01-32 國立台灣大學生物機電系 林達德 1.12 Basic Visual Basic, Visual C++, C# and.NET BASIC –Beginner’s All-Purpose Symbolic Instruction Code –Mid-1960s: Prof. John Kemeny and Thomas Kurtz (Dartmouth College) Visual Basic –1991 Result of Microsoft Windows graphical user interface (GUI) –Developed late 1980s, early 1990s –Powerful features GUI, event handling, access to Win32 API, object-oriented programming, error handling –Visual Basic.NET
33
611 18200 計算機程式語言 Lecture 01-33 國立台灣大學生物機電系 林達德 1.12 Basic Visual Basic, Visual C++, C# and.NET Visual C++ –Microsoft’s implementation of C++ Includes extensions Microsoft Foundation Classes (MFC) Common library –GUI, graphics, networking, multithreading, … –Shared among Visual Basic, Visual C++, C#.NET platform –Web-based applications Distributed to great variety of devices –Cell phones, desktop computers –Applications in disparate languages can communicate
34
611 18200 計算機程式語言 Lecture 01-34 國立台灣大學生物機電系 林達德 1.12 Basic Visual Basic, Visual C++, C# and.NET C# –Anders Hejlsberg and Scott Wiltamuth (Microsoft) –Designed specifically for.NET platform –Roots in C, C++ and Java Easy migration to.NET –Event-driven, fully object-oriented, visual programming language –Integrated Development Environment (IDE) Create, run, test and debug C# programs Rapid Application Development (RAD) –Language interoperability
35
611 18200 計算機程式語言 Lecture 01-35 國立台灣大學生物機電系 林達德 1.13 Key Software Trend: Object Technology Objects –Reusable software components that model real world items –Meaningful software units Date objects, time objects, paycheck objects, invoice objects, audio objects, video objects, file objects, record objects, etc. Any noun can be represented as an object –More understandable, better organized and easier to maintain than procedural programming –Favor modularity Software reuse –Libraries MFC (Microsoft Foundation Classes) Rogue Wave
36
611 18200 計算機程式語言 Lecture 01-36 國立台灣大學生物機電系 林達德 1.13 Key Software Trend: Object Technology Extensive class libraries of reusable software components are available over the Internet and the World Wide Web. Many of these libraries are available at no charge. Software Engineering Observation 1.3
37
611 18200 計算機程式語言 Lecture 01-37 國立台灣大學生物機電系 林達德 1.14 Typical C++ Development Environment C++ systems –Program-development environment –Language –C++ Standard Library
38
611 18200 計算機程式語言 Lecture 01-38 國立台灣大學生物機電系 林達德 1.14 Typical C++ Development Environment Phases of C++ Programs: 1.Edit 2.Preprocess 3.Compile 4.Link 5.Load 6.Execute
39
611 18200 計算機程式語言 Lecture 01-39 國立台灣大學生物機電系 林達德 1.14 Typical C++ Development Environment Input/output –cin Standard input stream Normally keyboard –cout Standard output stream Normally computer screen –cerr Standard error stream Display error messages
40
611 18200 計算機程式語言 Lecture 01-40 國立台灣大學生物機電系 林達德 1.14 Typical C++ Development Environment Errors like division by zero occur as a program runs, so they are called runtime errors or execution-time errors. Fatal runtime errors cause programs to terminate immediately without having successfully performed their jobs. Nonfatal runtime errors allow programs to run to completion, often producing incorrect results. [Note: On some systems, divide- by-zero is not a fatal error. Please see your system documentation.] Common Programming Error 1.1
41
611 18200 計算機程式語言 Lecture 01-41 國立台灣大學生物機電系 林達德 1.15 Notes About C++ and C++ How to Program, 5/e Book geared toward novice programmers –Stress programming clarity –C and C++ are portable languages Portability –C and C++ programs can run on many different computers Compatibility –Many features of current versions of C++ not compatible with older implementations
42
611 18200 計算機程式語言 Lecture 01-42 國立台灣大學生物機電系 林達德 1.15 Notes About C++ and C++ How to Program, 5/e Write your C++ programs in a simple and straightforward manner. This is sometimes referred to as KIS ( “ keep it simple ” ). Do not “ stretch ” the language by trying bizarre usages. Good Programming Practice 1.1
43
611 18200 計算機程式語言 Lecture 01-43 國立台灣大學生物機電系 林達德 1.15 Notes About C++ and C++ How to Program, 5/e Although it is possible to write portable programs, there are many problems among different C and C++ compilers and different computers that can make portability difficult to achieve. Writing programs in C and C++ does not guarantee portability. The programmer often will need to deal directly with compiler and computer variations. As a group, these are sometimes called platform variations. Portability Tip 1.3
44
611 18200 計算機程式語言 Lecture 01-44 國立台灣大學生物機電系 林達德 1.15 Notes About C++ and C++ How to Program, 5/e Read the manuals for the version of C++ you are using. Refer to these manuals frequently to be sure you are aware of the rich collection of C++ features and that you are using them correctly. Good Programming Practice 1.2
45
611 18200 計算機程式語言 Lecture 01-45 國立台灣大學生物機電系 林達德 1.15 Notes About C++ and C++ How to Program, 5/e Your computer and compiler are good teachers. If after reading your C++ language manual, you still are not sure how a feature of C++ works, experiment using a small “ test program ” and see what happens. Set your compiler options for “ maximum warnings. ” Study each message that the compiler generates and correct the programs to eliminate the messages. Good Programming Practice 1.3
46
611 18200 計算機程式語言 Lecture 01-46 國立台灣大學生物機電系 林達德 1.16 Test-Driving a C++ Application
47
611 18200 計算機程式語言 Lecture 01-47 國立台灣大學生物機電系 林達德 1.16 Test-Driving a C++ Application
48
611 18200 計算機程式語言 Lecture 01-48 國立台灣大學生物機電系 林達德 1.16 Test-Driving a C++ Application
49
611 18200 計算機程式語言 Lecture 01-49 國立台灣大學生物機電系 林達德 1.16 Test-Driving a C++ Application
50
611 18200 計算機程式語言 Lecture 01-50 國立台灣大學生物機電系 林達德 1.17 Software Engineering Case Study: Introduction to Object Technology and the UML Object oriented programming (OOP) –Model real-world objects with software counterparts –Attributes (state) - properties of objects Size, shape, color, weight, etc. –Behaviors (operations) - actions A ball rolls, bounces, inflates and deflates Objects can perform actions as well –Inheritance New classes of objects absorb characteristics from existing classes –Objects Encapsulate data and functions Information hiding –Communicate across well-defined interfaces
51
611 18200 計算機程式語言 Lecture 01-51 國立台灣大學生物機電系 林達德 1.17 Software Engineering Case Study: Introduction to Object Technology and the UML User-defined types (classes, components) –Data members Data components of class –Member functions Function components of class –Association –Reuse classes
52
611 18200 計算機程式語言 Lecture 01-52 國立台灣大學生物機電系 林達德 1.13 Key Software Trend: Object Technology Reuse of existing classes when building new classes and programs saves time, money and effort. Reuse also helps programmers build more reliable and effective systems, because existing classes and components often have gone through extensive testing, debugging and performance tuning. Software Engineering Observation 1.4
53
611 18200 計算機程式語言 Lecture 01-53 國立台灣大學生物機電系 林達德 1.17 Software Engineering Case Study: Introduction to Object Technology and the UML Object-oriented analysis and design (OOAD) process –Analysis of project’s requirements –Design for satisfying requirements –Pseudocode Informal means of expressing program Outline to guide code
54
611 18200 計算機程式語言 Lecture 01-54 國立台灣大學生物機電系 林達德 1.17 Software Engineering Case Study: Introduction to Object Technology and the UML Unified Modeling Language (UML) –2001: Object Management Group (OMG) Released UML version 1.4 –Model object-oriented systems and aid design –Flexible Extendable Independent of many OOAD processes One standard set of notations –Complex, feature-rich graphical language
55
611 18200 計算機程式語言 Lecture 01-55 國立台灣大學生物機電系 林達德 1.18 Wrap-Up Basic software and hardware concept C++’s role in computer programming World Wide Web and Internet Computer Languages C++ development environment OOP and UML WHAT’S NEXT?
56
611 18200 計算機程式語言 Lecture 01-56 國立台灣大學生物機電系 林達德 1.19 Web Resources Deitel & Associate web Sites Compilers and Development Tools Resources Games
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.