Chapter1

25
Wed, 10.00-12.30 [email protected] (Lect) Wed, 10.00 – 12.30 -@Puskom (Lab) Prof. Dr. Prof. Dr. Prof. Dr. Prof. Dr. – –Ing. Kalamullah Ram Ing. Kalamullah Ram Ing. Kalamullah Ram Ing. Kalamullah Ramli 1 Object Oriented Programming Object Oriented Programming Object Oriented Programming Object Oriented Programming

Transcript of Chapter1

Page 1: Chapter1

Wed, 10.00-12.30 [email protected] (Lect)Wed, 10.00 – 12.30 -@Puskom (Lab)

Prof. Dr. Prof. Dr. Prof. Dr. Prof. Dr. ––––Ing. Kalamullah RamIng. Kalamullah RamIng. Kalamullah RamIng. Kalamullah Ramli

1

Object Oriented ProgrammingObject Oriented ProgrammingObject Oriented ProgrammingObject Oriented Programming

Page 2: Chapter1

� Understand Object Oriented Design Paradigm

� Understand principles of and best practice on developing and analysing Object Oriented System Software

� Capable of designing, initializing and implementing Object Oriented System Software

2

ObjectivesObjectivesObjectivesObjectives

Page 3: Chapter1

3

Syllabus of CourseSyllabus of CourseSyllabus of CourseSyllabus of Course

W Topics Date Lect Task

1Introduction to OOP 31-Agust KLM reading Chap 2, Chap 3, Chap 4 (Cisco-Sun)

2Object Oriented Principles 07-Sep KLM reading Chap 5, Chap 6, Chap 7 (Cisco-Sun)

3Inheritance 14-Sep reading Chap 8 (Cisco-Sun)

4Polymorphism 28-Sep KLM review reading Chap 2 to Chap 8

5Java Packages, AWT 05-Okt KLM reading Chap 9, Chap 10 (Cisco-Sun)

6Introduction to Java Networking, Applets, Graphics 12-Okt reading Chap 11 (Cisco-Sun)

Mid-Test 19-23-Okt

7

Lab Exercises: setting, initializing, implementing Object Oriented Applications

26-Okt KLM exercise, reading Chap 12 (Cisco-Sun)

8 02-Nop KLM exercise, reading Chap 13 (Cisco-Sun)

9 09-Nop KLM exercise, reading Chap 14 (Cisco-Sun)

10 16-Nop KLM exercise, reading Chap 15 (Cisco-Sun)

11Project Explanation 23-Nop KLM Developing

12Project Explanation 30-Nop KLM Developing

Final-Test 07-21-Des

Page 4: Chapter1

� Deitel, “

� Cisco & Sun, “Java Programming”, Cisco Networking Academy

4

ReferencesReferencesReferencesReferences

Page 5: Chapter1

5

Lecture 1Lecture 1Lecture 1Lecture 1

IntroductionIntroductionIntroductionIntroduction totototoObject Oriented ProgrammingObject Oriented ProgrammingObject Oriented ProgrammingObject Oriented Programming

Page 6: Chapter1
Page 7: Chapter1

� Hardware componentscomponentscomponentscomponents

� Software and programmingprogrammingprogrammingprogramming

� Introduction to JavaJavaJavaJava

� Integrated Development Environment (IDEIDEIDEIDE)

Page 8: Chapter1

� Central Processing Unit (CPU)

� Persistent Data Storage

◦ Hard Drive, CD, Diskette, ROM

� Volatile Storage

◦ Random Access Memory (RAM)

� Peripherals

◦ Mouse, Keyboard, Screen, etc

Page 9: Chapter1

� Instructions that telltelltelltell the hardwarehardwarehardwarehardwarewhat to do

� ThreeThreeThreeThree ways to obtainobtainobtainobtain software

◦ Buy pre-written software

◦ Modify pre-existing software

◦ Write the software

Page 10: Chapter1

� ToolsToolsToolsTools for the useruseruseruser

� Usually a collectioncollectioncollectioncollection of programs

� Provide a useruseruseruser interfaceinterfaceinterfaceinterface

◦ Accept input

◦ React to requests

� Examples: Microsoft Office, Netscape Navigator

Page 11: Chapter1

� ProgramProgramProgramProgram that controlscontrolscontrolscontrols the computer hardwarehardwarehardwarehardware

� Provides a consistentconsistentconsistentconsistent way for applications to accessaccessaccessaccess the hardwarehardwarehardwarehardware

� ManyManyManyMany Operating Systems exist, mostly incompatibleincompatibleincompatibleincompatible with each other

