Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

Software Engineering: Process Romi Satria Wahono +6281586220090.

Presentasi serupa

Presentasi berjudul: "Software Engineering: Process Romi Satria Wahono +6281586220090."— Transcript presentasi:

1 Software Engineering: Process Romi Satria Wahono

2  SD Sompok Semarang (1987)  SMPN 8 Semarang (1990)  SMA Taruna Nusantara, Magelang (1993)  B.Eng, M.Eng and Ph.D in Software Engineering from Saitama University Japan ( ) Universiti Teknikal Malaysia Melaka (2014)  Research Interests: Software Engineering, Intelligent Systems  Founder dan Koordinator IlmuKomputer.Com  Peneliti LIPI ( )  Founder dan CEO PT Brainmatics Cipta Informatika Romi Satria Wahono

3 Course Contents Introduction to Software Engineering 1.What is Software 2.What is Software Engineering 3.Discipline and Curriculum of Software Engineering 2.Software Engineering Profession 1.Profession, Ethics and Certification 2.Software Industry and Market 3.Internet Business Model and Trends

4 Course Contents Software Engineering Process 1.Software Development Life Cycle (SDLC) 2.Software Development Methodologies 3.Software Development Notation (UML) and Tools 4.Object-Oriented Paradigm 4.Software Construction 1.Software Construction Process 2.Estimating the Size of Software Project

5 Course Contents Software Quality Assurance 1.The Uniqueness of Software Quality Assurance 2.What is Software Quality 3.Software Quality Factor 4.Software Testing 6.Software Engineering Research 1.Computing Research Methodology 2.Research Trends in Software Engineering 3.Case Study: Developing Research Proposal in Software Engineering Field

6 Software Engineering Process

7 Contents 1.Software Development Life Cycle (SDLC) 2.Software Development Methodologies 3.Software Development Notation and Tools 4.Object-Oriented Paradigm

8 1. Systems Development Life Cycle (SDLC)

9 Systems Development Life Cycle (SDLC)

10 Project Phases 1.Planning : Why build the system? System request, feasibility analysis, project size estimation 2.Analysis : Who, what, when, where will the system be? Requirement gathering, business process modeling 3.Design : How will the system work? Program design, user interface design, data design 4.Implementation : System construction and delivery System construction, testing, documentation and installation

11 Planning 1.Identifying business value (System Request) Lower costs Increase profits 2.Analyze feasibility Technical Feasibility Economic Feasibility Organizational Feasibility 3.Estimating the size of project (System Proposal)

12 Analysis 1.Requirement gathering by answering the questions: Who will use the system? What will the system do? When will it be used? 2.Investigate the current system 3.Identify possible improvements 4.Develop a concept for new system (Business Process Model)

13 Design 1.Program Design (UML Diagrams) What programs need to be written Exactly what each program will do 2.User Interface Design How users interact with system Forms / reports used by the system 3.Data Design (ER Diagrams) What data is to be stored What format the data will be in Where the data will be stored (System Specification)

14 Implementation  Construction New system is built and tested Often testing is the longest part  Testing Unit Testing Integration Testing System Testing User Acceptance Test  Installation Old system is turned off New system is turned on

15 Processes and Deliverables

16 SDLC and Deliverables

17 2. Systems Development Methodologies

18 What Is a Methodology?  A formalized approach to implementing the SDLC (series of steps and deliverables)  Writing code without a well-thought-out system request may work for small programs, but rarely works for large ones

19 Major Methodologies 1.Structured Design Waterfall method Parallel development 2.RAD Development Phased Development Prototyping Throw-away Prototyping 3.Agile Development Extreme Programming (XP) Scrum

20 Structured Design Methodology  Projects move methodically from one to the next step  Generally, a step is finished before the next one begins

21 Waterfall Method

22 Pros - Cons of the Waterfall Method Pros Cons Identifies systems requirements long before programming Begins, it minimizes change to the requirements as the project proceed (mature) Design must be specified on paper before programming begins Long time between system proposal and delivery of new system Rework is very hard

