Intermediate Programming Chapter 1 MIS 233 Summer 2010




















- Slides: 20
Intermediate Programming — Chapter 1 — MIS 233 Summer 2010 1
Introduction to Computers, the Internet, and the Web n n n Introduction History of Java Class Libraries Basics of a Typical Java Environment Thinking About Objects 2
Introduction n Java How to Program, 8 th Edition n Java Standard Edition 6 SE 6. 0 n n Mustang Java 2 Enterprise Edition (J 2 EE) Java 2 Micro Edition (J 2 ME) J 2 SE Development Kit (JDK) 3
Introduction n Java How to Program, 8 th Edition n Deitel & Deitel n Java Standard Edition 6 SE 6. 0 n n Mustang Java 2 Enterprise Edition (J 2 EE) Java 2 Micro Edition (J 2 ME) J 2 SE Development Kit (JDK) 4
Introduction n n Structured programming Object oriended programing 5
History of Java n Java by Sun Microsystems in 1991 team leader: James Gosling n Originally for intelligent consumer-electronic devices n Then used for creating Web pages with dynamic content n Now also used for: n n n Develop large-scale enterprise applications Enhance WWW server functionality Provide applications for consumer devices (cell 6
Java Class Libraries n Classes n Contain methods that perform tasks n Return information after task completion Used to build Java programs Java contains class libraries n Known as Java APIs (Application Programming Interfaces) n n 7
Basics of a Typical Java Environment n Java systems contain n Environment n Language n APIs n Class libraries 8
Basics of a Typical Java Environment (cont. ) n Java programs normally undergo five phases n Edit n n Compile n n Class loader stores bytecodes in memory Verify n n Compiler creates bytecodes from program Load n n Programmer writes program (and stores program on disk) Verifier ensures bytecodes do not violate security requirements Execute n Interpreter translates bytecodes into machine language 9
Basics of a Typical Java Environment (cont. ) n Edit n extension. java n n Integrated development environments IDE n n n the file contains java source code writting and editing programs debuging logic errors Examples of IDEs: n n n Eclipse: www. eclipse. org Net. Beans: www. netbeans. org JBuilder: www. borland. com 10
Basics of a Typical Java Environment (cont. ) n Compile n source code into bytecodes n executed by java virtual machine JVM n n platform independent instructions n n n part of the JDK not dependent on particular hardware platform portable Load n n 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. ) n Execute n n JVM executes the bytecodes early versions simply and interpreter n n Just-in-time JIT compliation n n slower as : one bytecode at a time combination of interpretation and compilation Compilation n n source to bytecodes (platform independent) bytecodes to machine language (platform dependent) 12
Fig. 1. 1 A typical Java environment. 13
Thinking About Objects n Reusable software components that model real-world items n Look all around you n n Attributes n n Size, shape, color, weight, etc. Behaviors n n People, animals, plants, cars, etc. Babies cry, crawl, sleep, etc. Examples n object: student n n attributes: name, ID, status, behavior: takes a course, send to advisor, . . . 14
Thinking About Objects (cont. ) n Examples n object: bank account n n n object: employee n n n 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 n n attributes: hight, with, x –y coordinate, color, . . . behavior: area, cicunference, . . . 15
Thinking About Objects (cont. ) n n n Object-oriented design (OOD) n Models real-world objects class: n a blueprint for objcets inheritence: n new classes of objects are derived absorbing characteristics of existing classes and adding unique characteristics of their own n e. g. : n n n a manger is a personel an undergrad student is a student a saving accout is an bank account 16
Thinking About Objects (cont. ) n communication n Models communication among objects n send messages to each other n e. g. : n n n a bank account object get the message of decreasing the balance customer sent the message to withdraw money encapsulation: n Encapsulates data (attributes) and functions (behaviors) n n n Information hiding Communication through well-defined interfaces e. g. : n using the breke pedal to stop a car without knowing working principles 17
Thinking About Objects (cont. ) n n n Object-oriented language n Programming is called object-oriented programming (OOP) n Java, C# n unit of programming is class Procedural programming languages n Programming is action oriented n C: unit of programming is a function class: n from which objects are instantiated (created) n java classes have n n methods: implement opperations fields: implements attributes 18
Thinking About Objects (cont. ) n class: n classes to objcets n blueprint to houses n many objcets can be instantiated from the same class n e. g. : a student class n ali, ahmet are particular students instantiated from the student class n each has a name, student number n each can take a corse, pay registation fee, 19
Thinking About Objects (cont. ) n n Analysis your project requirements n determining what the system is to do Design the system n how the system shold do it Object-Oriented Analysis and Design (OOAD) n Essential for large programs n Analyze program requirements, then develop solution Unified Modeling Language (UML) n Graphical language that uses common notation n Allows developers to represent object-oriented designs 20




