� Applications mustmustmustmust be written specificallyspecificallyspecificallyspecifically for the targettargettargettarget Operating System

Page 12: Chapter1

� Digital CPUs require binarybinarybinarybinary instructions

� EarlyEarlyEarlyEarly computers were programmedprogrammedprogrammedprogrammed with electricalelectricalelectricalelectrical switches

� Very difficultdifficultdifficultdifficult to write programsprogramsprogramsprograms

� Early languages used mnemonicsmnemonicsmnemonicsmnemonics that were translatedtranslatedtranslatedtranslated to binarybinarybinarybinary for the CPU

� HigherHigherHigherHigher----levellevellevellevel languages allow the programmer to ignoreignoreignoreignore the detailsdetailsdetailsdetails

Page 13: Chapter1

� Early high-level languages were proceduralproceduralproceduralprocedural� Programs were a listlistlistlist of sequential stepssequential stepssequential stepssequential steps� Programmer had to thinkthinkthinkthink like the computercomputercomputercomputer� Object-oriented Programming (OOP) uses

generalgeneralgeneralgeneral purposepurposepurposepurpose componentscomponentscomponentscomponents� Components are then assembledassembledassembledassembled in to an

applicationapplicationapplicationapplication

Page 14: Chapter1

� Components are called ‘ObjectsObjectsObjectsObjects’

� Object perform specificspecificspecificspecific functionsfunctionsfunctionsfunctions

� Objects interactinteractinteractinteract by sendingsendingsendingsending & receivingreceivingreceivingreceivingmessages

� Programmer is focused on coordinatingcoordinatingcoordinatingcoordinating the object interactioninteractioninteractioninteraction

� CloselyCloselyCloselyClosely models human problemproblemproblemproblem----solvingsolvingsolvingsolving

Page 15: Chapter1

� PunctuationPunctuationPunctuationPunctuation – Symbols used

� VocabularyVocabularyVocabularyVocabulary – The languages keywords

� IdentifiersIdentifiersIdentifiersIdentifiers – Used to reference data

� OperatorsOperatorsOperatorsOperators – Symbols representing commands

� SyntaxSyntaxSyntaxSyntax – Rules for combining the language’s elements

Page 16: Chapter1

� CompiledCompiledCompiledCompiled – The program is translatedtranslatedtranslatedtranslated in to the CPU’s binary languagebinary languagebinary languagebinary language once it is completed

� InterpretedInterpretedInterpretedInterpreted – The individualindividualindividualindividual instructionsinstructionsinstructionsinstructions in the program are translated immediatelyimmediatelyimmediatelyimmediatelybefore they are executedexecutedexecutedexecuted

Page 17: Chapter1

� Originally designed for consumerconsumerconsumerconsumer devices

� Had to be smallsmallsmallsmall, simplesimplesimplesimple, portableportableportableportable

� IdealIdealIdealIdeal for use over the InternetInternetInternetInternet

Page 18: Chapter1
Page 19: Chapter1

� Java programs written as texttexttexttext files� Java compilercompilercompilercompiler creates a programprogramprogramprogram file

consisting of ‘Byte CodeByte CodeByte CodeByte Code’� The byte-code file is sent to the targettargettargettarget

computer, which has a Java Virtual MachineJava Virtual MachineJava Virtual MachineJava Virtual Machine(JVM)

� The JVM ‘interpretsinterpretsinterpretsinterprets’ the byte-code, oneoneoneoneinstruction at a time

� A Separate JVMJVMJVMJVM is requiredrequiredrequiredrequired for each Operating SystemOperating SystemOperating SystemOperating System & CPUCPUCPUCPU

Page 20: Chapter1
Page 21: Chapter1

� Create Java Programs with a text editortext editortext editortext editor or Integrated Development EnvironmentIntegrated Development EnvironmentIntegrated Development EnvironmentIntegrated Development Environment (IDE)

� Use a compilercompilercompilercompiler to create the ‘byte-code’ classclassclassclassfiles (Such as JDK)

� A Java Virtual Machine (JVMJVMJVMJVM) on the targettargettargettargetcomputers

Page 22: Chapter1

/*** A Java Program* @author: Student*/// This program will say hello

public class sayHello {public static void main(String args[]) {

String name = “Student”;int number = 1;System.out.println(“Hello”);System.out.println(name);System.out.println(“Your lucky number is “ + number);

}}

Comments

Class definition

Data & methods

The ‘main’ method

Punctuation

Page 23: Chapter1
Page 24: Chapter1
Page 25: Chapter1