310 likes | 726 Views
Intermediate Programming — Chapter 1 —. MIS 233 Summer 2010. Introduction to Computers, the Internet, and the Web. Introduction History of Java Java Class Libraries Basics of a Typical Java Environment Thinking About Objects. Introduction. Java How to Program, 8th Edition
E N D
Intermediate Programming — Chapter 1 — MIS 233 Summer 2010
Introduction to Computers, the Internet, and the Web • Introduction • History of Java • Java Class Libraries • Basics of a Typical Java Environment • Thinking About Objects
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)
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)
Introduction • Structured programming • Object oriended programing
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 phones, etc.)
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)
Basics of a Typical Java Environment • Java systems contain • Environment • Language • APIs • Class libraries
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
Basics of a Typical Java Environment (cont.) • Edit • extension .java • the file contains java source code • Integrated development environments IDE • writting and editing programs • debuging logic errors • Examples of IDEs: • Eclipse: www.eclipse.org • NetBeans: www.netbeans.org • JBuilder: www.borland.com
Basics of a Typical Java Environment (cont.) • Compile • source code into bytecodes • executed by java virtual machine JVM • part of the JDK • platform independent instructions • 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
Basics of a Typical Java Environment (cont.) • Execute • JVM executes the bytecodes • early versions simply and interpreter • slower as :one bytecode at a time • Just-in-time JIT compliation • combination of interpretation and compilation • Compilation • source to bytecodes (platform independent) • bytecodes to machine language (platform dependent)
Thinking About Objects • 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. • Examples • object:student • attributes: name,ID, status, • behavior: takes a course, send to advisor,...
Thinking About Objects (cont.) • Examples • object:bank account • attributes: deposited amount, account number • behavior: deposit money, withdraw money , transfer money,... • object: employee • 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,......
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
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
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
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,
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