1 / 51

Introduction to Computers, the Internet and the World Wide Web

1. Introduction to Computers, the Internet and the World Wide Web. Our life is frittered away by detail…. Simplify, simplify. Henry David Thoreau The chief merit of language is clearness. Galen My object all sublime I shall achieve in time. W. S. Gilbert

kristenv
Download Presentation

Introduction to Computers, the Internet and the World Wide Web

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. 1 • Introduction to Computers, the Internet and the World Wide Web

  2. Our life is frittered away by detail…. Simplify, simplify. Henry David Thoreau The chief merit of language is clearness. Galen My object all sublime I shall achieve in time. W. S. Gilbert He had a wonderful talent for packing thought close, and rendering it portable. Thomas B. Macaulay “Egad, I think the interpreter is the hardest to be understood of the two!” Richard Brinsley Sheridan Man is still the most extraordinary computer of all. John F. Kennedy

  3. OBJECTIVES In this chapter you will learn: • Basic hardware and software concepts. • Basic object technology concepts, such as classes, objects, attributes, behaviors, encapsulation, inheritance and polymorphism. • The different types of programming languages. • Which programming languages are most widely used. • A typical Java development environment. • Java's role in developing distributed client/server applications for the Internet and the Web. • The history of the industry-standard object-oriented design language, the UML. • The history of the Internet and the World Wide Web. • To test-drive Java applications.

  4. 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 History of Java • 1.10 Java Class Libraries

  5. 1.11 FORTRAN, COBOL, Pascal and Ada • 1.12 BASIC, Visual Basic, Visual C++, C# and .NET • 1.13 Typical Java Development Environment • 1.14 Notes about Java and Java How to Program, Sixth Edition • 1.15 Test-Driving a Java Application • 1.16 Software Engineering Case Study: Introduction to Object Technology and the UML (Required) • 1.17 Wrap-Up • 1.18 Web Resources

  6. 1.1 Introduction • Java How to Program, Sixth Edition • Java 2 Platform, Standard Edition (J2SE) (Sun Microsystems 昇陽公司的標準版) • J2SE Development Kit version 5.0 (一般使用者以Java撰寫軟體時所需要的基本工具) • Object-Oriented Programming  早期為結構化程式設計。 • Java 的另兩個版本: • 企業版的 Java 2 Platform, Enterprise Edition (J2EE)  大型,分散式網路應用程式。 (Advanced Java 2 Platform How to Program) • 精簡版的 Java 2 Platform, Micro Edition (J2ME) 小型,記憶體受限的裝置使用,例如:手機(cellular phone) ,PDA

  7. 1.2 What Is a Computer? • Computer • Performs computations and makes logical decisions • Millions (百萬 10^6) / billions (十億10^9)times faster than human beings • Computer programs • Sets of instructions for which computer processes data • Hardware • Physical devices of computer system (CPU, mouse, keyboard, DVD, etc.) • Software • Programs that run on computers

  8. 1.3 Computer Organization • Six logical units of computer system • Input unit • Mouse, keyboard • Output unit • Printer, monitor, audio speakers • Memory unit • Retains input and processed information • Arithmetic and logic unit (ALU) • Performs calculations • Central processing unit (CPU) • Supervises operation of other devices • Secondary storage unit • Hard drives, floppy drives

  9. 1.4 Early Operating Systems • Batch processing (批次處理) • One job (task) at a time • Operating systems developed (早期的作業系統發展之目的) • Programs to make computers more convenient to use • Switch jobs easier • Multiprogramming (多工) • “Simultaneous” jobs • Timesharing operating systems (分時) • P.s.: 分時與多工必須分辨清楚

  10. 1.5 Personal, Distributed and Client/Server Computing • Personal computing • Computers for personal use • Distributed computing • Computing performed among several computers • Client/server computing • Servers offer common store of programs and data • Clients access programs and data from server • Java 已成為電腦網路與分散式 client/server computing program 方面最為廣泛使用的電腦語言之一

  11. 1.6 The Internet and the World Wide Web • Internet • Developed more than four decades ago with DOD (美國國防部) funding • Originally for connecting few main computer systems • 12 個美國主要大學和研究機構的電腦系統連接起來。 • Now accessible by hundreds of millions of computers • World Wide Web (WWW) (全球資訊網) • Allows for locating/viewing multimedia-based documents

  12. 1.7 Machine Languages, Assembly Languages and High-Level Languages • Machine language • “Natural language” of computer component • Machine dependent • 為一串數字(0/1)所組成,以指揮電腦一次執行的基本動作。 • Assembly language • English-like abbreviations represent computer operations • Translator programs (assembler, 組譯器) convert to machine language • High-level language • Allows for writing more “English-like” instructions • Contains commonly used mathematical operations, e.g., grossPay = basePay + overTimePay • Compiler (編譯器) converts to machine language • Interpreter • Execute high-level language programs without compilation • Java 混合 Compilation 及 Interpretation

  13. 1.8 History of C and C++ • C++ • Evolved from C • Evolved from BCPL and B • BCPL 是由Martin Richards 在1967年研發出來的。Ken Thomson 將它移到 B 語言中,並在1970年於貝爾實驗室中建立了早期的 Unix • C 語言是由 Dennis Ritchie 在 Bell Lab 從 B 語言改進而來。 • Provides object-oriented programming capabilities • C++ 可以用C的方式,物件導向的方式,以及前述兩種方式混合寫程式。 • Objects • Reusable software components that model real-world items

  14. 1.9 History of Java • Java • Originally for intelligent consumer-electronic devices • Sun Microsystems 在 1991 年成立的公司專案:Green • James Gosling 以 Oak 命名  Java • 然而此專案的產品並未如 Sun 所預期,反而因為 • Then used for creating Web pages with dynamic content • Now also used to: • Develop large-scale enterprise applications • Enhance WWW server functionality • Provide applications for consumer devices (cell phones, etc.)

  15. 1.10 Java Class Libraries • Classes • Include methods that perform tasks • Return information after task completion • Used to build Java programs • Java provides class libraries • Known as Java APIs (Application Programming Interfaces) • 學習 Java 的兩個主要領域: • Java 語言本身,設計你自己的類別 • Java 類別庫(class library) 中類別的使用

  16. Software Engineering Observation 1.1 • 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.

  17. Software Engineering Observation 1.2 • When programming in Java, you will typically use the following building blocks: Classes and methods from class libraries, classes and methods you create yourself and classes and methods that others create and make available to you.

  18. Performance Tip 1.1 • Using Java API classes and methods instead of writing your own versions can improve program performance, because they are carefully written to perform efficiently. This technique also shortens program development time.

  19. Portability Tip 1.1 • Using classes and methods from the Java API instead of writing your own improves program portability, because they are included in every Java implementation.

  20. Software Engineering Observation 1.3 • Extensive class libraries of reusable software components are available over the Internet and the Web, many at no charge.

  21. 1.11 FORTRAN, COBOL, Pascal and Ada • FORTRAN • FORmula TRANslator 由 IBM 公司在 1954 到 1957 年發展出來,主要用在需要複雜數學計算的科學與工程上的應用。 • COBOL • COmmon Business Oriented Language 在 1959 年由電腦製造商,政府部門與電腦使用者所共同發展出來的。 • COBOL 主要用在商業應用 • 迄今,估計有超過一半的商業軟體仍是使用COBOL所撰寫的。

  22. Pascal • Structured programming 是由 Niklaus Wirth 於 1971 年所發展的。 • 其定位為於校園環境下教授結構化程式設計之用。 • 由於缺乏在商業,工業使用的應用,並未在校園外受到廣泛地接受 • Ada (美國國防部在1980年代初期發展出來,想要統合多樣語言,使得使用單一程式語言就能滿足大部分程式的需求) • Multitasking,可讓 Programmer 能寫出平行處理的程式。

  23. 1.12 BASIC, Visual Basic, Visual C++, C# and .NET • BASIC • Beginner’s All-Purpose Symbolic Instruction Code • 在 1960 年由 Dartmouth 學院的 John Kemeny and Thomas Kurtz, 針對撰寫簡單程式的需求所發展出來的。 • 微軟於 1990 提出 Visual Basic, 用於簡化視窗應用程式的開發過程,目前為最受廣泛使用的語言之一。

  24. .NET • .NET platform 為微軟最新的開發工具。微軟打算將網際網路與全球資訊網,和電腦應程式加以整合以符合其公司策略。這個策略的實作產品即為 .Net Platform,提供建立與執行應用程式的功能給開發人員,讓他們能設計出可在網際網路上執行的分散式電腦應用程式。其主要的程式設計語言分別是: • Visual Basic .NET • Based on BASIC • Visual C++ • Based on C++ • C# • Based on C++ and Java • 使用 .NET 的開發人員可以用他們所熟悉的語言撰寫軟體元件,然後透過這些元件與其他任何以 .NET 語言所撰寫的元件加以組合,構成完整之應用程式。

  25. 1.13 Typical Java Development Environment • Java programs normally undergo five phases • Edit • Programmer writes program (and stores program on disk) • Unix 之 vi, emacs, Windows 的 notebook • 許多主要的軟體供應商都提供了整合開發環境 (IDE: Integrated Development Environments), e.g., NetBeans, Eclipes, Jbuilder, Visual J++, and Sun Java Studio • Compile • Compiler creates bytecodes from program (中間碼程式) • e.g., javac welcome,java  welcome.class • Bytecode 是以 Java Virtual Machine (JVM) 來執行的。 • 因機器語言會因電腦硬體的不同而有所差異,但中間碼是獨立於平台的制行指令,跟個別的硬體平台無關。因此,Java 的 bytecode 具有可攜性,但這些平台需包含 JVM。

  26. Load • Class loader stores bytecodes in memory • 此類別載入器也會載入該程式所使用到的其他Java系統所提供的 .class 檔。這些 .class 的檔案可以從系統磁碟或是從網路載入。 • Verify • Bytecode Verifier confirms bytecodes do not violate security restrictions • Execute • JVM translates bytecodes into machine language • JVM 僅為 Java 的 interpreter (直譯器),一次只直譯一個中間碼,使得程式的執行非常緩慢。 • 目前的 Java 熱點編譯器 (Java HotSpot compiler) 會將中間碼編譯t成低階的電腦機器語言,當 JVM 再度碰到這些編譯過的部分時,便執行此機器碼。

  27. Fig. 1.1 | Typical Java development environment.

  28. Common Programming Error 1.1 • 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.

  29. 1.14 Notes about Java and Java How to Program, Sixth Edition • Stresses clarity • Portability

  30. Good Programming Practice 1.1 • Write your Java 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.

  31. Portability Tip 1.2 • Although it is easier to write portable programs in Java than in other programming languages, differences between compilers, JVMs and computers can make portability difficult to achieve. Simply writing programs in Java does not guarantee portability.

  32. Error-Prevention Tip 1.1 • Always test your Java programs on all systems on which you intend to run them, to ensure that they will work correctly for their intended audiences.

  33. Good Programming Practice 1.2 • Read the documentation for the version of Java you are using. Refer to it frequently to be sure you are aware of the rich collection of Java features and are using them correctly.

  34. Good Programming Practice 1.3 • Your computer and compiler are good teachers. If, after carefully reading your Java documentation manual, you are not sure how a feature of Java works, experiment and see what happens. Study each error or warning message you get when you compile your programs (called compile-time errors or compilation errors), and correct the programs to eliminate these messages.

  35. Software Engineering Observation 1.4 • The J2SE Development Kit comes with the Java source code. Some programmers like to read the source code for the Java API classes to determine how the classes work and to learn additional programming techniques.

  36. 1.15 Test-Driving a Java Application • Test-driving the ATM application • Check system setup • Locate the ATM application (Fig. 1.2) • Run the ATM application (Fig. 1.3) • Enter an account number (Fig. 1.4) • Enter a PIN (Fig. 1.5) • View the account balance (Fig. 1.6) • Withdraw money from the account (Fig. 1.7) • Confirm that the account information has been updated (Fig. 1.8) • End the transaction (Fig. 1.9) • Exit the ATM application • Additional applications

  37. Using the cd command to change directories File location of the ATM application Fig. 1.2 | Opening a Windows XP Command Prompt and changing directories.

  38. Fig. 1.3 | Using the java command to execute the ATM application.

  39. ATM welcome message Enter account number prompt Fig. 1.4 | Prompting the user for an account number.

  40. Enter valid PIN ATM main menu Fig. 1.5 | Entering a valid PIN number and displaying the ATM application's main menu.

  41. Account balance information Fig. 1.6 | ATM application displaying user account balance information.

  42. ATM withdrawal menu Fig. 1.7 | Withdrawing money from the account and returning to the main menu.

  43. Confirming updated account balance information after withdrawal transaction Fig. 1.8 | Checking new balance.

  44. Account number prompt for next user ATM goodbye message Fig. 1.9 | Ending an ATM transaction session.

  45. Fig. 1.10 | Examples of additional Java applications found in Java How to Program, 6/e.

  46. 1.16 Software Engineering Case Study: Introduction to Object Technology and the UML (Required) • Object orientation • Unified Modeling Language (UML) • Graphical language that uses common notation • Allows developers to represent object-oriented designs

  47. 1.16 Software Engineering Case Study (Cont.) • Objects • Reusable software components that model real-world items • Look all around you • People, animals, plants, cars, etc. • Attributes • Size, shape, color, weight, etc. • Behaviors • Babies cry, crawl, sleep, etc.

  48. 1.16 Software Engineering Case Study (Cont.) • Object-oriented design (OOD) • Models real-world objects • Models communication among objects • Encapsulates attributes and operations (behaviors) • Information hiding • Communication through well-defined interfaces • Object-oriented language • Programming in object-oriented languages is called object-oriented programming (OOP) • Java

  49. 1.16 Software Engineering Case Study (Cont.) • Object-Oriented Analysis and Design (OOA/D) • Essential for large programs • Analyze program requirements, then develop solution • UML • Unified Modeling Language

  50. 1.16 Software Engineering Case Study (Cont.) • History of the UML • Need developed for process with which to approach OOA/D • Brainchild of Booch, Rumbaugh and Jacobson • Object Management Group (OMG) supervised • Version 1.5 is current version • Version 2 under development

More Related