Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Intermediate Programming — Chapter 1 — MIS 233 Summer 2010 1 Introduction to Computers, the Internet, and the Web Introduction History of Java Java Class Libraries Basics of a Typical Java Environment Thinking About Objects 2 Introduction Java How to Program, 8th Edition Java Standard Edition 6 SE 6.0 Mustang Java 2 Enterprise Edition (J2EE) Java 2 Micro Edition (J2ME) J2SE Development Kit (JDK) 3 Introduction Java How to Program, 8th Edition Deitel & Deitel Java Standard Edition 6 SE 6.0 Mustang Java 2 Enterprise Edition (J2EE) Java 2 Micro Edition (J2ME) J2SE Development Kit (JDK) 4 Introduction Structured programming Object oriended programing 5 History of Java Java by Sun Microsystems in 1991 team leader: James Gosling Originally for intelligent consumer-electronic devices Then used for creating Web pages with dynamic content Now also used for: Develop large-scale enterprise applications Enhance WWW server functionality Provide applications for consumer devices (cell 6 Java Class Libraries Classes Contain methods that perform tasks Return information after task completion Used to build Java programs Java contains class libraries Known as Java APIs (Application Programming Interfaces) 7 Basics of a Typical Java Environment Java systems contain Environment Language APIs Class libraries 8 Basics of a Typical Java Environment (cont.) Java programs normally undergo five phases Edit Compile Class loader stores bytecodes in memory Verify Compiler creates bytecodes from program Load Programmer writes program (and stores program on disk) Verifier ensures bytecodes do not violate security requirements Execute Interpreter translates bytecodes into machine language 9 Basics of a Typical Java Environment (cont.) Edit extension .java Integrated development environments IDE the file contains java source code writting and editing programs debuging logic errors Examples of IDEs: Eclipse: www.eclipse.org NetBeans: www.netbeans.org JBuilder: www.borland.com 10 Basics of a Typical Java Environment (cont.) Compile source code into bytecodes executed by java virtual machine JVM platform independent instructions part of the JDK not dependent on particular hardware platform portable Load class loader takes the .class files and transfers to mai memory any class file provided by java into memory as well 11 Basics of a Typical Java Environment (cont.) Execute JVM executes the bytecodes early versions simply and interpreter Just-in-time JIT compliation slower as :one bytecode at a time combination of interpretation and compilation Compilation source to bytecodes (platform independent) bytecodes to machine language (platform dependent) 12 Fig. 1.1 A typical Java environment. Pha se 1 Pha se 2 Edit or Com piler Disk Disk Prog ram is c reat ed in the edit or and sto red on d isk. Com piler c rea te s byt ec odes and st ores the m on disk. Prim ary Mem ory Pha se 3 Class Lo ad er Class loa de r p ut s byt ec o des in m em ory. Disk . . . . . . Prim ary Mem ory Pha se 4 Byt ec ode Ve rifier . . . . . . Prim ary Mem ory Pha se 5 Int erp ret er . . . . . . By te c ode verif ier c onf irms t hat a ll byt ec odes are v alid and do not violat e Java ’ s sec urit y rest ric t ions. Int erpret er read s byt ec odes and translat es them into a la nguag e t hat t he c om put er c an und ersta nd, possib ly st oring d at a values a s the program exec ut es. 13 Thinking About Objects Objects Reusable software components that model real-world items Look all around you Attributes Size, shape, color, weight, etc. Behaviors People, animals, plants, cars, etc. Babies cry, crawl, sleep, etc. Examples object:student attributes: name,ID, status, behavior: takes a course, send to advisor,... 14 Thinking About Objects (cont.) Examples object:bank account object: employee attributes: deposited amount, account number behavior: deposit money, withdraw money , transfer money,... attributes:name ,department, salery,... behavior: make a sale, work in a project, ... employee... object: a regtangular shape attributes:hight, with, x –y coordinate, color,... behavior:area, cicunference,...... 15 Thinking About Objects (cont.) Object-oriented design (OOD) Models real-world objects class: a blueprint for objcets inheritence: new classes of objects are derived absorbing characteristics of existing classes and adding unique characteristics of their own e.g.: a manger is a personel an undergrad student is a student a saving accout is an bank account 16 Thinking About Objects (cont.) communication Models communication among objects send messages to each other e.g.: a bank account object get the message of decreasing the balance customer sent the message to withdraw money encapsulation: Encapsulates data (attributes) and functions (behaviors) Information hiding Communication through well-defined interfaces e.g.: using the breke pedal to stop a car without knowing working principles 17 Thinking About Objects (cont.) Object-oriented language Programming is called object-oriented programming (OOP) Java, C# unit of programming is class Procedural programming languages Programming is action oriented C:unit of programming is a function class: from which objects are instantiated (created) java classes have methods: implement opperations fields: implements attributes 18 Thinking About Objects (cont.) class: classes to objcets blueprint to houses many objcets can be instantiated from the same class e.g.: a student class ali, ahmet are particular students instantiated from the student class each has a name, student number each can take a corse, pay registation fee, 19 Thinking About Objects (cont.) Analysis your project requirements determining what the system is to do Design the system how the system shold do it Object-Oriented Analysis and Design (OOAD) Essential for large programs Analyze program requirements, then develop solution Unified Modeling Language (UML) Graphical language that uses common notation Allows developers to represent object-oriented designs 20