1 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Design Patterns למנתחי מערכות.

Slides:



Advertisements
Similar presentations
Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Advertisements

©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 12Slide 1 Software Design l Objectives To explain how a software design may be represented.
18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
Unified Modeling Language
UML – Class Diagrams.
Dept. of Computer Engineering, Amirkabir University of Tech. 1 Design Patterns Dr. Noorhosseini Introduction.
Design Patterns CS is not simply about programming
Chapter 1 Software Development. Copyright © 2005 Pearson Addison-Wesley. All rights reserved. 1-2 Chapter Objectives Discuss the goals of software development.
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
Low Coupling High Cohesion
© Copyright Eliyahu Brutman Programming Techniques Course.
Design Patterns Module Name - Object Oriented Modeling By Archana Munnangi S R Kumar Utkarsh Batwal ( ) ( ) ( )
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Design Patterns Alan Shalloway, James Trott, Design Patterns Explained, Addison-Wesley, Gamma, Helm, Johnson, Vlissides, Design Patterns, Elements.
The Design Discipline.
Systems Analysis and Design in a Changing World, Fifth Edition
Design Patterns.
Software Waterfall Life Cycle Requirements Construction Design Testing Delivery and Installation Operations and Maintenance Concept Exploration Prototype.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
12 Systems Analysis and Design in a Changing World, Fifth Edition.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
Chapter 17 GRASP: Designing Objects with Responsibilities. 1CS6359 Fall 2011 John Cole.
Systems Analysis and Design in a Changing World, 3rd Edition
Design Patterns CSCI 5801: Software Engineering. Design Patterns.
GRASP: Designing Objects with Responsibilities
1 Software Development Software Engineering is the study of the techniques and theory that support the development of high-quality software The focus is.
18 April 2005CSci 210 Spring Design Patterns 1 CSci 210.
Software Design Patterns (1) Introduction. patterns do … & do not … Patterns do... provide common vocabulary provide “shorthand” for effectively communicating.
Object Oriented Software Engineering Chapter 16 and 17 review 2014/06/03.
ECE450S – Software Engineering II
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
Introduction to Design Patterns. Questions What is a design pattern? Who needs design patterns? How different are classes and objects in APL compared.
Creational Patterns
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Design Pattern Catalog - Page L3-1 PS95&96-MEF-L10-1 Dr. M.E. Fayad Creationa.
Software Design Patterns Curtsy: Fahad Hassan (TxLabs)
Lecture 9-1 : Intro. to UML (Unified Modeling Language)
Design Patterns. 1 Paradigm4 Concepts 9 Principles23 Patterns.
Design Patterns Introduction
Watching the movie the hard way…. Page 256 – Head First Design Patterns.
Five Minute Design Patterns Doug Marttila Forest and the Trees May 30, 2009 Template Factory Singleton Iterator Adapter Façade Observer Command Strategy.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
Object Oriented Programming and Data Abstraction Earl Huff Rowan University.
7 April 2004CSci 210 Spring Design Patterns 2 CSci 210.
Basic Characteristics of Object-Oriented Systems
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Introduction to UML.
The Object-Oriented Thought Process Chapter 15
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Software Design Patterns
MPCS – Advanced java Programming
Design Patterns Lecture part 2.
Chapter 12: Collaboration Diagram - PART2
Introduction to Design Patterns
Unified Modeling Language
OO Methodology OO Architecture.
object oriented Principles of software design
The Object Oriented Approach to Design
Software Engineering Lecture 7 - Design Patterns
Unified Modeling Language
Informatics 122 Software Design II
Software Design Lecture : 15.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2004 Instructor: Patrice Chalin.
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Chapter 8, DesignPatterns Facade
Software Development Process Using UML Recap
Presentation transcript:

1 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Design Patterns למנתחי מערכות

2 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ תוכן מבוא ל- UML ה- Use Case Modeling ב- UML תוצרי ה- Conceptual Model קישור בין ה- Use Cases ל- Entity Classes ה- MVC – Pattern עקרונות ה- Coupling וה- Cohesion ה- Facade – Design Pattern ה – Adapter Design Pattern

3 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ UML מהו UML מטרות Models/Diagrams מחזור החיים בפיתוח ו- UML UML Diagrams כלים התומכים ב- UML

4 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מהו UML Unified Modeling Language משמשת לעיצוב, הגדרה, בניה, תיעוד תוצרים The UML is a language for specifying, visualizing, constructing, and documenting the artifacts of software systems, as well as for business modeling and othe non-software systems. The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems.

5 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מטרות ניתוח ועיצוב מערכות על פי מתודולוגיית ה- OO שפה משותפת בין משתמש/מנתח מערכות/מעצב מערכות/מתכנת קל לתחזוקה פשטות

