Object Oriented Programming Week 1 Rules, contact, reference Java dan OOP Dr. Andi Wahju R.E, MSSE 2013
Contact me Name: Dr. Andi Wahju R.E, BSEE, MSSE E-mail: andi.wre@itmaranatha.org fb: www.facebook.com/andi.emanuel Website: http://andiwre.itmaranatha.org
Manfaat Mata Kuliah Mahasiswa dapat mempelajari konsep pemrograman berorientasi objek (object oriented) yang berbeda dari konsep pemrograman prosedural dan dapat diaplikasikan dalam kasus real
Target Mata Kuliah Mahasiswa memiliki kemampuan pemrograman berorientasi objek untuk menganalisa dan memecahkan kasus
Buku referensi Deitel, P., & Deitel, H. (2011). Java How To Program (9th ed.). Prentice Hall. Horstmann, C. S., & Cornell, G. (2008). Core Java Fundamentals (8th ed., Vol. I). California: Prentice Hall. McLaughlin, B. D., Pollice, G., & West, D. (2007). Head First Object Oriented Analysis and Design. California: O'Reilly. O'Docherty, M. (2005). Object-Oriented Analysis and Design Understanding System Development with UML 2.0. West Sussex: John Wiley & Sons, Ltd.
Kriteria Penilaian Bobot Penilaian Praktikum 12% UAS 30% Responsi 12% UTS 30% Other 28% Tugas Besar 16%
Tugas Besar Kelompok 3 4 orang (tentukan ketua) Cari sebuah kasus dalam dunia nyata (masing- masing kelompok harus berbeda) Analisa kasus tersebut dengan pendekatan berorientasi objek Buatlah progres kerja setiap minggu dan laporkan Dipresentasikan di akhir perkuliahan sebelum UAS
Tugas Besar cont. Dokumen Ukuran kertas A4 dengan: Margin kiri: 4 cm Margin atas, kanan, bawah: 3 cm Judul bab: Calibri 14 pt center Font laporan: Calibri 11 pt Judul sub bab: Cambria 11 pt Caption gambar / tabel: Calibri 9 pt center
Tugas Besar cont. Dokumen Penomoran halaman Halaman dengan judul bab: tengah bawah Halaman lainnya: kanan atas Daftar isi: nomor halaman = angka romawi (i, ii, dst)
Tools Jdk7u6 (Java development kit) Notepad++, EditPlus
Aturan Perkuliahan Kehadiran > 75% Keterlambatan max 15 menit (jika lebih tidak diizinkan masuk) jam esia Gunakan pakaian rapi & sepatu Seluruh HP / alat komunikasi Silent Tidak diletakkan di meja / di atas PC / di laci keyboard Dilarang makan / minum Dilarang main game
Materi Perkuliahan Minggu Materi 1 Pengenalan Java dan OOP 2 Percabangan dan pengulangan 3 Encapsulation, Overloading 4 Array of Object 5 Inheritance 6 Polymorphism 7 (TBA) UTS
Materi Perkuliahan cont. Minggu Materi 8 Advanced class 9 Abstract class 10 Interface 11 Exception 12 Package, Packaging & (Java Swing)* 13 Presentasi tugas besar 14 Review UAS
Java Release Sun Microsystem Oracle Java 2 Standard Edition (J2SE) JSE Java 2 Enterprise Edition (J2EE) JEE Java 2 Micro Edition (J2ME) JME
Java Certification Path Oracle Certified Associate Oracle Certified Proffesional Oracle Certified Master
HelloWorld
Object Oriented Objek Seluruh benda di sekitar Anda Benda memiliki state dan behaviour Dogs: state (name, color, breed) dan behaviour (barking, wagging tail) Sepeda: state (current gear, current speed) dan behaviour (changing gear, applying brakes) Mengidentifikasi state dan behaviour adalah langkah awal dan terbaik dalam cara berpikir OO
Object Oriented cont. Objek software Memiliki konsep yang sama dengan objek di dunia nyata Menyimpan state pada fields / variable Menggunakan method / function untuk mengekspresikan behaviour Method akan beroperasi pada state dan merupakan mekanisme utama dalam komunikasi antar objek
Object Oriented cont.
Object Oriented cont. Dalam dunia nyata banyak objek yang sama Cnth: terdapat jutaan sepeda yang masing-masing sepeda dibuat dari blueprint yang sama Dalam OO, sepeda yang dimiliki merupakan instance dari class bernama Bicycle
Object Oriented cont.
Object Oriented cont.
Konsep OO 1. Enkapsulasi 2. Inheritance (pewarisan) 3. Polymorphism
Enkapsulasi Pembungkusan atribut dan method public protected private default access modifier
Inheritance Pewarisan atribut dan method dari sebuah class ke class lainnya Keywords: extends
Polymorphism Kemampuan sebuah objek untuk memiliki lebih dari satu bentuk
Java Programming Rules Class name = File name HelloWorld HelloWorld.java Case sensitive Class name tidak diawali angka dan tidak terdapat Akhir baris perintah gunakan semicolon (;)
Java Naming Rules Class Type Rules Example Nama class harus merupakan kata benda. Jika nama class terdiri dari dua kata atau lebih, maka setiap huruf dari kata tersebut akan menjadi huruf besar class Person class ImageSprite Interface Sama seperti class interface Storing Method Penamaan method menggunakan kata kerja. Jika terdiri dari dua kata atau lebih, gunakan camelcase run() getpersonname() getbackground()
Java Naming Rules cont. Type Rules Example Variable Constant Cara penamaan untuk variable menggunakan camelcase. Gunakan nama yang pendek namun mencerminkan arti / kegunaan. Penamaan konstanta seluruhnya menggunakan huruf besar dan jika terdiri dari dua atau lebih kata, dipisahkan menggunakan _ int myage double personheight int MIN_WIDTH = 4
Java Primitive Data Type Type Bits Byte s Minimum Range byte 8 1-128 or -2 7 127 or 2 7-1 Maximum Range short 16 2-32,768 or -2 15 32,767 or 215-1 int 32 4-2,147,483,648 or -2 31 2,147,483,647 or 2 31-1 long 64 8-2 63 2 63-1 float 32 4-3.4E38 3.4E38 double 64 8-1.7E308 1.7E308 char 16 2 n/a n/a boolean 8 1 n/a n/a
String Data Type Not primitive data reference Berisi karakter angka, numeric, karakter khusus Menggabungkan string gunakan +
Arithmetic Operator Operator Name Description + Addition Add two operands - Substraction Subtract the right operand from the left * Multiplication Multiplies the right operand and left operand / Division Divides the right operand into the left operand
Arithmetic Operator cont. Operator Name Description % Modulus Returns the value that is left over after dividing the right operand into the left operand ++ Increment Adds 1 to the operand (x = x + 1) -- Decrement Subtract 1 from the operand (x = x 1) - Negative sign Change a positive value to negatif and vice versa
Assignment Operator Operator Name Description = Assignment Assign a new value to the variable += Addition Adds the operand to the starting variable value of the variable and assigns the result to the variable -= Substraction Substracts the operand from the starting value of the variable and assigns the result to the variable
Assignment Operator cont. Operator Name Description *= Multiplication Multiplies the operand by the starting value of the variable and assigns the result to the variable /= Division Divides the operand by the starting value of the variable and assigns the result to the variable %= Modulus Derives the value that is left over after dividing the right operand by the value in the variable, and then assigns this value to the variable
Boolean Expression Operator Name Description == Equality Returns a true value if both operands are equal!= Inequality Returns a true value if the left and right operands are not equal > Greater than Returns a true value if the left operand is greater than the right operand
Boolean Expression cont. Operator Name Description >= Greater than or equal Returns a true if the left operand is greater than or equal to the right operand < Less than Returns a true value if the left operand is less than the right operand <= Less than or equal Returns a true value if the left operand is less or equal to than the right operand
Question