350 likes | 551 Views
Chapter 1 – Introduction to Computers, the Internet, and the Web. Outline
E N D
Chapter 1 – Introduction to Computers, the Internet, and the Web Outline 1.1 Introduction1.2 What Is a Computer?1.3 Computer Organization1.4 Evolution of Operating Systems1.5 Personal, Distributed and Client/Server Computing1.6 Machine Languages, Assembly Languages and High-Level Languages1.7 History of C++1.8 History of Java1.9 Java Class Libraries1.10 Other High-Level Languages1.11 Structured Programming1.12 The Internet and the World Wide Web1.13 Basics of a Typical Java Environment
Chapter 1 – Introduction to Computers, the Internet, and the Web 1.14 General Notes about Java and This Book1.15 Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language1.16 Discovering Design Patterns: Introduction1.17 Tour of the Book1.18 (Optional) A Tour of the Case Study on Object-Oriented Design with the UML1.19 (Optional) A Tour of the “Discovering Design Patterns” Sections
1.1 Introduction • Java How to Program, Fourth Edition • Core of book • Program clarity, using both structured and object-oriented programming • Learn structured programming properly, from the beginning • Java • Powerful, object-oriented language • Fun to use for beginners, appropriate for experienced programmers • Language of choice for Internet and network communications • Free implementation at http://java.sun.com/j2se
1.2 What Is a Computer? • Computer • Device for performing computations and making logical decisions • Process data using sets of instructions called computer programs • Hardware • Devices comprising a computer • Keyboard, screen, mouse, disks, memory, CD-ROM, and processing units • Software • Programs that run on a computer
1.3 Computer Organization • Six logical units in every computer Input unit • Gets information from input devices (keyboard, mouse) (receiving section) Output unit • Sends information to screen, to printer, to control other devices (shipping section) Memory unit - RAM • Rapid access, low capacity, stores input information ( low-capacity warehousing section) Arithmetic and logic unit (ALU) • Arithmetic calculations and logic decisions (manufacturing section) Central processing unit (CPU) • Supervises and coordinates sections of the computer (administrative section) Secondary storage unit • Cheap, long-term, high-capacity storage, stores inactive programs and data ( high-capacity warehousing section)
1.4 Evolution of Operating Systems • Batch processing • Doonly one job or task at a time • Operating systems • Manage transitions between jobs • Increased throughput - amount of work computers process • Multiprogramming • Many jobs or tasks sharing computer resources • Timesharing • Run small portion of one user’s job, move onto next user • Programs appear to be running simultaneously • Almost immediate responses to requests
1.5 Personal, Distributed and Client/Server Computing • Personal computing • Popularized by Apple Computer in 1977 • IBM followed suit in 1981 with the IBM Personal Computer • Computers economical enough for personal use • Stand-alone units • Distributed computing • Organization has a Local Area Network (LAN) • Computers linked to it • Computing distributed over the LAN • Client/server computing • Servers offer common store of programs and data • Clients access programs and data from server • C and C++ popular for writing operating systems, networking, and distributed client/server applications • Java used for Internet-based applications • Programming in Java can be more productive than C or C++
1.6 Machine Languages, Assembly Languages and High-Level Languages • Types of programming languages • Machine languages • Strings of numbers giving machine specific instructions • Example: +1300042774+1400593419+1200274027 • Assembly languages • English-like abbreviations representing elementary computer operations (translated via assemblers) • Example: LOAD BASEPAY ADD OVERPAY STORE GROSSPAY
1.6 Types of programming languages • Machine language • “Natural language” of computer component • Machine dependent • Assembly language • English-like abbreviations represent computer operations • Translator programs convert to machine language • High-level language • Allows for writing more “English-like” instructions • Contains commonly used mathematical operations • Example: grossPay = basePay + overTimePay • Compiler convert to machine language • Interpreter • Execute high-level language programs without compilation
1.7 History of C++ • C++ evolved from C (C -1972 D. Ritchie, Bell Lab, PDP 11) • C evolved from two previous programming languages, BCPL and B • Kernighan and Ritchie: “The C Programming Language”.’78, 2nd ‘88 • ANSI/ISO 9899 established worldwide standards for C programming called ANSI C • C++ (B. Stroustrup, 1980, Bell Lab) “spruces up” C • Provides capabilities for object-oriented programming • Objects- reusable software components that model things in the real world • Object-oriented programs easier to understand, correct and modify • Objects • Reusable software components that model real-world items
1.8 History of Java • Java • Based on C and C++ • Developed in 1991 for intelligent consumer electronic devices • Market did not develop, project in danger of being cancelled • Internet exploded in 1993, it saved project • Used Java to create web pages with dynamic content • Java formally announced in 05/1995 • Now used to create web pages with interactive content, enhance web servers, applications for consumer devices (pagers, cell phones, PDAs, …)
1.9 Java Class Libraries • Java programs • Consist of pieces called classes • Classes contain methods, which perform tasks • Class libraries • Also known as Java API (Applications Programming Interface) - http://java.sun.com/j2se/1.3/docs/api/ • Rich collection of predefined classes, which you can use • Two parts to learning Java • Learning the language itself, so you can create your own classes • Learning how to use the existing classes in the libraries
1.10 Other High-Level Languages • A few other high-level languages have achieved broad acceptance • FORTRAN (FORmula TRANslator), ’54-’57 • Scientific and engineering applications • COBOL (COmmon Business Oriented Language) ‘59 • Used to manipulate large amounts of data • PASCAL, N. Wirth, ‘71 • Intended for academic use • BASIC • Developed in 1965 • Simple language to help novices • ADA early ’80s • Modula, Concurrent Pascal (multitasking) etc.
1.11 Structured Programming • Structured programming • Disciplined approach to writing programs • Clear, easy to test, debug, and modify • Pascal designed to teach structured programming • Not used in industrial or commercial applications • Multitasking • Many activities run in parallel • C and C++ allow one activity at a time • Java allows multithreading • Activities can occur in parallel • ADA • Multitasking
1.12 The Internet and the World Wide Web • The Internet • Developed 30 years ago, funded by the Department of Defense • Originally designed to link universities • Now accessible by hundreds of millions of computers • World Wide Web • View multimedia-based documents • Internet has exploded • Mixes computing and communication • Changes how business is done • Information instantly accessible • We cover Java applications that use the Internet
1.13 Basics of a Typical Java Environment • Java systems contain • Environment • Language • Java Applications Programming Interface (API) • Class libraries • Java programs have five phases • 1. Edit • Use an editor to type Java program • vi or emacs, notepad, Jbuilder, Visual Café, Visual Age • .java extension • 2. Compile • Translates program into bytecodes, understood by Java interpreter • javac command: javac myProgram.java • Creates .class file containing bytecodes (myProgram.class)
1.13 Basics of a Typical Java Environment • Java programs have five phases (continued) • 3. Loading • Class loader transfers .class file into memory • Applications - run on user's machine • Applets - loaded into Web browser, temporary • Classes loaded and executed by interpreter with java command java Welcome • HTML documents can refer to Java Applets, loaded into web browsers • To load, appletviewer Welcome.html • appletviewer minimal browser, can only interpret applets
1.13 Basics of a Typical Java Environment • Java programs have five phases (continued) • 4. Verify • Bytecode verifier makes sure bytecodes are valid and do not violate security • Java must be secure - possible to damage files (viruses) • 5. Execute • Computer interprets program one bytecode at a time • Performs actions specified in program • Program may not work on first try • Make changes in edit phase and repeat
1.13 Basics of a Typical Java Environment (cont.) • Java programs normally undergo five phases • Edit • Programmer writes program (and stores program on disk) • Compile • Compiler creates bytecodes from program • Load • Class loader stores bytecodes in memory • Verify • Verifier ensures bytecodes do not violate security requirements • Execute • Interpreter translates bytecodes into machine language
1.14 General Notes about Java and This Book • Java • Powerful language • Programming notes p.XLIII • Clarity - Keep It Simple (KIS) • Portability - Java very portable, but it is an elusive goal • But Java does not guarantee portability. The programmer needs to deal with differences among compilers, interpreters and computer variations. • Performance • General: interpreted programs run slower than compiled ones • a source program must be compiled first before it can be executed then can run faster then interpreted programs • interpreted programs interprets and execute line by line immediately • Bytecode compilers compile Java programs into machine code • Runs faster, comparable to C / C++
1.14 General Notes about Java and This Book • Just-in-time compiler • Midway between compiling and interpreting • As interpreter runs, produces compiled code and executes it • Not as efficient as full compilers • Being developed for Java • High-speed compiler – Sun’s HotSpot is standard component of the Java 2 SDK (Software Development Kit) • Integrated Development Environment (IDE) • Tools to support software development (editors, debuggers,…) • Several Java IDE's are as powerful as C / C++ IDE's • Sun’s Java IDE-Forte for Java can be downloaded from www.sun.com/forte/ffj
1.14 General Notes about Java and This Book • Some details of Java not covered http://java.sun.com/j2se/1.4/docs/api/ http://java.sun.com/j2se/1.4/docs.html • to download this documentation
1.15 Thinking About Objects: Introduction to Object Technology and the Unified Modeling Language • Object orientation • Unified Modeling Language (UML) • Graphical language that uses common notation • Allows developers to represent object-oriented designs
1.15 Thinking About Objects (cont.) • Objects • Reusable software components that model real-world items • Look all around you • People, animals, plants, cars, etc. • Attributes (data) • Size, shape, color, weight, etc. • Behaviors (functions) • Babies cry, crawl, sleep, etc.
1.15 Thinking About Objects (cont.) • Object-oriented design (OOD) • Models real-world objects • Models communication among objects • Encapsulates data (attributes) and functions (behaviors) • Information hiding • Communication through well-defined interfaces • Object-oriented language • Programming is called object-oriented programming (OOP) • Java
1.15 Thinking About Objects (cont.) • Object-Oriented Analysis and Design (OOAD) • Essential for large programs • Analyze program requirements, then develop solution • We begin OOAD in Chapter 2 • Elevator-simulation case study
1.15 Thinking About Objects (cont.) • History of the UML • Need developed for process with which to approach OOAD • Brainchild of Booch, Rumbaugh and Jacobson • Object Management Group (OMG) supervised • Version 1.4 is current version • Version 2.0 scheduled tentatively for release in 2003
1.15 Thinking About Objects (cont.) • UML • Graphical representation scheme • Enables developers to model object-oriented systems • Flexible and extendible
1.16 Discovering Design Patterns: Introduction • Effective design crucial for large programs • Design patterns • Proven architectures for developing object-oriented software • Architectures created from accumulated industry experience • Reduce design-process complexity • Promotes design reuse in future systems • Helps identify common design mistakes and pitfalls • Helps design independently of implementation language • Establishes common design “vocabulary” • Shortens design phase in software-development process
1.16 Discovering Design Patterns (cont.) • Design patterns • Similar to architectural elements • arches and columns • Used by developers to construct sets of classes and objects • Developers • Familiarity with patterns to understand how to use patterns
1.16 Discovering Design Patterns (cont.) • History of Design Patterns • Gamma, Helm, Johnson and Vlissides • “Gang of Four” • Design Patterns, Elements of Reusable Object-Oriented Software (Addison Wesley: 1995) • Established 23 design patterns • Creational • Instantiate objects • Structural • Organize classes and objects • Behavioral • Assign responsibilities to objects