6 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Models and Diagrams Use Case Diagrams Use Case Diagrams Use Case Diagrams Scenario Diagrams Scenario Diagrams Collaboration Diagrams State Diagrams State Diagrams Component Diagrams Component Diagrams Component Diagrams Deployment Diagrams State Diagrams State Diagrams Object Diagrams Scenario Diagrams Scenario Diagrams Statechart Diagrams Use Case Diagrams Use Case Diagrams Sequence Diagrams State Diagrams State Diagrams Class Diagrams Activity Diagrams A model is a complete description of a system from a particular perspective Models

7 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מחזור החיים בפיתוח ו- UML Requirements Design Implementation Test Analysis Use Case Model Design Model Depl. Model Impl. Model Analysis Model Test Model UML diagrams provide views into each model Each workflow is associated with one or more models.

8 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Use Case Driven Req.tsImpl.Test Use Cases Model Analysis Design

9 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ כלים התומכים ב- UML Rational Rose Select Objecteering Together Visio

10 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Use Case Modeling מבוא Actors Use Cases Use Case Diagram תיעוד ה- Use Case מערכת ספריה

11 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מבוא ל- Use Case Modeling נבנה בשלב הגדרת הדרישות מורכב מ- Uses Cases, Actors וקשרים ביניהם מטרות מתאים גם למערכת שאינה Object Oriented

12 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מטרות ה- Use Case Modeling דרך סיסטמטית ואינטואיטיבית להגדרת דרישות קשר בין המשתמש למפתח תאור ברור וממצה של מה אמורה לבצע המערכת מנקודת המבט של המשתמש שפה ברורה בין כל בעלי התפקידים בניית Test Cases תאור פונקצינלי של המערכת מנקודת ראות המשתמש

13 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Actors כל מי או מה שיוזם פעילות ישירה במערכת ו/או מקבל תוצר ישיר מהמערכת

14 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Use Cases תהליך פונקציונלי אחד ושלם מנקודת ראות המשתמש בצע השאלה עדכן רישום בצע הקצאת מקום הוסף ספר עדכן או מחק קורא Add Item Make Reservation

15 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ תעוד ה- Use Case תאור של מה לבצע ולא איך לבצע שפה דומה לטרמינולוגיה בשימוש ה- Actors הלקוח חייב לאשר את התאור ולכן… תבנית דוגמה לתעוד Use Case ניתן לתאר גם ע”י Activity Diagram

16 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ תבנית דוגמה לתעוד Use Case שם: מטרה: משתמשים: מסלול עיקרי: מסלולים חליפיים תנאי התחלה: תנאי סיום: יוצאים מהכלל: דרישות פונקציונליות דרישות לא פונקציונליות Name: Goal: Actors: Primary Flow: Alternate Flow Pre-Conditions: Post-Conditions: Exceptions: Functional Requirements Non Functional Requirements

17 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Primary/Alternate Flow כדאי לבנות את סעיף ה- Primary/Alternate Flow בצורה של טבלה פעילות ה- Actorsתגובת המערכת

18 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ תרגיל - ספריה הספרייה משאילה ספרים לקוראים פרטי הספרים והקוראים רשומים במערכת הספרייה רוכשת מידי פעם ספרים חדשים. המערכת אמורה לתמוך בניהול הספרים אבל לא בתהליך הרכישה. חלק מהספרים קיימים במספר עותקים עותקים של ספרים ישנים מוצאים מהספרייה אם הם במצב גרוע (בתחילת כל חודש הספרן מפיק דו”ח מצב) הספרן עובד מול הקוראים ומתחזק את המערכת כל קורא יכול לקבל מספר ספרים בו זמנית

19 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ תרגיל - ספריה -המשך כשקורא מבקש ספר שלא נמצא בספריה או נמצא אצל קורא אחר הספרן מחליט אם להכניס את הקורא לתור ממתינים. ניתן לבטל קורא מרשימת הממתינים בצורה יזומה. ברגע שספר נרכש או מוחזר לספריה ויש עבורו תור ממתינים הקורא הראשון ברשימה מקבל הודעה מתאימה. הספרן יכול להוסיף, לבטל, לעדכן נתונים של הקוראים, הספרים והעותקים במערכת. ההיסטוריה של ההשאלות, ההחזרות ותור הממתינים נשמרת במערכת

20 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מערכת ספריה – Use Case Diagram

21 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Conceptual Model בשלב זה יש לאתר את ה- Entity Classes במערכת עבור כל Class יש לאתר את ה- Attributes העיקריים אין צורך להוסיף בשלב זה את ה- Operations ואת הקשרים בין ה- Classes עבור ה- Attributes יש לקבוע את השמות והטיפוסי הכללייים בלבד

