Download presentation
Presentation is loading. Please wait.
Published byJonah Chapman Modified over 8 years ago
1
Didik Dwi didik@um.ac.id h t t p : / / b l o g. e l e k t r o. u m. a c. i d / d i d i k Object Oriented Software Engineering
2
Didik Dwi - Teknik Elektro UM Subbahasan Paradigma Pengembangan PL Prinsip Dasar Orientasi Objek Konsep Dasar Orientasi Objek 2
3
Didik Dwi - Teknik Elektro UM Paradigma Pengembangan PL Functional Composition Logic Programming Structured Development Object Orientation 3
4
Didik Dwi - Teknik Elektro UM Functional Composition A problem is expressed in termed of a set of mathematical functions. e.g. Double(x) = Add(x, x). An algorithm is not specified. Language such as Miranda, Gofer, Haskell support this paradigm. Poor execution speed. 4
5
Didik Dwi - Teknik Elektro UM Logic Programming Consists of a problem description only. e.g. Factorial(0) = 1. Factorial(N) = N x Factorial(N -1). Doesn’t describe how to solve the problem. Languages Prolog & Lisp support this paradigm. 5
6
Didik Dwi - Teknik Elektro UM Structured Development Also called SASD, SADT & Functional Decomposition. Breaks the system into processes & decomposes them. Data independent from program Languages C, Fortran, Pascal, Cobol, Basic and a lot more support this paradigm. By far the most popular paradigm. 6
7
Didik Dwi - Teknik Elektro UM Object Orientation Most recent paradigm. Treats a problem as a collection of objects. Becoming very popular now. More and more languages support this paradigm now. 7
8
Didik Dwi - Teknik Elektro UM Paradigma Pengembangan PL Prinsip Dasar Orientasi Objek Konsep Dasar Orientasi Objek 8
9
Didik Dwi - Teknik Elektro UM Basic Principles of OO 9 Object Orientation EncapsulationAbstraction Hierarchy Modularity
10
Didik Dwi - Teknik Elektro UM What is abstraction? 10 Salesperson Not saying Which salesperson – just a salesperson in general!!! Customer Product Manages Complexity
11
Didik Dwi - Teknik Elektro UM What is Encapsulation? Hide implementation from clients Clients depend on interface 11 Improves Resiliency How does an object encapsulate? What does it encapsulate?
12
Didik Dwi - Teknik Elektro UM What is Modularity? The breaking up of something complex into manageable pieces 12 Order Processing System Billing Order Entry Order Fulfillment Manages Complexity
13
Didik Dwi - Teknik Elektro UM What is Hierarchy? Levels of abstraction 13 Decreasing abstraction Increasing abstraction Asset RealEstate Savings BankAccount Checking Stock Security Bond Elements at the same level of the hierarchy should be at the same level of abstraction
14
Didik Dwi - Teknik Elektro UM Hierarchy 14 chair table desk"chable" instances of chair furniture (superclass) subclasses of the furniture superclass
15
Didik Dwi - Teknik Elektro UM The OO Mindset 15 problem domain objects
16
Didik Dwi - Teknik Elektro UM Paradigma Pengembangan PL Prinsip Dasar Orientasi Objek Konsep Dasar Orientasi Objek 16
17
Didik Dwi - Teknik Elektro UM Basic Concepts of OO 17 classes and class hierarchies classes and class hierarchies – instances – inheritance – abstraction and hiding objects objects – attributes – Methods – polymorphism Messages Messages Component Component Package Package Subsystem Subsystem Relationships Relationships
18
Didik Dwi - Teknik Elektro UM Classes object-oriented thinking begins with the definition of a class often defined as: – template – pattern – “blueprint”... describing a collection of similar items 18 OO Principle: Abstraction
19
Didik Dwi - Teknik Elektro UM Representing Classes A class is represented using a compartmented rectangle 19 Professor Professor Clark a + b = 10
20
Didik Dwi - Teknik Elektro UM Class Compartments A class is comprised of three sections The first section contains the class name The second section shows the structure (attributes) The third section shows the behavior (operations) 20 Professor name empID create( ) save( ) delete( ) change( ) Class Name Attributes Operations
21
Didik Dwi - Teknik Elektro UM Building a Class 21
22
Didik Dwi - Teknik Elektro UM Objects An object is an instance of a class An object is something that has: State Behavior Identity An object is a "black box" which receives and sends messages. 22
23
Didik Dwi - Teknik Elektro UM Classes and Objects A class is an abstract definition of an object It defines the structure and behavior of each object in the class It serves as a template for creating objects 23
24
Didik Dwi - Teknik Elektro UM Classes and Objects Objects are grouped into classes 24 Objects Class Professor Smith Professor Jones Professor Mellon Professor
25
Didik Dwi - Teknik Elektro UM What is an Attribute? 25
26
Didik Dwi - Teknik Elektro UM Methods A.k.a Operations, Services An executable procedure that is encapsulated in a class and is designed to operate on one or more data attributes 26 CourseOffering addStudent deleteStudent getStartTime getEndTime Class Operation
27
Didik Dwi - Teknik Elektro UM What is Polymorphism The ability to hide many different implementations behind a single interface 27 Manufacturer A Manufacturer B Manufacturer C OO Principle: Encapsulation
28
Didik Dwi - Teknik Elektro UM Messages 28
29
Didik Dwi - Teknik Elektro UM What is a Component? A non-trivial, nearly independent, and replaceable part of a system A component may be A source code component A run time components or An executable component 29 OO Principle: Encapsulation > Component Name Component Interface
30
Didik Dwi - Teknik Elektro UM What is a Package? A package is a general purpose mechanism for organizing elements into groups A model element which can contain other model elements 30 Package Name OO Principle: Modularity
31
Didik Dwi - Teknik Elektro UM What is a Subsystem? A combination of a package (can contain other model elements) and a class (has behavior) 31 OO Principles: Encapsulation and Modularity > Subsystem Name Interface Realization Subsystem
32
Didik Dwi - Teknik Elektro UM Subsystems and Components 32 Component Name Design ModelImplementation Model > Component Name Component Interface OO Principles: Encapsulation and Modularity
33
Didik Dwi - Teknik Elektro UM Relationships Association Aggregation Composition Dependency Generalization Realization 33
34
Didik Dwi - Teknik Elektro UM Relationships: Association Models a semantic connection among classes 34 Professor University Works for Class Association Association Name Professor University EmployerEmployee Role Names
35
Didik Dwi - Teknik Elektro UM Relationships: Aggregation A special form of association that models a whole-part relationship between an aggregate (the whole) and its parts Hubungan keseluruhan sebagian (wholepart) Merepresentasikan hubungan “has a/an” 35
36
Didik Dwi - Teknik Elektro UM Relationships: Aggregation Contoh: 36 Car Body Whole Aggregation Part
37
Didik Dwi - Teknik Elektro UM Relationships: Composition A form of aggregation with strong ownership and coincident lifetimes The parts cannot survive the whole/aggregate 37 Book Chapter Whole Aggregation Part
38
Didik Dwi - Teknik Elektro UM Multiplicity and Navigation Multiplicity defines how many objects participate in a relationships Associations and aggregations are bi- directional by default, but it is often desirable to restrict navigation to one direction 38 One direction Bi-direction
39
Didik Dwi - Teknik Elektro UM Association: Multiplicity Unspecified Exactly one Zero or more (many, unlimited) One or more Zero or one Specified range Multiple, disjoint ranges 39 2..4 0..1 1..* 0..* 1 *2, 4..6
40
Didik Dwi - Teknik Elektro UM Multiplicity and Navigation Example 40 Student Schedule 10..* Multiplicity Navigation
41
Didik Dwi - Teknik Elektro UM Relationships: Dependency A relationship between two model elements where a change in one may cause a change in the other Merepresentasikan hubungan “using” 41 ClientSupplier Package ClientPackageSupplierPackage Client Class Dependency relationship
42
Didik Dwi - Teknik Elektro UM Relationships: Generalization Defines a hierarchy of abstractions in which a subclass inherits from one or more superclasses Single inheritance Multiple inheritance Merepresentasikan hubungan “is-a-kind of” 42
43
Didik Dwi - Teknik Elektro UM Relationships: Generalization One class inherits from another 43 Account balance name number Withdraw() CreateStatement() Checking Withdraw() Savings GetInterest() Withdraw() Superclass (parent) Subclasses Generalization Relationship Ancestor Descendents
44
Didik Dwi - Teknik Elektro UM Example: Multiple Inheritance A class can inherit from several other classes 44 AirplaneHelicopterWolfHorse FlyingThingAnimal Bird multiple inheritance
45
Didik Dwi - Teknik Elektro UM Relationships: Realization One classifier serves as the contract that the other classifier agrees to carry out 45 Component Interface Use CaseUse-Case Realization Elided form Class Interface Subsystem Interface Canonical form
46
Didik Dwi - Teknik Elektro UM Tools for OO Rumbaugh (OMT) Coad-Yourdon Booch UML 46
47
Didik Dwi - Teknik Elektro UM Strengths of Object Orientation Facilitates architectural and code reuse Models more closely reflect the real world More accurately describe corporate data and processes Decomposed based on natural partitioning Easier to understand and maintain Stability A small change in requirements does not mean massive changes in the system under development 47
48
Didik Dwi - Teknik Elektro UM Conclusion Paradigma pengembangan PL: Fungsional, Logic, Structured, dan OO Prinsip dasar orientasi objek: Abstraksi, enkapsulasi, modularity, dan hierarki Konsep dasar orientasi objek: Kelas dan Objek Messages, Component, Package, Subsystem Relationships 48
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.