Upload presentasi
Presentasi sedang didownload. Silahkan tunggu
Diterbitkan olehLeony Shinta Tanuwidjaja Telah diubah "6 tahun yang lalu
1
Systems Analysis and Design with UML
Object-Oriented Programming Systems Analysis and Design with UML
2
Learning Design Educational Objectives (Benjamin Bloom)
Cognitive Affective Psychomotor Criterion Referenced Instruction (Robert Mager) Competencies Performance Evaluation Minimalism (John Carroll) Start Immediately Minimize the Reading Error Recognition Self-Contained
3
Learning Design Pretest dan Posttest untuk Mengukur Kompetensi Kognifif Penyajian Materi dengan Model Minimalism berbasis Konsep Amati-Tiru-Modifikasi Latihan Secara Iteratif untuk Meningkatkan Kompetensi Kognitif dan Psikomotorik Penugasan berbasis Self-Contained Project dan Literatur Review
4
Textbook romi@romisatriawahono.net Object-Oriented Programming
5
References Object-Oriented Programming Alan Dennis et al, Systems Analysis and Design with UML 4th Edition, John Wiley and Sons, 2013 Kenneth E. Kendall and Julie E Kendall, Systems Analysis and Design 8th Edition, Prentice Hall, 2010 Hassan Gomaa, Software Modeling and Design: UML, Use Cases, Patterns, and Software Architectures, Cambridge University Press, 2011 Gary B. Shelly and Harry J. Rosenblatt, Systems Analysis and Design 9th Edition, Course Technology, 2011 Howard Podeswa, UML for the IT Business Analyst 2nd Edition, Course Technology, 2009 Jeffrey A. Hoffer et al, Modern Systems Analysis and Design 6th Edition, Prentice Hall, 2010
6
Pre-Test Object-Oriented Programming Sebutkan tahapan pengembangan sistem atau system development life cycle (SDLC)! Sebutkan beberapa metodologi pengembangan sistem yang anda ketahui! Gambarkan requirement di bawah dengan use case diagram! Buat program yang menampilkan tulisan "Halo Jakarta" di layar monitor, dengan bahasa pemrograman yang anda kuasai! SISTEM ELIBRARY Sistem elibrary memungkinkan pengguna untuk melakukan registrasi dan login Setelah menjadi member, pengguna dapat memodifikasi profile, serta mencari dan mendownload koleksi buku elibrary Admin sistem elibrary melakukan approval terhadap registrasi dan menampilkan laporan aktifitas pengguna secara individual maupun total
7
Course Contents Introduction Project Planning System Analysis
System Design System Implementation
8
1. INTRODUCTION romi@romisatriawahono.net Object-Oriented Programming
9
Learning Objectives Object-Oriented Programming Understand the system analysis and design and the term of analyst Understand the system development life cycle and its four phases Understand the evolution of system development methodologies Be familier with the Unified Modeling Language (UML) version 2.0 Understand the characteristics of object-oriented paradigm
10
Key Ideas Object-Oriented Programming More than half of all systems development projects Fail (42% - Standish Group, 53% - General Accounting Office) Canceled before completion System is never used once finished Doesn't provide the expected benefits Most of the ones that don't fail: Are delivered late Are over budget Don't provide the features promised
11
Recent Significant IT Failures
Object-Oriented Programming Recent Significant IT Failures Company Year Outcome Hudson Bay (Canada) 2005 Inventory system problems lead to $33.3 million loss UK Inland Revenue 2004/5 $3.45 billion tax-credit overpayment caused by software errors Avis Europe PLC (UK) 2004 Enterprise resource planning (ERP) system cancelled after $54.5 million spent Ford Motor Co. Purchasing system abandoned after deployment costing approximately $400 M Hewlett-Packard Co. ERP system problems contribute to $160 million loss AT&T Wireless Customer relations management (CRM) system upgrade problems lead to $100M loss
12
Object-Oriented Programming
13
Is it Possible? romi@romisatriawahono.net Object-Oriented Programming
14
Systems Analyst and Its Roles
Object-Oriented Programming Systems Analyst and Its Roles
15
Analyst Related Role Business analyst System analyst
Infrastructure analyst Change management analyst Project manager
16
Business Analyst Focuses on business issues surrounding the system
Business Analyst Object-Oriented Programming Focuses on business issues surrounding the system The business value of the system Improvements in business processes New business processes needed with new system Requires business skills and professional training
17
System Analyst Object-Oriented Programming The systems analyst is a key person analyzing the business, identifying opportunities for improvement, and designing information systems to implement these ideas Focuses on Information System (IS) Issues How IS can improve business processes Designs new information system Ensures IS quality standards are maintained Requires training & experience in design analysis, programming, business (to lesser degree)
18
Infrastructure Analyst
Infrastructure Analyst Object-Oriented Programming Focuses on interfaces between new system & existing infrastructure Makes sure new system follows organizational standards Identifies required infrastructure changes Requires experience in network & database administration Requires knowledge of hardware systems
19
Change Management Analyst
Change Management Analyst Object-Oriented Programming Focuses on system installation Documentation & support for users Coordinate training of users Strategies to overcome resistance Requires experience in organizational behavior Requires experience in change management
20
Project Manager Responsible for schedule and budget
Project Manager Object-Oriented Programming Responsible for schedule and budget Ensures promised benefits are delivered Manages team members Responsible for project plan and reporting progress Requires project management experience
21
Object-Oriented Programming
22
Systems Development Life Cycle (SDLC)
Object-Oriented Programming Systems Development Life Cycle (SDLC)
23
Systems Development Life Cycle (SDLC)
Object-Oriented Programming Systems Development Life Cycle (SDLC) Planning Analysis Design Implementation
24
Project Phases Planning: Why build the system?
Project Phases Object-Oriented Programming 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
25
Planning Identifying business value (System Request)
Planning Object-Oriented Programming Identifying business value (System Request) Lower costs Increase profits Analyze feasibility Technical Feasibility Economic Feasibility Organizational Feasibility Estimating the size of project (System Proposal)
26
Analysis Requirement gathering by answering the questions:
Analysis Object-Oriented Programming 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)
27
Design (System Specification) Program Design (UML Diagrams)
Design Object-Oriented Programming 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)
28
Implementation Construction Testing Installation
Implementation Object-Oriented Programming 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
29
Processes and Deliverables
Processes and Deliverables Object-Oriented Programming Process Product Planning Analysis Design Implementation System Proposal System Specification New System with Testing/Maintenance Plan
30
SDLC and Deliverables Planning Analysis (System Specification)
Object-Oriented Programming SDLC and Deliverables Planning (System Proposal) Analysis (System Specification) Design (System Specification) Implementation (New System)
31
Systems Development Methodologies
Object-Oriented Programming Systems Development Methodologies
32
What Is a Methodology? Object-Oriented Programming 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
33
Major Methodologies Structured Design RAD Development
Major Methodologies Object-Oriented Programming Structured Design Waterfall method Parallel development RAD Development Phased Development Prototyping Throw-away Prototyping Agile Development Extreme Programming (XP) Scrum
34
Structured Design Methodology
Structured Design Methodology Object-Oriented Programming Projects move methodically from one to the next step Generally, a step is finished before the next one begins
35
Waterfall Method
36
Pros - Cons of the Waterfall Method
Pros - Cons of the Waterfall Method Object-Oriented Programming 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
37
Parallel Development Object-Oriented Programming Addresses problem of time gap between proposal and delivery General process: Breaks project into parallel subproject Integrates them at the end
38
Parallel Development romi@romisatriawahono.net
Object-Oriented Programming
39
Rapid Application Development
Rapid Application Development Object-Oriented Programming Phased development A series of versions Prototyping System prototyping Throw-away prototyping Design prototyping
40
Rapid Application Development
Rapid Application Development Object-Oriented Programming Critical elements to speed up the SDLC: CASE tools Visual programming languages Code generators
41
RAD: Phased Development
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
42
Object-Oriented Programming
43
RAD: Phased Development
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
44
RAD: Prototyping Object-Oriented Programming 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
45
RAD: Prototyping romi@romisatriawahono.net Object-Oriented Programming
46
RAD: Prototyping Pros Cons
RAD: Prototyping Object-Oriented Programming 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
47
RAD: Throw-Away Prototyping
RAD: Throw-Away Prototyping Object-Oriented Programming 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
48
RAD: Throw-Away Prototyping
RAD: Throw-Away Prototyping Object-Oriented Programming
49
Agile Development Just a few rules that are easy to learn and follow
Agile Development Object-Oriented Programming 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)
50
Extreme Programming (XP)
Extreme Programming (XP) Object-Oriented Programming “Core Values” of XP Communication – All to All Simplicity – KISS, refactoring Feedback – Embrace Change Courage – Quality First, test and efficient coding
51
Extreme Programming (XP)
Extreme Programming (XP) Object-Oriented Programming User Stories about system do Code small program using defined standards Naming conventions Coding practices User Feedback Repeat
52
Extreme Programming (XP)
Extreme Programming (XP) Object-Oriented Programming
53
Selecting the Appropriate Methodology
Selecting the Appropriate Methodology Object-Oriented Programming Clarity of User Requirements Familiarity with Technology System Complexity System Reliability Short Time Schedules Schedule Visibility
54
Selecting the Right Methodology
Selecting the Right Methodology Object-Oriented Programming
55
Exercise: Selecting Methodology
Exercise: Selecting Methodology Object-Oriented Programming 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.
56
The Unified Modelling Language (UML)
Object-Oriented Programming The Unified Modelling Language (UML)
57
Analysis Design Paradigm and Diagrams
Data-oriented DFD Process-oriented Flowchart Object-oriented (data + process) UML
58
Sejarah UML In the 90s many people creating OO diagramming languages
Booch, Jacobson, Rumbaugh 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)
59
Sejarah UML UML 2.4
60
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
61
Modeling captures essential parts of the system (James Rumbaugh)
Why Modeling? Modeling captures essential parts of the system (James Rumbaugh) Business Process Computer System Visual Modeling is modeling using standard graphical notations
62
The Triangle of Success in Software Dev.
Notation: Standard Tools: Support Standard and Process Process: Customer-Oriented Methodology
63
UML Tools Rational Rose Visual Paradigm Enterprise Architect
Microsoft Visio Star UML Netbeans UML Plugin
64
UML Diagrams Target System Use-Case Diagram
The point to be made is that the UML is the language we use to visually model. Since it is a widely adopted standard, it facilitates the understanding and communication of the visual models we create. Activity and object diagrams are not shown on this slide. These diagrams can be used to model workflows in business process engineering. Statechart Diagram 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 7: readFile ( ) 5: readDoc ( ) Mainframe IBM repository : Repository document : Document 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. µ¥ÀÌŸº£À̽º¼¹ö Component Diagram mainWnd fileMgr : FileMgr document : Document gFile repository user Target System »ç¿ëÀÚ°¡ ¿äûÇÑ´Ù. ƯÁ¤¹®¼¿¡ ´ëÇÑ º¸±â¸¦ 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
65
UML 2.0 UML version 2.0 has 14 diagrams in 2 major groups:
UML 2.0 Object-Oriented Programming UML version 2.0 has 14 diagrams in 2 major groups: Structure Diagrams Behavior Diagrams
66
UML 2.0 Diagram
67
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
68
Structure Diagrams Class Diagrams Object 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
69
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
70
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
71
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
72
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
73
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?
74
UML Process (Simple Version)
Object-Oriented Programming UML Process (Simple Version) 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
75
UML Process (Simple Version)
UML Process (Simple Version) Object-Oriented Programming Use Cases Diagram Activity Diagram Sequence Diagram Class Diagram Deployment Diagrams
76
(Kendall and Kendall, 2011)
77
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)
78
Case Study: ATM System romi@romisatriawahono.net
Object-Oriented Programming Case Study: ATM System
79
ATM System romi@romisatriawahono.net Object-Oriented Programming
80
ATM System Layar Kotak Uang Kotak Kartu Kotak Kuitansi
ATM System Object-Oriented Programming Layar Kotak Uang Kotak Kartu Kotak Kuitansi
81
Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi
Object-Oriented Programming Masukkan PIN: Kotak Uang Kotak Kartu Kotak Kuitansi
82
Menu Utama Melihat Saldo Mengirim Uang Mengambil Uang Logout
Object-Oriented Programming Menu Utama Melihat Saldo Mengirim Uang Mengambil Uang Logout Kotak Uang Kotak Kartu Kotak Kuitansi
83
Saldo anda adalah …. Menu Melihat Saldo Kotak Uang Kotak Kartu
Object-Oriented Programming Menu Melihat Saldo Saldo anda adalah …. Kotak Uang Kotak Kartu Kotak Kuitansi
84
No Account Penerima: Menu Mengirim Uang Kotak Uang Kotak Kartu
Object-Oriented Programming Menu Mengirim Uang No Account Penerima: Kotak Uang Kotak Kartu Kotak Kuitansi
85
Jumlah uang yang dikirim:
Object-Oriented Programming Menu Mengirim Uang Jumlah uang yang dikirim: Kotak Uang Kotak Kartu Kotak Kuitansi
86
Uang berhasil terkirim
Object-Oriented Programming Menu Mengirim Uang Uang berhasil terkirim Kotak Uang Kotak Kartu Kotak Kuitansi
87
Jumlah uang yang diambil:
Object-Oriented Programming Menu Mengambil Uang Jumlah uang yang diambil: Kotak Uang Kotak Kartu Kotak Kuitansi
88
Uang berhasil diambil Menu Mengambil Uang Kotak Uang Kotak Kartu
Object-Oriented Programming Menu Mengambil Uang Uang berhasil diambil Kotak Uang Kotak Kartu Kotak Kuitansi
89
Activity Diagram (Business Process)
91
Use Case Diagram
92
Use Case Diagram (Alternatif)
93
Use Case Diagram (Alternatif)
94
Sequence Diagram: Memasukkan Kartu
95
Type of Class Boundary Class Control Class Entity Class
Type of Class Object-Oriented Programming 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)
96
Sequence Diagram: Memasukkan PIN
97
Sequence Diagram: Melihat Saldo
98
Sequence Diagram: Mengirim Uang
99
Sequence Diagram: Mengambil Uang
100
Sequence Diagram: Melakukan Logout
101
Class Diagram
102
Deployment Diagram (2 Tier)
103
Deployment Diagram (3 Tier)
104
Data Model
105
User Interface Design
106
Object-Oriented Paradigm
Object-Oriented Programming Object-Oriented Paradigm
107
Konsep Dasar Pemrograman Berorientasi Objek
Object-Oriented Programming Konsep Dasar Pemrograman Berorientasi Objek Class , Object, Method, Attribute
108
Berorientasi Objek? Attribute: Topi, Baju, Jaket,
Berorientasi Objek? Object-Oriented Programming Attribute: Topi, Baju, Jaket, Tas Punggung, Tangan, Kaki, Mata Behavior: Cara Jalan ke Depan Cara Jalan Mundur Cara Belok ke Kiri Cara Memanjat
109
Berorientasi Objek? Attribute (State): Behavior:
Berorientasi Objek? Object-Oriented Programming 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)
110
Perbedaan Class dan Object
Perbedaan Class dan Object Object-Oriented Programming 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
111
Perbedaan Class dan Object
Perbedaan Class dan Object Object-Oriented Programming 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)
112
Class = Method + Variable
Object-Oriented Programming Class = Method + Variable Class Sepeda gir kecepatan variable tampilkan kecepatan ubah gir method
113
Object = Method + Variable yg Memiliki Nilai
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
114
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
115
Membuat Class, Object dan Memanggil Atribut
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); }
116
Latihan: Membuat Program dg Netbeans
Object-Oriented Programming Latihan: Membuat Program dg Netbeans Buka Netbeans IDE Ikuti langkah berikut
117
Object-Oriented Programming
118
Object-Oriented Programming
119
Object-Oriented Programming
120
Object-Oriented Programming
121
Object-Oriented Programming
122
Object-Oriented Programming
123
Object-Oriented Programming
124
Object-Oriented Programming
125
Object-Oriented Programming
126
Method Method adalah urutan instruksi yang mengakses data dari object
Object-Oriented Programming Method Method adalah urutan instruksi yang mengakses data dari object Method melakukan: Manipulasi data Perhitungan matematika Memonitor kejadian dari suatu event
127
Method romi@romisatriawahono.net Object-Oriented Programming
128
Membuat dan Memanggil Method
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
129
Latihan Buat class Handphone yang berisi empat method: hidupkan()
Latihan Object-Oriented Programming 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
130
Latihan: Hasil Tampilan
Latihan: Hasil Tampilan Object-Oriented Programming Handphone hidup … Kring, kring, kring … panggilan dilakukan Dung, dung … sms berhasil terkirim Handphone mati …
131
Jenis Method: Mutator dan Accessor
Jenis Method: Mutator dan Accessor Object-Oriented Programming
132
Parameter Object-Oriented Programming 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
133
Pengiriman Pesan dan Parameter
Pengiriman Pesan dan Parameter Object-Oriented Programming You object pengirim YourBicycle object penerima changeGears pesan berupa method yang dijalankan lowerGear parameter yang dibutuhkan method (pesan) untuk dijalankan
134
Object-Oriented Programming
135
Sepeda.java public class Sepeda{ int gir;
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;
136
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()); }
137
Latihan: Class Matematika dan Parameter
Latihan: Class Matematika dan Parameter Object-Oriented Programming 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
138
Variasi Tampilan Object-Oriented Programming 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)
139
Konstruktor -1- Object-Oriented Programming 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
140
Konstruktor -2- Mobil.java MobilKonstruktor.java
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
141
Kata Kunci this Object-Oriented Programming Digunakan pada pembuatan class dan digunakan untuk menyatakan object sekarang public class Mobil{ String warna; int tahunProduksi; void isiData(String warna, int tahunProduksi){ this.warna = warna; this.tahunProduksi = tahunProduksi; } public class Mobil{ String warna; int tahunProduksi; void isiData(String aWarna, int aTahunProduksi){ warna = aWarna; tahunProduksi = aTahunProduksi; }
142
Latihan Buat class Bank
Latihan Object-Oriented Programming 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 , 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
143
Karakteristik Pemrograman Berorientasi Objek
Object-Oriented Programming Karakteristik Pemrograman Berorientasi Objek Abstraction, Encapsulation, Inheritance, Polymorphism
144
Abstraction Object-Oriented Programming 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
145
Object-Oriented Programming
146
Object-Oriented Programming
147
Encapsulation Object-Oriented Programming 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
148
Object-Oriented Programming
149
Encapsulation dan Access Modifier
Encapsulation dan Access Modifier Object-Oriented Programming Modifier Dalam Class yang Sama Dalam Package yang Sama Dalam SubClass Dalam Package Lain private tanpa tanda protected public
150
Encapsulation Enkapsulasi data juga dapat dilakukan dengan cara:
Encapsulation Object-Oriented Programming Enkapsulasi data juga dapat dilakukan dengan cara: mendeklarasikan instance variable sebagai private mendeklarasikan method yang sifatnya public untuk mengakses variable tersebut
151
Object-Oriented Programming Sepeda.java public class Sepeda{ int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir;
152
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()); }
153
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;
154
Inheritance (Pewarisan)
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
155
Object-Oriented Programming Sepeda.java public class Sepeda{ private int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir;
156
Class SepedaGunung Mewarisi Class Sepeda
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
157
Latihan: Inheritance Matematika
Latihan: Inheritance Matematika Object-Oriented Programming 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
158
Polymorphism Object-Oriented Programming 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
159
Polymorphism – Overloading
Polymorphism – Overloading Object-Oriented Programming 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(); }
160
Polymorphism – Overloading
Polymorphism – Overloading Object-Oriented Programming 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){ ...
161
Polymorphism - Overriding
Object-Oriented Programming Polymorphism - Overriding public class Sepeda{ protected int gir; void setGir(int pertambahanGir) { gir= gir+ pertambahanGir; } int getGir() { return gir;
162
Polymorphism - Overriding
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
163
Latihan: Overloading pada Matematika
Latihan: Overloading pada Matematika Object-Oriented Programming 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)
164
Matematika.java Object-Oriented Programming 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; ...
165
Summary -1- Object-Oriented Programming The systems analyst is a key person analyzing the business, identifying opportunities for improvement, and designing information systems to implement these ideas There are five major team roles: Business analyst Systems analyst Infrastructure analyst Change management analyst Project manager
166
Summary -2- Object-Oriented Programming The Systems Development Lifecycle consists of four stages: Planning, Analysis, Design, and Implementation The major development methodologies: Structured design Waterfall method Parallel development RAD development Phased Development Prototyping Throw-away Prototyping Agile development Extreme Programming
167
Summary -3- UML concepts are based on object-oriented paradigm
Summary -3- Object-Oriented Programming UML is the standard language for visualizing, specifying, constructing, and documenting the artifacts of a software-intensive system UML version 2.0 has 14 diagrams in 2 groups: Structure Diagrams Behavior Diagrams UML concepts are based on object-oriented paradigm
168
Referensi Object-Oriented Programming Alan Dennis et al, Systems Analysis and Design with UML 4th Edition, John Wiley and Sons, 2013 Kenneth E. Kendall and Julie E Kendall, Systems Analysis and Design 8th Edition, Prentice Hall, 2010 Hassan Gomaa, Software Modeling and Design: UML, Use Cases, Patterns, and Software Architectures, Cambridge University Press, 2011 Gary B. Shelly and Harry J. Rosenblatt, Systems Analysis and Design 9th Edition, Course Technology, 2011 Howard Podeswa, UML for the IT Business Analyst 2nd Edition, Thomson Course Technology, 2009 Jeffrey A. Hoffer et al, Modern Systems Analysis and Design 6th Edition, Prentice Hall, 2012
Presentasi serupa
© 2024 SlidePlayer.info Inc.
All rights reserved.