22 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Conceptual Model – מערכת ספריה Reader : id, firstName, lastName Title : isbn, name, author Copy : copyId, status Loan : loanDate, returnDate Reservation : reservationDate

23 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Conceptual Model – מערכת ספריה

24 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Sequence Diagram מבוא גרסה ראשונה של ה- Sequence Diagram דוגמה של Sequence Diagram

25 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ מבוא ל- Sequence Diagram מתאר את הפעילויות בתוך Use Case ניתן לתאר באמצעותו גם Operations מורכבים מדגיש את גורם הזמן מציג את האינטראקציה בין האובייקטים מציג את האינטראקציה בין ה- Actors למערכת שלבים בבניית ה- Sequence Diagram

26 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ גרסה ראשונה של ה- Sequence Diagram

27 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Model-View-Controller Architecture Separation between the "GUI", the data and the business logic The model layer –Corresponds to the "real world". –Represents the Conceptual Model –Does not have any user interface element The view layer –Visible to the end user –Typically there is one view class for each dialog/window in the GUI The control layer –Controls the interaction between the model and the view

28 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Entity Classes Hold Information Eventually may be mapped to tables in the Detailed Design Phase Usually business entities that have meaning to the end user Usually found in the previous step (Conceptual Model) Corresponds to the MODEL layer of the MVC Architecture

29 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Boundary Classes Lays on the boundary between the system and the outside world Added to show the interaction with the user or another system Usually mapped to forms and windows of the application and interfaces to other applications In this phase, the purpose is to capture and document the interface requirements, not to show how the interface is implemented The implementation is dependent upon the application framework that is chosen later in the detailed design phase Corresponds to the VIEW layer of the MVC Architecture

30 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Control Classes Typically, one control class for a use case Manages the flow of events Manages the entity classes Middle layer between the boundary classes and the entity classes Corresponds to the CONTROLLER layer of the MVC Architecture

31 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ בצע השאלה – כולל MVC

32 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ עקרונות ה- Cohesion –A class is responsible for many things in different areas –A class is responsible for a too complex task in the same area

33 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Low Cohesion Problems Hard to comprehend Hard to reuse Hard to maintain Delicate: constantly effected by change

34 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ High Cohesion Assign a responsibility so that cohesion remains high Cohesion is a measure of how strongly related and focused the responsibilities of a class are A class with low cohesion does many unrelated things or does too much work

35 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Low Cohesion

36 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ כלים לפתרון בעיות ה- Cohesion Inheritance Aggregation Divide and Conquer

37 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ עקרונות ה- Coupling Coupling is a measure of how strongly one class is connected to, has knowledge of, or relies upon other classes

38 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ High Coupling Problems Harder to understand in isolation Harder to reuse because its use requires the additional presence of the classes it is dependent upon

39 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ High Coupling

40 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Assign a responsibility so that its placement does not increase the coupling Consider GOF Design Patterns כלים לפתרון בעיות ה- Coupling

41 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ בעיה

42 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ First Improvement

43 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Second Improvement - Adapter

44 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Adapter Converts the interface of a class into another interface clients expect. Adapter lets classes work together that could not otherwise because of incompatible interfaces (GoF)

45 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Object Adapter – General Solution Return adaptee.specificRequest()

46 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Object Adapter - Advantages The adapted object conforms exactly to the expected interface The Adaptee object is encapsulated and hidden from the client

47 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Class Adapter – General Solution

48 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ בעיה מסוג אחר

49 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ פתרון - Facade

50 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Facade Provides a unified interface to a set of interfaces in a subsystem Defines a higher-level interface that makes the subsystem easier to use

51 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Façade - General Solution

52 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Façade - Advantages The client is shielded from the subsystem components. This makes the system easier to use There is weak coupling between clients and subsystems Clients can still communicate directly with susbsystems if necessary

53 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Pattern Category Creational Structural Behavioral

54 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Creational Patterns Handle the instanciation process (how, when, and what objects are created) Handle the configuration of classes and objects Allows a system to work with "product" objects that vary in structure and functionality Abstract Factory Builder Factory Method Prototype Singleton

55 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Structural Patterns Handle the way classes and objects are used in larger structures, and separate interfaces from instanciation Adapter Bridge Composite Decorator Façade Flyweight Proxy

56 8/2001כל הזכויות שמורות לד. מימון ייעוץ והדרכה במחשבים בע"מ Behavioral Patterns Handle algorithms and the division of responsibility between objects, and dynamic interaction between classes and objects. Handle the communication between objects, not only structure –Chain of Responsibility –Command –Interpreter –Iterator –Mediator –Memento –Observer –State –Strategy –Template Method –Visitor