23 Parallel Development  Addresses problem of time gap between proposal and delivery  General process: 1.Breaks project into parallel subproject 2.Integrates them at the end

24 Parallel Development

25 Rapid Application Development 1.Phased development A series of versions 2.Prototyping System prototyping 3.Throw-away prototyping Design prototyping

26 Rapid Application Development Critical elements to speed up the SDLC: CASE tools Visual programming languages Code generators

27 RAD: Phased Development  Break overall system into a series of versions  Each version has Analysis, Design, and Implementation  Output from on version is the input to the next  Incorporate ideas, issues, lessons learned in one version into the next version


29 RAD: Phased Development ProsCons Gets useful system to users quickly Most important functions tested most Initial system is intentionally incomplete System requirements expand as users see versions

30 RAD: Prototyping  Analysis, Design, Implementation are performed concurrently  Start with a "quick-and-dirty" prototype Provides minimal functionality  Repeat process, refining the prototype each time  Stop when prototype is a working system

31 RAD: Prototyping

32 ProsCons Gets working system to users quickly Fast paced. Hard to conduct careful, methodical analysis Reassures users that the project is progressing Quickly refines true requirements Initial design decisions have long term staying power Problems may come to light late in design, requiring re-design

33 RAD: Throw-Away Prototyping  Use prototypes only to understand requirements Example: use html to show UI  Prototype is not a working design  Once requirements are understood, the prototypes are thrown away  The system is then built using SDLC

34 RAD: Throw-Away Prototyping

35 Agile Development  Just a few rules that are easy to learn and follow  Streamline the SDLC Eliminate much of the modeling and documentation Emphasize simple, iterative application development  Examples include: Extreme Programming (XP) Scrum Dynamic Systems Development Model (DSDM)

36 Extreme Programming (XP) “Core Values” of XP 1.Communication – All to All 2.Simplicity – KISS, refactoring 3.Feedback – Embrace Change 4.Courage – Quality First, test and efficient coding

37 Extreme Programming (XP)

38 Scrum  Together with a user, the project members form a Scrum Team consisting of 5–9 people  During discussions with the Product Owner, the goal of the Sprint is determined and the prioritized functionality is broken down into detailed tasks  The team is self-organized and the members have a joint responsibility for the results  Each Sprint enhances the product’s market value and adds new functions and improvements that can be delivered to the customer

39 Scrum





44 XP vs Scrum vs Lean  XP deals with how to work with programming  Scrum deals with how the project is organized and planned  Lean Development deals with which comprehensive principles should apply for the entire development organization

45 Selecting the Right Methodology 1.Clarity of User Requirements 2.Familiarity with Technology 3.System Complexity 4.System Reliability 5.Short Time Schedules 6.Schedule Visibility

46 Selecting the Right Methodology

47 Exercise: Selecting Methodology Suppose you are an analyst for the Roanoke Software Consulting Company (RSCC), a large consulting firm with offices around the world. The company wants to build a new knowledge management system that can identify and track the expertise of individual consultants anywhere in the world based on their education and the various consulting projects on which they have worked. Assume that this is a new idea that never done before been attempted in RSCC or elsewhere. RSCC has an international network, but the offices in each country may use somewhat different hardware and software. RSCC management wants the system up and running within a year.

48 3. Software Development Notation and Tools

49 Analysis Design Paradigm and Diagrams 1.Data-oriented  DFD 2.Process-oriented  Flowchart 3.Object-oriented (data + process)  UML

50 Sejarah UML  In the 90s many people creating OO diagramming languages  Three different ones created by Grady Booch, Ivar Jacobson, James Rumbaugh  Joined forces with Rational (company) to create Unified Modeling Langauge (UML) Booch, Jacobson, Rumbaugh

51 Sejarah UML 2011  UML 2.4

52 What is the UML?  UML: Unified Modeling Language  UML can be used for modeling all processes in the development life cycle and across different implementation technologies (technology and language independent)  UML is the standard language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system  UML is a communication tool – for the team, and other stakeholders

