Software Engineering: Process Romi Satria Wahono romi@romisatriawahono.net http://romisatriawahono.net +6281586220090
Romi Satria Wahono SD Sompok Semarang (1987) SMPN 8 Semarang (1990) romi@romisatriawahono.net Object-Oriented Programming Romi Satria Wahono 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 (1994-2004) Universiti Teknikal Malaysia Melaka (2014) Research Interests: Software Engineering, Intelligent Systems Founder dan Koordinator IlmuKomputer.Com Peneliti LIPI (2004-2007) Founder dan CEO PT Brainmatics Cipta Informatika http://romisatriawahono.net
Course Contents -1- Introduction to Software Engineering What is Software What is Software Engineering Discipline and Curriculum of Software Engineering Software Engineering Profession Profession, Ethics and Certification Software Industry and Market Internet Business Model and Trends
Course Contents -2- Software Engineering Process Software Construction Software Development Life Cycle (SDLC) Software Development Methodologies Software Development Notation (UML) and Tools Object-Oriented Paradigm Software Construction Software Construction Process Estimating the Size of Software Project
Course Contents -3- Software Quality Assurance The Uniqueness of Software Quality Assurance What is Software Quality Software Quality Factor Software Testing Software Engineering Research Computing Research Methodology Research Trends in Software Engineering Case Study: Developing Research Proposal in Software Engineering Field
Software Engineering Process
Contents Software Development Life Cycle (SDLC) Software Development Methodologies Software Development Notation and Tools Object-Oriented Paradigm
1. Systems Development Life Cycle (SDLC) romi@romisatriawahono.net Object-Oriented Programming 1. Systems Development Life Cycle (SDLC) http://romisatriawahono.net
Systems Development Life Cycle (SDLC) romi@romisatriawahono.net Object-Oriented Programming Systems Development Life Cycle (SDLC) Planning Analysis Design Implementation http://romisatriawahono.net
Project Phases Planning: Why build the system? romi@romisatriawahono.net Object-Oriented Programming Project Phases Planning: Why build the system? System request, feasibility analysis, project size estimation Analysis: Who, what, when, where will the system be? Requirement gathering, business process modeling Design: How will the system work? Program design, user interface design, data design Implementation: System construction and delivery System construction, testing, documentation and installation http://romisatriawahono.net
Planning Identifying business value (System Request) romi@romisatriawahono.net Object-Oriented Programming Planning Identifying business value (System Request) Lower costs Increase profits Analyze feasibility Technical Feasibility Economic Feasibility Organizational Feasibility Estimating the size of project (System Proposal) http://romisatriawahono.net
Analysis Requirement gathering by answering the questions: romi@romisatriawahono.net Object-Oriented Programming Analysis Requirement gathering by answering the questions: Who will use the system? What will the system do? When will it be used? Investigate the current system Identify possible improvements Develop a concept for new system (Business Process Model) http://romisatriawahono.net
Design (System Specification) Program Design (UML Diagrams) romi@romisatriawahono.net Object-Oriented Programming Design Program Design (UML Diagrams) What programs need to be written Exactly what each program will do User Interface Design How users interact with system Forms / reports used by the system 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) http://romisatriawahono.net
Implementation Construction Testing Installation romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Processes and Deliverables romi@romisatriawahono.net Object-Oriented Programming Processes and Deliverables Process Product Planning Analysis Design Implementation System Proposal System Specification New System with Testing/Maintenance Plan http://romisatriawahono.net
SDLC and Deliverables Planning Analysis (System Specification) romi@romisatriawahono.net Object-Oriented Programming SDLC and Deliverables Planning (System Proposal) Analysis (System Specification) Design (System Specification) Implementation (New System) http://romisatriawahono.net
2. Systems Development Methodologies romi@romisatriawahono.net Object-Oriented Programming 2. Systems Development Methodologies http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Major Methodologies Structured Design RAD Development romi@romisatriawahono.net Object-Oriented Programming Major Methodologies Structured Design Waterfall method Parallel development RAD Development Phased Development Prototyping Throw-away Prototyping Agile Development Extreme Programming (XP) Scrum http://romisatriawahono.net
Structured Design Methodology romi@romisatriawahono.net Object-Oriented Programming Structured Design Methodology Projects move methodically from one to the next step Generally, a step is finished before the next one begins http://romisatriawahono.net
Waterfall Method
Pros - Cons of the Waterfall Method romi@romisatriawahono.net Object-Oriented Programming Pros - Cons of the Waterfall Method Pros Cons Design must be specified on paper before programming begins Identifies systems requirements long before programming Begins, it minimizes change to the requirements as the project proceed (mature) Long time between system proposal and delivery of new system Rework is very hard http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Parallel Development Addresses problem of time gap between proposal and delivery General process: Breaks project into parallel subproject Integrates them at the end http://romisatriawahono.net
Parallel Development romi@romisatriawahono.net Object-Oriented Programming Parallel Development http://romisatriawahono.net
Rapid Application Development romi@romisatriawahono.net Object-Oriented Programming Rapid Application Development Phased development A series of versions Prototyping System prototyping Throw-away prototyping Design prototyping http://romisatriawahono.net
Rapid Application Development romi@romisatriawahono.net Object-Oriented Programming Rapid Application Development Critical elements to speed up the SDLC: CASE tools Visual programming languages Code generators http://romisatriawahono.net
RAD: Phased Development romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
RAD: Phased Development romi@romisatriawahono.net Object-Oriented Programming RAD: Phased Development Pros Cons Gets useful system to users quickly Most important functions tested most Initial system is intentionally incomplete System requirements expand as users see versions http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
RAD: Prototyping romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
RAD: Prototyping Pros Cons romi@romisatriawahono.net Object-Oriented Programming RAD: Prototyping Pros Cons Fast paced. Hard to conduct careful, methodical analysis Gets working system to users quickly Reassures users that the project is progressing Initial design decisions have long term staying power Problems may come to light late in design, requiring re-design Quickly refines true requirements http://romisatriawahono.net
RAD: Throw-Away Prototyping romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
RAD: Throw-Away Prototyping romi@romisatriawahono.net Object-Oriented Programming RAD: Throw-Away Prototyping http://romisatriawahono.net
Agile Development Just a few rules that are easy to learn and follow romi@romisatriawahono.net Object-Oriented Programming 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) http://romisatriawahono.net
Extreme Programming (XP) romi@romisatriawahono.net Object-Oriented Programming Extreme Programming (XP) “Core Values” of XP Communication – All to All Simplicity – KISS, refactoring Feedback – Embrace Change Courage – Quality First, test and efficient coding http://romisatriawahono.net
Extreme Programming (XP) romi@romisatriawahono.net Object-Oriented Programming Extreme Programming (XP) http://romisatriawahono.net
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
Scrum
Scrum
Scrum
Scrum
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
Selecting the Right Methodology romi@romisatriawahono.net Object-Oriented Programming Selecting the Right Methodology Clarity of User Requirements Familiarity with Technology System Complexity System Reliability Short Time Schedules Schedule Visibility http://romisatriawahono.net
Selecting the Right Methodology romi@romisatriawahono.net Object-Oriented Programming Selecting the Right Methodology http://romisatriawahono.net
Exercise: Selecting Methodology romi@romisatriawahono.net Object-Oriented Programming 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. http://romisatriawahono.net
3. Software Development Notation and Tools romi@romisatriawahono.net Object-Oriented Programming 3. Software Development Notation and Tools http://romisatriawahono.net
Analysis Design Paradigm and Diagrams Data-oriented DFD Process-oriented Flowchart Object-oriented (data + process) UML
Booch, Jacobson, Rumbaugh 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
Sejarah UML 2011 UML 2.4
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
Why Modeling? Business Process Computer System Modeling captures essential parts of the system (James Rumbaugh) Business Process Computer System Visual Modeling is modeling using standard graphical notations
The Triangle of Success in Software Dev. Notation: Standard Tools: Support Standard and Process Process: Customer-Oriented Methodology
UML Tools Rational Rose Visual Paradigm Enterprise Architect Microsoft Visio Star UML Netbeans UML Plugin
Collaboration Diagram Forward and Reverse Engineering UML Diagrams Use-Case Diagram Statechart Diagram The point to be made is that the UML is the langua ge we use to visuall y model. Since it is a widely adopte d standa rd, it facilitat es the unders tandin g and comm unicati on of the visual model s we create. Activity and object diagrams are not shown on this slide. These diagrams can be used to model workflows in business process engineering. Class Diagram Use Case 1 GrpFile read( ) open( ) create( ) fillFile( ) rep Repository name : char * = 0 readDoc( ) readFile( ) (from Persistence) FileMgr fetchDoc( ) sortByName( ) DocumentList add( ) delete( ) Document name : int docid : int numField : int get( ) close( ) sortFileList( ) fillDocument( ) fList 1 FileList File read() fill the code.. Actor A Actor B Use Case 2 Use Case 3 Deployment Diagram Collaboration Diagram 9: sortByName ( ) Document FileManager GraphicFile File Repository DocumentList FileList mainWnd : MainWnd Window95 Windows95 1: Doc view request ( ) Windows95 L 2: fetchDoc( ) 4: create ( ) gFile : GrpFile ¹®¼°ü¸® Ŭ¶óÀ̾ðÆ®.EXE ¹®¼°ü¸® ¾ÖÇø´ 8: fillFile ( ) Windows user : Clerk NT Solaris fileMgr : FileMgr ¹®¼°ü¸® ¿£Áø.EXE 6: fillDocument ( ) 3: create ( ) Alpha Windows UNIX NT ÀÀ¿ë¼¹ö.EXE 5: readDoc ( ) 7: readFile ( ) Mainframe IBM repository : Repository document : Document µ¥ÀÌŸº£À̽º¼¹ö Component Diagram mainWnd fileMgr : FileMgr document : Document gFile repository user Target System Visual modeling with the UML makes application architecture tangible, permitting us to assess it in multiple dimensions. How portable is it? Can it exploit expected advances in parallel processing? How can you modify it to support a family of applications? We have discussed the importance of architectural resilience and quality. The UML enables us to evaluate these key characteristics during early iterations — at a point when design defects can be corrected before threatening project success. Advances in forward and reverse engineering techniques permit changes to an application’s model to be reflected automatically in its source code, and changes to its source code to be automatically reflected in its model. This is critical when using an iterative process, in which we expect such changes with each iteration. »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù. ƯÁ¤¹®¼¿¡ ´ëÇÑ º¸±â¸¦ 1: Doc view request ( ) 2: fetchDoc( ) 3: create ( ) 4: create ( ) 5: readDoc ( ) ÈÀÏ°ü¸®ÀÚ´Â Àоî¿Â °´Ã¼¿¡ ¼³Á¤À» ¿äûÇÑ´Ù. ¹®¼ÀÇ Á¤º¸¸¦ ÇØ´ç ¹®¼ 6: fillDocument ( ) 7: readFile ( ) 8: fillFile ( ) Forward and Reverse Engineering °´Ã¼µé¿¡ ´ëÇØ À̸§º°·Î È¸é °´Ã¼´Â ÀоîµéÀÎ Á¤·ÄÀ» ½ÃÄÑ È¸é¿¡ º¸¿©ÁØ´Ù. 9: sortByName ( ) Sequence Diagram Module 1 - Best Practices of Software Engineering
UML 2.0 UML version 2.0 has 14 diagrams in 2 major groups: romi@romisatriawahono.net Object-Oriented Programming UML 2.0 UML version 2.0 has 14 diagrams in 2 major groups: Structure Diagrams Behavior Diagrams http://romisatriawahono.net
UML 2.0 Diagram
UML Structure Diagrams Represent the data and static relationships in an information system Class Diagram Object Diagram Package Diagram Deployment Diagram Component Diagram Composite Structure Diagram
Structure Diagrams Class Diagrams Object Diagrams Package Diagrams Common vocabulary used by analyst and users Represent things (employee, paycheck,…) Shows the relationships between classes Object Diagrams Similar to class diagrams Instantiation of a class diagram Relationships between objects Package Diagrams Group UML elements together to form higher level constructs
Structure Diagrams Deployment Diagrams Component Diagrams Shows the physical architecture and software components of system For example, network nodes Component Diagrams Physical relationships among software components Example – Client/Server (Which machines run which software) Composite Structure Illustrates internal structure of a complex class
UML Behavior Diagrams Depict the dynamic relationships among the instances or objects that represent the business information system Activity Diagram Timing Diagram Sequence Diagram Behavior State Machine Communication Diagram Protocol State Machine Interaction Diagram Use Case Diagrams
Behavior Diagrams Activity Diagrams Interaction Diagrams Model processes in an information system Example: Business workflows, business logic Interaction Diagrams Shows interaction among objects Sequence Diagrams Time-based ordering of the interaction Communication Diagrams Communication among a set of collaborating objects of an activity
Behavior Diagrams Interaction Diagrams Timing Diagrams State Machines Overview of flow of control of a process Timing Diagrams Show how an object changes over time State Machines Examines behavior of one class Models the different states and state transitions an object can experience Use-Case Diagrams Shows interaction between the system and environment Captures business requirements
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?
romi@romisatriawahono.net Object-Oriented Programming UML Process (EA Sparx) Display the boundary of a system and its major functions using use cases and actors Model the organization’s business process with activity diagram Illustrate use case realizations with sequence diagrams Represent a static structure of a system using class diagrams Reveal the physical implementation architecture with deployment diagrams http://romisatriawahono.net
UML Process (EA Sparx) Use Cases Diagram Activity Diagram romi@romisatriawahono.net Object-Oriented Programming UML Process (EA Sparx) Use Cases Diagram Activity Diagram Sequence Diagram Class Diagram Deployment Diagrams http://romisatriawahono.net
UML Process (Kendal, 2011) A use case diagram, describing how the system is used. Analysts start with a use case diagram An activity diagram, illustrating the overall flow of activities. Each use case may create one activity diagram Sequence diagrams, showing the sequence of activities and class relationships. Each use case may create one or more sequence diagrams Class diagrams, showing the classes and relationships. Sequence diagrams are used to determine classes Statechart diagrams, showing the state transitions. Each class may create a statechart diagram, which is useful for determining class methods
(Kendall and Kendall, 2011)
UML Process (Barclay, 2004)
System Analysis and Design with UML Business Process Identification Use Case Diagram Business Process Modeling Activity Diagram or Business Process Modeling Notation (BPMN) Business Process Realization Sequence Diagram (Buat untuk setiap use case dengan menggunakan pola Boundary-Control-Entity) System Design Program Design Class Diagram (Gabungkan Boundary-Control-Entity Class dan susun story dari sistem yang dibangun) Package Diagram (Gabungan class yang sesuai, boleh menggunakan pola B-C-E) Deployment Diagram (arsitektur software dari sistem yang dibangun) User Interface Design (Buat UI design dari Boundary Class) Entity-Relationship Model (Buat ER diagram dari Entity Class)
Case Study: ATM System romi@romisatriawahono.net Object-Oriented Programming Case Study: ATM System http://romisatriawahono.net
ATM System romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
ATM System Layar Kotak Uang Kotak Kartu Kotak Kuitansi romi@romisatriawahono.net Object-Oriented Programming ATM System Layar Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi romi@romisatriawahono.net Object-Oriented Programming Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Menu Utama Melihat Saldo Mentransfer Uang Mengambil Uang Logout romi@romisatriawahono.net Object-Oriented Programming Menu Utama Melihat Saldo Mentransfer Uang Mengambil Uang Logout Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Saldo anda adalah …. Menu Melihat Saldo Kotak Uang Kotak Kartu romi@romisatriawahono.net Object-Oriented Programming Menu Melihat Saldo Saldo anda adalah …. Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
No Account Penerima: Menu Mentransfer Uang Kotak Uang Kotak Kartu romi@romisatriawahono.net Object-Oriented Programming Menu Mentransfer Uang No Account Penerima: Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Jumlah uang yang dikirim: romi@romisatriawahono.net Object-Oriented Programming Menu Mentransfer Uang Jumlah uang yang dikirim: Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Uang berhasil terkirim romi@romisatriawahono.net Object-Oriented Programming Menu Mentransfer Uang Uang berhasil terkirim Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Jumlah uang yang diambil: romi@romisatriawahono.net Object-Oriented Programming Menu Mengambil Uang Jumlah uang yang diambil: Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Uang berhasil diambil Menu Mengambil Uang Kotak Uang Kotak Kartu romi@romisatriawahono.net Object-Oriented Programming Menu Mengambil Uang Uang berhasil diambil Kotak Uang Kotak Kartu Kotak Kuitansi http://romisatriawahono.net
Use Case Diagram
Use Case Diagram (Alternatif)
Activity Diagram: Memasukkan Kartu
Activity Diagram: Memasukkan PIN
Activity Diagram: Mengecek Saldo
Activity Diagram: Mentransfer Uang
Activity Diagram: Mengambil Uang
Activity Diagram: Melakukan Logout
Sequence Diagram: Memasukkan Kartu
Type of Class Boundary Class Control Class Entity Class romi@romisatriawahono.net Object-Oriented Programming Type of Class Boundary Class Class yang berhubungan dengan actor (user interface) Control Class Class yang berhubungan dengan pemrosesan, komputasi, penghitungan, dsb Entity Class Class yang berhubungan dengan data (flat file or database) http://romisatriawahono.net
Sequence Diagram: Memasukkan PIN
Sequence Diagram: Mengecek Saldo
Sequence Diagram: Mentransfer Uang
Sequence Diagram: Mengambil Uang
Sequence Diagram: Melakukan Logout
Class Diagram
Deployment Diagram (2 Tier)
Data Model
User Interface Design
User Interface Design (Netbeans)
4. Object-Oriented Paradigm romi@romisatriawahono.net Object-Oriented Programming 4. Object-Oriented Paradigm http://romisatriawahono.net
Konsep Dasar Pemrograman Berorientasi Objek romi@romisatriawahono.net Object-Oriented Programming Konsep Dasar Pemrograman Berorientasi Objek Class , Object, Method, Attribute http://romisatriawahono.net
Berorientasi Objek? Attribute: Topi, Baju, Jaket, romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Berorientasi Objek? Attribute (State): Behavior: romi@romisatriawahono.net Object-Oriented Programming 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) http://romisatriawahono.net
Perbedaan Class dan Object romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Perbedaan Class dan Object romi@romisatriawahono.net Object-Oriented Programming 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) http://romisatriawahono.net
Class = Method + Variable romi@romisatriawahono.net Object-Oriented Programming Class = Method + Variable Class Sepeda gir kecepatan variable tampilkan kecepatan ubah gir method http://romisatriawahono.net
Object = Method + Variable yg Memiliki Nilai romi@romisatriawahono.net Object-Oriented Programming Object = Method + Variable yg Memiliki Nilai Object Sepedaku gir = 3 instance variable kecepatan = 10km/jam tampilkan kecepatan () kecepatan = 10 km/jam instance method ubah gir (2) gir = 5 http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Membuat Class, Object dan Memanggil Atribut romi@romisatriawahono.net Object-Oriented Programming Membuat Class, Object dan Memanggil Atribut Mobil.java public class Mobil { String warna; int tahunProduksi; } MobilBeraksi.java 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); } http://romisatriawahono.net
Latihan: Membuat Program dg Netbeans romi@romisatriawahono.net Object-Oriented Programming Latihan: Membuat Program dg Netbeans Buka Netbeans IDE Ikuti langkah berikut http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
Method Method adalah urutan instruksi yang mengakses data dari object romi@romisatriawahono.net Object-Oriented Programming Method Method adalah urutan instruksi yang mengakses data dari object Method melakukan: Manipulasi data Perhitungan matematika Memonitor kejadian dari suatu event http://romisatriawahono.net
Method romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
Membuat dan Memanggil Method romi@romisatriawahono.net Object-Oriented Programming Membuat dan Memanggil Method public class Mobil2{ String warna; int tahunProduksi; void printMobil(){ System.out.println("Warna: " + warna); System.out.println("Tahun: " + tahunProduksi); } Mobil2.java public class Mobil2Beraksi{ public static void main(String[] args){ Mobil2 mobilku = new Mobil2(); mobilku.warna = "Hitam"; mobilku.tahunProduksi = 2006; mobilku.printMobil(); } Mobil2Beraksi.java http://romisatriawahono.net
Latihan Buat class Handphone yang berisi empat method: hidupkan() romi@romisatriawahono.net Object-Oriented Programming Latihan Buat class Handphone yang berisi empat method: hidupkan() lakukanPanggilan() kirimSMS() matikan() Isi masing-masing method dengan tampilan status menggunakan System.out.println() Buat class HandphoneBeraksi, dan panggil method-method diatas dalam class tersebut http://romisatriawahono.net
Latihan: Hasil Tampilan romi@romisatriawahono.net Object-Oriented Programming Latihan: Hasil Tampilan Handphone hidup … Kring, kring, kring … panggilan dilakukan Dung, dung … sms berhasil terkirim Handphone mati … http://romisatriawahono.net
Jenis Method: Mutator dan Accessor romi@romisatriawahono.net Object-Oriented Programming Jenis Method: Mutator dan Accessor http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Pengiriman Pesan dan Parameter romi@romisatriawahono.net Object-Oriented Programming Pengiriman Pesan dan Parameter You object pengirim YourBicycle object penerima changeGears pesan berupa method yang dijalankan lowerGear parameter yang dibutuhkan method (pesan) untuk dijalankan http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Sepeda.java public class Sepeda{ int gir; // method (mutator) dengan parameter void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } // method (accessor) int getGir() { return gir; http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming SepedaBeraksi.java 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()); } http://romisatriawahono.net
Latihan: Class Matematika dan Parameter romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Variasi Tampilan pertambahan(int a, int b){ System.out.println(a + “ + “ + b + “ = “ + (a+b)) } System.out.println(“Hasil = “ + (a+b)) int hasil = a + b; System.out.println(“Hasil = “ + hasil) http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
Konstruktor -2- Mobil.java MobilKonstruktor.java romi@romisatriawahono.net Konstruktor -2- Object-Oriented Programming Mobil.java 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); mobilku.info(); } MobilKonstruktor.java http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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; } http://romisatriawahono.net
Latihan Buat class Bank romi@romisatriawahono.net Object-Oriented Programming Latihan Buat class Bank Buat konstruktor class Bank dengan parameter: saldo Buat method: simpanUang, ambilUang, dan getSaldo 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 http://romisatriawahono.net
Karakteristik Pemrograman Berorientasi Objek romi@romisatriawahono.net Object-Oriented Programming Karakteristik Pemrograman Berorientasi Objek Abstraction, Encapsulation, Inheritance, Polymorphism http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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 http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming 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: mendeklarasikan instance variable sebagai private mendeklarasikan method yang sifatnya public untuk mengakses variable tersebut http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming http://romisatriawahono.net
Encapsulation dan Access Modifier romi@romisatriawahono.net Object-Oriented Programming Encapsulation dan Access Modifier Modifier Dalam Class yang Sama Dalam Package yang Sama Dalam SubClass Dalam Package Lain private tanpa tanda protected public http://romisatriawahono.net
Encapsulation Enkapsulasi data juga dapat dilakukan dengan cara: romi@romisatriawahono.net Object-Oriented Programming Encapsulation Enkapsulasi data juga dapat dilakukan dengan cara: mendeklarasikan instance variable sebagai private mendeklarasikan method yang sifatnya public untuk mengakses variable tersebut http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Sepeda.java public class Sepeda{ int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming SepedaBeraksi.java 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()); } http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Sepeda.java public class Sepeda{ private int gir; // access modifier private pada instance variable void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; http://romisatriawahono.net
Inheritance (Pewarisan) romi@romisatriawahono.net Object-Oriented Programming Inheritance (Pewarisan) Suatu class dapat mewariskan atribut dan method kepada class lain (subclass), serta membentuk class hierarchy Penting untuk Reusability Java Keyword: extends http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Sepeda.java public class Sepeda{ private int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; http://romisatriawahono.net
Class SepedaGunung Mewarisi Class Sepeda romi@romisatriawahono.net Object-Oriented Programming 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()); } SepedaGunung.java SepedaGunungBeraksi.java http://romisatriawahono.net
Latihan: Inheritance Matematika romi@romisatriawahono.net Object-Oriented Programming Latihan: Inheritance Matematika Buat class MatematikaCanggih yang merupakan inherit dari class Matematika Tambahkan method modulus(int a, int b) yang menghitung modulus dari a dan b Operator modulus adalah % Buat class MatematikaCanggihBeraksi yang memanggil method pertambahan, perkalian dan modulus http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Polymorphism Kemampuan untuk memperlakukan object yang memiliki perilaku (bentuk) yang berbeda Implementasi konsep polymorphism: Overloading: Kemampuan untuk menggunakan nama yang sama untuk beberapa method yang berbeda parameter (tipe dan atau jumlah) Overriding: Kemampuan subclass untuk menimpa method dari superclass, yaitu dengan cara menggunakan nama dan parameter yang sama pada method http://romisatriawahono.net
Polymorphism – Overloading romi@romisatriawahono.net Object-Oriented Programming 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); mobilku.info(); Mobil mobilmu = new Mobil(); mobilmu.info(); } http://romisatriawahono.net
Polymorphism – Overloading romi@romisatriawahono.net Object-Oriented Programming 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){ ... http://romisatriawahono.net
Polymorphism - Overriding romi@romisatriawahono.net Object-Oriented Programming Polymorphism - Overriding public class Sepeda{ protected int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir; http://romisatriawahono.net
Polymorphism - Overriding romi@romisatriawahono.net Object-Oriented Programming 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); } SepedaGunung.java SepedaGunungBeraksi.java http://romisatriawahono.net
Latihan: Overloading pada Matematika romi@romisatriawahono.net Object-Oriented Programming Latihan: Overloading pada Matematika Kembangkan class Matematika, MatematikaCanggih dan MatematikaBeraksi Lakukan overloading pada Method yang ada (pertambahan, pengurangan, perkalian, pembagian, modulus) Tambahkan method baru bertipe data double (pecahan) dan memiliki 3 parameter: double a, double b, double c Uji di kelas MatematikaBeraksi dengan parameter pecahan: 12.5, 28.7, 14.2 Misalnya: pertambahan(12.5, 28.7, 14.2) pertambahan(12, 28, 14) pertambahan(23, 34) pertambahan(3.4, 4.9) http://romisatriawahono.net
romi@romisatriawahono.net Object-Oriented Programming Matematika.java 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; ... http://romisatriawahono.net
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, http://www.swebok.org, 2004
Referensi (Process) Alan Dennis et al, Systems Analysis and Design with UML – 3rd 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
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