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 +6281586220090

2  SD Sompok Semarang (1987)  SMPN 8 Semarang (1990)  SMA Taruna Nusantara, Magelang (1993)  S1, S2 dan S3 (on-leave) Department of Computer Sciences Saitama University, Japan (1994-2004)  Research Interests: Software Engineering, Intelligent Systems  Founder dan Koordinator IlmuKomputer.Com  Peneliti LIPI (2004-2007)  Founder dan CEO PT Brainmatics Cipta Informatika Romi Satria Wahono

3 Course Contents -1- 1.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 -2- 3.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 -3- 5.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) 1.User Stories about system do 2.Code small program using defined standards Naming conventions Coding practices 3.User Feedback 4.Repeat

38 Extreme Programming (XP)

39 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

40 Selecting the Right Methodology

41 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.

42 3. Software Development Notation and Tools

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

44 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

45 Sejarah UML 2011  UML 2.4

46 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

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

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

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

50 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

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

52 UML 2.0 Diagram

53 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

54 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

55 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

56 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

57 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

58 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

59 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?

60 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

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

62 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

63 (Kendall and Kendall, 2011)

64 UML Process (Barclay, 2004)

65 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)

66 Case Study: ATM System

67 ATM System

68 Layar Kotak Uang Kotak Kartu Kotak Kuitansi

69 Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi

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

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

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

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

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

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

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

77 Use Case Diagram

78 Use Case Diagram (Alternatif)

79 Activity Diagram: Memasukkan Kartu

80 Activity Diagram: Memasukkan PIN

81 Activity Diagram: Mengecek Saldo

82 Activity Diagram: Mentransfer Uang

83 Activity Diagram: Mengambil Uang

84 Activity Diagram: Melakukan Logout

85 Sequence Diagram: Memasukkan Kartu

86 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)

87 Sequence Diagram: Memasukkan PIN

88 Sequence Diagram: Mengecek Saldo

89 Sequence Diagram: Mentransfer Uang

90 Sequence Diagram: Mengambil Uang

91 Sequence Diagram: Melakukan Logout

92 Class Diagram

93 Deployment Diagram (2 Tier)

94 Data Model

95 User Interface Design

96 User Interface Design (Netbeans)

97 4. Object-Oriented Paradigm

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

99 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

100 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)

101 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

102 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)

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

104 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

105 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

106 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); }

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










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

118 Method

119 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(); }

120 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

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

122 Jenis Method: Mutator dan Accessor

123 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

124 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


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

127 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()); }

128 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: 20 + 20 = 40 Pengurangan: 10-5 = 5 Perkalian: 10*20 = 200 Pembagian: 21/2 = 10

129 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) }

130 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

131 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);; }

132 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; }

133 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. 100000, jalankan 3 method di atas, dan tampilkan proses sebagai berikut: Selamat Datang di Bank ABC Saldo awal: Rp. 100000 Simpan uang: Rp. 500000 Saldo saat ini: Rp. 600000 Ambil uang: Rp. 150000 Saldo saat ini: Rp. 450000

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

135 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



138 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


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

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

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

143 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()); }

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

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

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

147 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()); }

148 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

149 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

150 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();; }

151 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){... }

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

153 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()); }

154 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, 14.2 5.Misalnya: pertambahan(12.5, 28.7, 14.2) pertambahan(12, 28, 14) pertambahan(23, 34) pertambahan(3.4, 4.9)

155 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); }... }

156 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

157 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

158 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