53 Why Modeling? Modeling captures essential parts of the system (James Rumbaugh) Business Process Computer System Visual Modeling is modeling using standard graphical notations

54 The Triangle of Success in Software Dev. Notation : Standard Tools : Support Standard and Process Process : Customer- Oriented Methodology

55 UML Tools  Rational Rose  Visual Paradigm  Enterprise Architect  Microsoft Visio  Star UML  Netbeans UML Plugin

56 UML Diagrams Actor A Use Case 1 Use Case 2 Actor B user : Clerk mainWnd : MainWnd fileMgr : FileMgr repository : Repository document : Document gFile : GrpFile 9: sortByName ( ) L 1: Doc view request ( ) 2: fetchDoc( ) 5: readDoc ( ) 7: readFile ( ) 3: create ( ) 6: fillDocument ( ) 4: create ( ) 8: fillFile ( ) Window95 Window95 ¹®¼­°ü¸® Ŭ¶óÀ̾ðÆ®.EXE Windows Windows NT ¹®¼­°ü¸® ¿£Áø.EXE Windows NT Windows95 Solaris ÀÀ¿ë¼­¹ö.EXE Alpha Alpha UNIX IBM IBM Mainframe µ¥ÀÌŸº£À̽º¼­¹ö Windows95 ¹®¼­°ü¸® ¾ÖÇø´ Document FileManager GraphicFile File RepositoryDocumentListFileList user mainWnd fileMgr : FileMgr repository document : Document gFile 1: Doc view request ( ) 2: fetchDoc( ) 3: create ( ) 4: create ( ) 5: readDoc ( ) 6: fillDocument ( ) 7: readFile ( ) 8: fillFile ( ) 9: sortByName ( ) ƯÁ¤¹®¼­¿¡ ´ëÇÑ º¸±â¸¦ »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù. È­ÀÏ°ü¸®ÀÚ´Â Àоî¿Â ¹®¼­ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼­ °´Ã¼¿¡ ¼³Á¤À» ¿äûÇÑ´Ù. È­¸é °´Ã¼´Â ÀоîµéÀÎ °´Ã¼µé¿¡ ´ëÇØ À̸§º°·Î Á¤·ÄÀ» ½ÃÄÑ È­¸é¿¡ º¸¿©ÁØ´Ù. Forward and Reverse Engineering TargetSystem Use Case 3 Use-Case Diagram Class Diagram Collaboration Diagram Sequence Diagram Component Diagram Statechart Diagram Deployment Diagram

57 UML 2.0 UML version 2.0 has 14 diagrams in 2 major groups: 1.Structure Diagrams 2.Behavior Diagrams

58 UML 2.0 Diagram

59 UML Structure Diagrams Represent the data and static relationships in an information system 1.Class Diagram 2.Object Diagram 3.Package Diagram 4.Deployment Diagram 5.Component Diagram 6.Composite Structure Diagram

60 Structure Diagrams 1.Class Diagrams Common vocabulary used by analyst and users Represent things (employee, paycheck,…) Shows the relationships between classes 2.Object Diagrams Similar to class diagrams Instantiation of a class diagram Relationships between objects 3.Package Diagrams Group UML elements together to form higher level constructs

61 Structure Diagrams 4.Deployment Diagrams Shows the physical architecture and software components of system For example, network nodes 5.Component Diagrams Physical relationships among software components Example – Client/Server (Which machines run which software) 6.Composite Structure Illustrates internal structure of a complex class

62 UML Behavior Diagrams Depict the dynamic relationships among the instances or objects that represent the business information system 1.Activity Diagram 2.Sequence Diagram 3.Communication Diagram 4.Interaction Diagram 5.Timing Diagram 6.Behavior State Machine 7.Protocol State Machine 8.Use Case Diagrams

