Chapter1
-
Upload
teknik-komputer-ui -
Category
Documents
-
view
348 -
download
0
Transcript of 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
� 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
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
� Deitel, “
� Cisco & Sun, “Java Programming”, Cisco Networking Academy
4
ReferencesReferencesReferencesReferences
5
Lecture 1Lecture 1Lecture 1Lecture 1
IntroductionIntroductionIntroductionIntroduction totototoObject Oriented ProgrammingObject Oriented ProgrammingObject Oriented ProgrammingObject Oriented Programming
� Hardware componentscomponentscomponentscomponents
� Software and programmingprogrammingprogrammingprogramming
� Introduction to JavaJavaJavaJava
� Integrated Development Environment (IDEIDEIDEIDE)
� Central Processing Unit (CPU)
� Persistent Data Storage
◦ Hard Drive, CD, Diskette, ROM
� Volatile Storage
◦ Random Access Memory (RAM)
� Peripherals
◦ Mouse, Keyboard, Screen, etc
� Instructions that telltelltelltell the hardwarehardwarehardwarehardwarewhat to do
� ThreeThreeThreeThree ways to obtainobtainobtainobtain software
◦ Buy pre-written software
◦ Modify pre-existing software
◦ Write the software
� ToolsToolsToolsTools for the useruseruseruser
� Usually a collectioncollectioncollectioncollection of programs
� Provide a useruseruseruser interfaceinterfaceinterfaceinterface
◦ Accept input
◦ React to requests
� Examples: Microsoft Office, Netscape Navigator
� 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
� 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
� 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
� 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
� PunctuationPunctuationPunctuationPunctuation – Symbols used
� VocabularyVocabularyVocabularyVocabulary – The languages keywords
� IdentifiersIdentifiersIdentifiersIdentifiers – Used to reference data
� OperatorsOperatorsOperatorsOperators – Symbols representing commands
� SyntaxSyntaxSyntaxSyntax – Rules for combining the language’s elements
� 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
� Originally designed for consumerconsumerconsumerconsumer devices
� Had to be smallsmallsmallsmall, simplesimplesimplesimple, portableportableportableportable
� IdealIdealIdealIdeal for use over the InternetInternetInternetInternet
� 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
� 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
/*** 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