63 Behavior Diagrams 1.Activity Diagrams Model processes in an information system Example: Business workflows, business logic 2.Interaction Diagrams Shows interaction among objects 3.Sequence Diagrams Time-based ordering of the interaction 4.Communication Diagrams Communication among a set of collaborating objects of an activity

64 Behavior Diagrams 5.Interaction Diagrams Overview of flow of control of a process 6.Timing Diagrams Show how an object changes over time 7.State Machines Examines behavior of one class Models the different states and state transitions an object can experience 8.Use-Case Diagrams Shows interaction between the system and environment Captures business requirements

65 UML Problems  UML is modeling notation, it is not a development process or a methodology UML driven development process?  UML is too complex, difficult to understand quickly Should we use all UML diagrams?

66 UML Process (EA Sparx) 1.Display the boundary of a system and its major functions using use cases and actors 2.Model the organization’s business process with activity diagram 3.Illustrate use case realizations with sequence diagrams 4.Represent a static structure of a system using class diagrams 5.Reveal the physical implementation architecture with deployment diagrams

67 UML Process (EA Sparx) 1.Use Cases Diagram 2.Activity Diagram 3.Sequence Diagram 4.Class Diagram 5.Deployment Diagrams

68 UML Process (Kendal, 2011) 1.A use case diagram, describing how the system is used. Analysts start with a use case diagram 2.An activity diagram, illustrating the overall flow of activities. Each use case may create one activity diagram 3.Sequence diagrams, showing the sequence of activities and class relationships. Each use case may create one or more sequence diagrams 4.Class diagrams, showing the classes and relationships. Sequence diagrams are used to determine classes 5.Statechart diagrams, showing the state transitions. Each class may create a statechart diagram, which is useful for determining class methods

69 (Kendall and Kendall, 2011)

70 UML Process (Barclay, 2004)

71 System Analysis and Design with UML 1.System Analysis 1.Business Process Identification  Use Case Diagram 2.Business Process Modeling  Activity Diagram or Business Process Modeling Notation (BPMN) 3.Business Process Realization  Sequence Diagram (Buat untuk setiap use case dengan menggunakan pola Boundary-Control-Entity) 2.System Design 1.Program Design 1.Class Diagram (Gabungkan Boundary-Control-Entity Class dan susun story dari sistem yang dibangun) 2.Package Diagram (Gabungan class yang sesuai, boleh menggunakan pola B-C-E) 3.Deployment Diagram (arsitektur software dari sistem yang dibangun) 2.User Interface Design (Buat UI design dari Boundary Class) 3.Entity-Relationship Model (Buat ER diagram dari Entity Class)

72 Case Study: ATM System

73 ATM System

74 Layar Kotak Uang Kotak Kartu Kotak Kuitansi

75 Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi

76 Menu Utama 1. 1.Melihat Saldo 2. 2.Mentransfer Uang 3. 3.Mengambil Uang 4. 4.Logout Kotak Uang Kotak Kartu Kotak Kuitansi

77 Menu Melihat Saldo 1. 1.Saldo anda adalah …. Kotak Uang Kotak Kartu Kotak Kuitansi

78 Menu Mentransfer Uang 1. 1.No Account Penerima: Kotak Uang Kotak Kartu Kotak Kuitansi

79 Menu Mentransfer Uang 1. 1.Jumlah uang yang dikirim: Kotak Uang Kotak Kartu Kotak Kuitansi

80 Menu Mentransfer Uang 1. 1.Uang berhasil terkirim Kotak Uang Kotak Kartu Kotak Kuitansi

81 Menu Mengambil Uang 1. 1.Jumlah uang yang diambil: Kotak Uang Kotak Kartu Kotak Kuitansi

82 Menu Mengambil Uang Uang berhasil diambil Kotak Uang Kotak Kartu Kotak Kuitansi

83 Use Case Diagram

84 Use Case Diagram (Alternatif)

85 Activity Diagram: Memasukkan Kartu

86 Activity Diagram: Memasukkan PIN

87 Activity Diagram: Mengecek Saldo

88 Activity Diagram: Mentransfer Uang

89 Activity Diagram: Mengambil Uang

90 Activity Diagram: Melakukan Logout

91 Sequence Diagram: Memasukkan Kartu

92 Type of Class 1.Boundary Class Class yang berhubungan dengan actor (user interface) 2.Control Class Class yang berhubungan dengan pemrosesan, komputasi, penghitungan, dsb 3.Entity Class Class yang berhubungan dengan data (flat file or database)

93 Sequence Diagram: Memasukkan PIN

94 Sequence Diagram: Mengecek Saldo

95 Sequence Diagram: Mentransfer Uang

96 Sequence Diagram: Mengambil Uang

97 Sequence Diagram: Melakukan Logout

98 Class Diagram

99 Deployment Diagram (2 Tier)

100 Data Model

101 User Interface Design

102 User Interface Design (Netbeans)

103 4. Object-Oriented Paradigm

104 Class, Object, Method, Attribute Konsep Dasar Pemrograman Berorientasi Objek

105 Berorientasi Objek? Attribute: Topi, Baju, Jaket, Tas Punggung, Tangan, Kaki, Mata Behavior: Cara Jalan ke Depan Cara Jalan Mundur Cara Belok ke Kiri Cara Memanjat

106 Berorientasi Objek? Attribute (State): Ban, Stir, Pedal Rem, Pedal Gas, Warna, Tahun Produksi Behavior: Cara Menghidupkan Mesin Cara Manjalankan Mobil Cara Memundurkan Mobil Attribute  Variable(Member) Behavior  Method(Fungsi)

107 Perbedaan Class dan Object  Class: konsep dan deskripsi dari sesuatu Class mendeklarasikan method yang dapat digunakan (dipanggil) oleh object  Object: instance dari class, bentuk (contoh) nyata dari class Object memiliki sifat independen dan dapat digunakan untuk memanggil method  Contoh Class dan Object: Class: mobil Object: mobilnya pak Joko, mobilku, mobil berwarna merah

108 Perbedaan Class dan Object  Class seperti cetakan kue, dimana kue yg dihasilkan dari cetakan kue itu adalah object  Warna kue bisa bermacam-macam meskipun berasal dari cetakan yang sama (object memiliki sifat independen)

109 Class = Method + Variable variable kecepatan gir tampilkan kecepatan ubah gir method Class Sepeda

110 Object = Method + Variable yg Memiliki Nilai instance variable kecepatan = 10km/jam gir = 3 tampilkan kecepatan () kecepatan = 10 km/jam ubah gir (2) gir = 5 instance method Object Sepedaku

111 Attribute  Variable yang mengitari class, dengan nilai datanya bisa ditentukan di object  Variable digunakan untuk menyimpan nilai yang nantinya akan digunakan pada program  Variable memiliki jenis (tipe), nama dan nilai  Name, age, dan weight adalah atribute (variabel) dari class Person

112 Membuat Class, Object dan Memanggil Atribut public class Mobil { String warna; int tahunProduksi; } public class MobilBeraksi{ public static void main(String[] args){ // Membuat object Mobil mobilku = new Mobil(); /* memanggil atribut dan memberi nilai */ mobilku.warna = "Hitam"; mobilku.tahunProduksi = 2006; System.out.println("Warna: " + mobilku.warna); System.out.println("Tahun: " + mobilku.tahunProduksi); }

113 Latihan: Membuat Program dg Netbeans 1.Buka Netbeans IDE 2.Ikuti langkah berikut










123 Method  Method adalah urutan instruksi yang mengakses data dari object  Method melakukan: 1.Manipulasi data 2.Perhitungan matematika 3.Memonitor kejadian dari suatu event

124 Method

125 Membuat dan Memanggil Method public class Mobil2{ String warna; int tahunProduksi; void printMobil(){ System.out.println("Warna: " + warna); System.out.println("Tahun: " + tahunProduksi); } public class Mobil2Beraksi{ public static void main(String[] args){ Mobil2 mobilku = new Mobil2(); mobilku.warna = "Hitam"; mobilku.tahunProduksi = 2006; mobilku.printMobil(); }

126 Latihan  Buat class Handphone yang berisi empat method: 1.hidupkan() 2.lakukanPanggilan() 3.kirimSMS() 4.matikan() Isi masing-masing method dengan tampilan status menggunakan System.out.println()  Buat class HandphoneBeraksi, dan panggil method-method diatas dalam class tersebut

127 Latihan: Hasil Tampilan Handphone hidup … Kring, kring, kring … panggilan dilakukan Dung, dung … sms berhasil terkirim Handphone mati …

128 Jenis Method: Mutator dan Accessor

129 Parameter  Sepeda akan berguna apabila ada object lain yang berinterasi dengan sepeda tersebut  Object software berinteraksi dan berkomunikasi dengan object lain dengan cara mengirimkan message atau pesan  Pesan adalah suatu method, dan informasi dalam pesan dikenal dengan nama parameter

130 Pengiriman Pesan dan Parameter 1. 1.You  object pengirim 2. 2.YourBicycle  object penerima 3. 3.changeGears  pesan berupa method yang dijalankan 4. 4.lowerGear  parameter yang dibutuhkan method (pesan) untuk dijalankan


132 public class Sepeda{ int gir; // method (mutator) dengan parameter void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } // method (accessor) int getGir() { return gir; }

133 public class SepedaBeraksi{ public static void main(String[] args) { // Membuat object Sepeda sepedaku = new Sepeda(); // Memanggil method dan menunjuk nilai parameter sepedaku.setGir(1); // menset nilai gir = 1 System.out.println(“Gir saat ini: “ + sepedaku.getGir()); sepedaku.setGir(3); // menambahkan 3 pada posisi gir saat ini (1) System.out.println(“Gir saat ini: “ + sepedaku.getGir()); }

134 Latihan: Class Matematika dan Parameter  Buat Class bernama Matematika, yang berisi method dengan dua parameter: pertambahan(int a, int b) pengurangan(int a, int b) perkalian(int a, int b) pembagian(int a, int b)  Buat Class bernama MatematikaBeraksi, yang mengeksekusi method dan menampilkan: Pertambahan: = 40 Pengurangan: 10-5 = 5 Perkalian: 10*20 = 200 Pembagian: 21/2 = 10

135 Variasi Tampilan pertambahan(int a, int b){ System.out.println(a + “ + “ + b + “ = “ + (a+b)) } pertambahan(int a, int b){ System.out.println(“Hasil = “ + (a+b)) } pertambahan(int a, int b){ int hasil = a + b; System.out.println(“Hasil = “ + hasil) }

136 Konstruktor -1-  Method yang digunakan untuk memberi nilai awal pada saat object diciptakan  Dipanggil secara otomatis ketika new digunakan untuk membuat instan class  Sifat konstruktor: Nama konstruktor sama dengan nama class Tidak memiliki nilai balik dan tidak boleh ada kata kunci void

137 Konstruktor -2- public class Mobil { String warna; int tahunProduksi; public Mobil(String warna, int tahunProduksi){ this.warna = warna; this.tahunProduksi = tahunProduksi; } public void info(){ System.out.println("Warna: " + warna); System.out.println("Tahun: " + tahunProduksi); } public class MobilKonstruktor{ public static void main(String[] args){ Mobil mobilku = new Mobil(“Merah”, 2003);; }

138 Kata Kunci this Digunakan pada pembuatan class dan digunakan untuk menyatakan object sekarang public class Mobil{ String warna; int tahunProduksi; void isiData(String aWarna, int aTahunProduksi){ warna = aWarna; tahunProduksi = aTahunProduksi; } public class Mobil{ String warna; int tahunProduksi; void isiData(String warna, int tahunProduksi){ this.warna = warna; this.tahunProduksi = tahunProduksi; }

139 Latihan 1.Buat class Bank Buat konstruktor class Bank dengan parameter: saldo Buat method: simpanUang, ambilUang, dan getSaldo 2.Buat class BankBeraksi, tetapkan saldo awal lewat konstruktur Rp , jalankan 3 method di atas, dan tampilkan proses sebagai berikut: Selamat Datang di Bank ABC Saldo awal: Rp Simpan uang: Rp Saldo saat ini: Rp Ambil uang: Rp Saldo saat ini: Rp

140 Abstraction, Encapsulation, Inheritance, Polymorphism Karakteristik Pemrograman Berorientasi Objek

141 Abstraction  Cara kita melihat suatu sistem dalam bentuk yang lebih sederhana, yaitu sebagai suatu kumpulan subsistem (object) yang saling berinteraksi. Mobil adalah kumpulan sistem pengapian, sistem kemudi, sistem pengereman  Alat meng-abstraksikan sesuatu adalah class  Object bersifat modularity. Object dapat ditulis dan dimaintain terpisah (independen) dari object lain



144 Encapsulation  Mekanisme menyembunyikan suatu proses dan data dalam sistem untuk menghindari interferensi, dan menyederhanakan penggunaan proses itu sendiri Tongkat transmisi (gigi) pada mobil Tombol on/off/pengaturan suhu pada AC  Class access level (public, protected, privat) adalah implementasi dari konsep encapsulation  Enkapsulasi data dapat dilakukan dengan cara: 1.mendeklarasikan instance variable sebagai private 2.mendeklarasikan method yang sifatnya public untuk mengakses variable tersebut


146 Encapsulation dan Access Modifier Modifier Dalam Class yang Sama Dalam Package yang Sama Dalam SubClass Dalam Package Lain private tanpa tanda protected public

147 Encapsulation  Enkapsulasi data juga dapat dilakukan dengan cara: 1.mendeklarasikan instance variable sebagai private 2.mendeklarasikan method yang sifatnya public untuk mengakses variable tersebut

148 public class Sepeda{ int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; }

149 public class SepedaBeraksi{ public static void main(String[] args) { Sepeda sepedaku = new Sepeda(); sepedaku.setGir(1); /* Variabel bisa diubah atau tidak sengaja diubah. Hal ini berbahaya dan sering menimbulkan bug. Berikan access modifier private pada instance variable */ sepedaku.gir = 3; System.out.println(“Gir saat ini: “ + sepedaku.getGir()); }

150 public class Sepeda{ private int gir; // access modifier private pada instance variable void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; }

151 Inheritance (Pewarisan)  Suatu class dapat mewariskan atribut dan method kepada class lain (subclass), serta membentuk class hierarchy  Penting untuk Reusability  Java Keyword: extends

152 public class Sepeda{ private int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; }

153 Class SepedaGunung Mewarisi Class Sepeda public class SepedaGunung extends Sepeda{ private int sadel; void setSadel (int jumlah) { sadel = getGir() - jumlah; } int getSadel(){ return sadel; } public class SepedaGunungBeraksi { public static void main(String[] args) { SepedaGunung sg=new SepedaGunung(); sg.setGir(3); System.out.println(sg.getGir()); sg.setSadel(1); System.out.println( sg.getSadel()); }

154 Latihan: Inheritance Matematika 1.Buat class MatematikaCanggih yang merupakan inherit dari class Matematika 1.Tambahkan method modulus(int a, int b) yang menghitung modulus dari a dan b 2.Operator modulus adalah % 2.Buat class MatematikaCanggihBeraksi yang memanggil method pertambahan, perkalian dan modulus

155 Polymorphism  Kemampuan untuk memperlakukan object yang memiliki perilaku (bentuk) yang berbeda  Implementasi konsep polymorphism: 1.Overloading: Kemampuan untuk menggunakan nama yang sama untuk beberapa method yang berbeda parameter (tipe dan atau jumlah) 2.Overriding: Kemampuan subclass untuk menimpa method dari superclass, yaitu dengan cara menggunakan nama dan parameter yang sama pada method

156 Polymorphism – Overloading class Mobil { String warna; int tahunProduksi; public Mobil(String warna, int tahunProduksi){ this.warna = warna; this.tahunProduksi = tahunProduksi; } public Mobil(){ } void info(){ System.out.println("Warna: " + warna); System.out.println("Tahun: " + tahunProduksi); } public class MobilKonstruktor{ public static void main(String[] args){ Mobil mobilku = new Mobil(“Merah”, 2003);; Mobil mobilmu = new Mobil();; }

157 Polymorphism – Overloading class Lingkaran{ void gambarLingkaran(){ } void gambarLingkaran(int diameter){... } void gambarLingkaran(int diameter, int x, int y){... } void gambarLingkaran(int diameter, int x, int y, int warna, String namaLingkaran){... }

158 Polymorphism - Overriding public class Sepeda{ protected int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; }

159 Polymorphism - Overriding public class SepedaGunung extends Sepeda{ void setGir(int pertambahanGir) { super.setGir(pertambahanGir); gir = 2*getGir(); } public class SepedaGunungBeraksi { public static void main(String[] args) { SepedaGunung sg=new SepedaGunung(); sg.setGir(2); System.out.println(sg.getGir()); sg.setGir(3); System.out.println(sg.getGir()); }

160 Latihan: Overloading pada Matematika 1.Kembangkan class Matematika, MatematikaCanggih dan MatematikaBeraksi 2.Lakukan overloading pada Method yang ada (pertambahan, pengurangan, perkalian, pembagian, modulus) 3.Tambahkan method baru bertipe data double (pecahan) dan memiliki 3 parameter: double a, double b, double c 4.Uji di kelas MatematikaBeraksi dengan parameter pecahan: 12.5, 28.7, Misalnya: pertambahan(12.5, 28.7, 14.2) pertambahan(12, 28, 14) pertambahan(23, 34) pertambahan(3.4, 4.9)

161 public class Matematika{ void pertambahan (int a, int b){ int hasil= a + b; System.out.println(“hasil:” + hasil); } void pertambahan (double a, double b, double c){ int hasil= a + b + c; System.out.println(“hasil:” + hasil); }... }

162 Referensi (Foundation)  Roger S. Pressman, Software Engineering: A Practitioner’s Approach Sevent Edition, McGraw-Hill, 2009  Ian Sommerville, Software Engineering 9th Edition, Addison-Wesley, 2010  Albert Endres dan Dieter Rombach, A Handbook of Software and Systems Engineering, Pearson Education Limited, 2003  Yingxu Wang, Software Engineering Foundations: A Software Science Perspective, Auerbach Publications, Taylor & Francis Group, 2008  Guide to the Software Engineering Body of Knowledge 2004 Version (SWEBOK), IEEE Computer Society, 2004

163 Referensi (Process)  Alan Dennis et al, Systems Analysis and Design with UML – 3 rd Edition, John Wiley and Sons, 2010  Dan Pilone and Russ Miles, Head First Software Development, O’Reilly Media, 2008  Barclay and Savage, Object-Oriented Design with UML and Java, Elsevier, 2004  Paul Kimmel, UML Demystified, McGraw-Hill, 2005  Kim Hamilton and Russell Miles, Learning UML 2.0, O'Reilly, 2006  Howard Podeswa, UML for the IT Business Analyst, Course Technology, 2009  Deloitte, Business Process Modeling – Basic Guideline and Tips, 2008

164 Referensi (Quality Assurance)  Daniel Galin, Software Quality Assurance, Addison- Wesley, 2004  Jeff Tian, Software Quality Engineering, John Wiley & Sons, Inc., 2005  G. Gordon Schulmeyer, Handbook of Software Quality Assurance Fourth Edition, Artech House, 2008  Kshirasagar Naik and Priyadarshi Tripathy, Software Testing and Quality Assurance, John Wiley & Sons, Inc., 2008

Download ppt "Software Engineering: Process Romi Satria Wahono +6281586220090."

Presentasi serupa

Iklan oleh Google