CS342: Software Design. Oct 9, 2017

Similar documents
CS342: Software Design. Oct 3, 2017

CS342: Software Design. November 21, 2017

The Adapter Pattern. Interface with anything!

Applying the Observer Design Pattern

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Design Patterns Design patterns advantages:

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Design Patterns (Part 2) CSCE Lecture 18-10/25/2016 (Partially adapted from Head First Design Patterns by Freeman, Bates, Sierra, and Robson)

The Observer Pattern

Using Design Patterns in Java Application Development

An Introduction to Patterns

The Strategy Pattern Design Principle: Design Principle: Design Principle:

Service-Oriented Architecture (SOA)

Laboratorio di Tecnologie dell'informazione

Where are we? Setup Sprites. Input. Collision Drawing Sprites. Initializing, loading, movement Parameters (color, alpha, scale, etc.

Architectural patterns and models for implementing CSPA

TDDB84 Design Patterns Lecture 09. Interpreter, Facade

Creational. Structural

Design Patterns #3. Reid Holmes. Material and some slide content from: - GoF Design Patterns Book - Head First Design Patterns

Chapter 10 Object-Oriented Design Principles

Web Services. Lecture I. Valdas Rapševičius. Vilnius University Faculty of Mathematics and Informatics

Pattern: Model-View-Controller (MVC) Beat Generator Example. Model-View-Controller. Model-View-Controller

Avancier Methods. Very basic design patterns. It is illegal to copy, share or show this document

Solution register itself

CAS 703 Software Design

MORE DESIGN PATTERNS CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 24 11/10/2011

Enterprise Integration Patterns: Designing, Building, and Deploying Messaging Solutions

Design Process Overview. At Each Level of Abstraction. Design Phases. Design Phases James M. Bieman

Topics in Object-Oriented Design Patterns

INRIA ADT galaxy An open agile SOA platform

An Introduction to Patterns

Design Patterns: Structural and Behavioural

CSE 331. Model/View Separation and Observer Pattern

Object-Oriented Design

2/12/15. Template Method. Design Patterns. In Swing s JComponent. Template Method. Where do template methods come from? Making Template Methods

Design Patterns Reid Holmes

CSE 219 COMPUTER SCIENCE III STRUCTURAL DESIGN PATTERNS SLIDES COURTESY: RICHARD MCKENNA, STONY BROOK UNIVERSITY.

1 Software Architecture

07. ADAPTER AND FACADE PATTERNS. Being Adaptive

Software Architecture With ColdFusion: Design Patterns and Beyond Topics Outline Prepared by Simon Horwith for CFUnderground 6

Context-aware Services for UMTS-Networks*

Integration Test Plan. Angry Face Studios

Unit 6 - Software Design and Development LESSON 1 INTRODUCTION

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Let me begin by introducing myself. I have been a Progress Application Partner since 1986 and for many years I was the architect and chief developer

Application Architectures, Design Patterns

Design Patterns. it s about the Observer pattern, the Command pattern, MVC, and some GUI. some more

Software Architecture

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

Software MEIC. (Lesson 20)

Web Services. Lecture I. Valdas Rapševičius Vilnius University Faculty of Mathematics and Informatics

Lecture 21: Design Patterns (Part 3)

Object-Oriented Concepts and Design Principles

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Design Patterns. Decorator. Oliver Haase

Azure Integration Services

Expanding Our Horizons. CSCI 4448/5448: Object-Oriented Analysis & Design Lecture 9 09/25/2011

Information Quality & Service Oriented Architecture

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Data Management CS 4720 Mobile Application Development

As a programmer, you know how easy it can be to get lost in the details

Object- Oriented Design with UML and Java Part I: Fundamentals

Adapter pattern. Acknowledgement: Freeman & Freeman

CSE 70 Final Exam Fall 2009

And Even More and More C++ Fundamentals of Computer Science

Tecniche di Progettazione: Design Patterns

Relationships amongst Objects

Principles of Software Construction: Objects, Design, and Concurrency. Assigning Responsibilities to Objects. toad. Jonathan Aldrich Charlie Garrod

340 Review Fall Midterm 1 Review

Model-View-Controller Architecture

TKA Knights Shutterfly Team Websites

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

Oracle Exam 1z0-478 Oracle SOA Suite 11g Certified Implementation Specialist Version: 7.4 [ Total Questions: 75 ]

OPUS Drag and Drop Word Searches

ANDROID APPS DEVELOPMENT FOR MOBILE AND TABLET DEVICE (LEVEL II)

Design patterns. Jef De Smedt Beta VZW

Events in Oracle Eloqua

From Design Patterns: Elements of Reusable Object Oriented Software. Read the sections corresponding to patterns covered in the following slides.

Tuesday, October 4. Announcements

Software Design Heuristics

Case studies: Outline Case Study: Noughts and Crosses

RELEVANCE OF DESIGN PATTERNS TODAY

MVC / MVP Mei Nagappan

Principles of Software Construction: Objects, Design, and Concurrency

ACID Is So Yesterday: Maintaining Data Consistency with Sagas

CS 370 Design Heuristics D R. M I C H A E L J. R E A L E F A L L

Material and some slide content from: - GoF Design Patterns Book. Design Patterns #1. Reid Holmes. Lecture 11 - Tuesday October

Test-Driven Development (TDD)

SCALE. A language for dynamic composition of heterogeneous services

Cocoa Design Patterns. Erik M. Buck October 17, 2009

GRASP Design Patterns A.A. 2018/2019

CIS Component-Based Software Design BAPTISM BY FIRE AN INTRODUCTION TO COURSE ESSENTIALS. Suggestions on the Design of Your Game of Nim Project

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

CS 170 Java Programming 1. Week 15: Interfaces and Exceptions

The Design Patterns Matrix From Analysis to Implementation

Introduction to concurrency and GUIs

Lesson 2. Introducing Apps. In this lesson, you ll unlock the true power of your computer by learning to use apps!

Development and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns

IBM Atlas Policy Distribution Administrators Guide: IER Connector. for IBM Atlas Suite v6

Transcription:

CS342: Software Design Oct 9, 2017

Outline Facade pattern Observer pattern

Homework 1 classes Human player replaces a card 1. Main <--> UserPlayer 2. Main ->CardPile 3. CardPile -> Card -> Main 4. Main -> Card -> UserPlayer Game 2 1 ComputerPlayer 4 UserPlayer CardPile 3 Card 3

Player Base class: common fields and methods for user and computer - Add a card to hand - Discard a card - Has flus, has four suit, has etc - Calculate rank - Cal # of cards u can discard - Get hand Card Pile - Shuffle - Deal a card Card - Number, suit, string Game Session: main logic and workflow - Set up pile - Instantiate Players - Deal to Players - Players replace cards - Decide results and winners User Player - Interactive selection Five CardDraw (Main): UI and orchestration - Prompt # of players - Trigger dealing - User's turn - AI's turn - Display results Computer Player - AI function Project 1 class redesigned

Home theater components

To watch a movie, you need to...

Introducing HomeTheaterFacade Treat components as a subsystem Orchestrates functions of components to perform a higher level task Provide a simplified interface to client. Integrate, not encapsulate: subsystem still available to client Decouples client from componentts

HomeTheaterFacade classes

Facade pattern defined Provides a unified interface to a set of interfaces in a subsystem. Avoid tight coupling between client and subsystem Better structured and easier to read code

The Principle of Least Knowledge Talk only to your immediate friends.. Reduce interactions between objects If lots of objects have dependencies with each other, it s hard to make changes, and systems becomes fragile Guideline: an object s method only calls methods that belong to The object itself Objects passed in as a parameter Any objects the method creates Any components of the object Implying don t call methods of an object returned by calling other methods Otherwise, we increase the number of objects that the class direct knows

Do s and Dont s

Facade and Principle of least knowldge

Weather monitoring application

Weather monitoring application

Issues with the implementation Coding to concrete implementation When we need to add, remove, modify display features, will need to change client Display objects have the same method signature, but different behaviors (sounds familiar?) Encapsulate them -- but how? Observation pattern

Observer pattern: publish & subscribe One to many dependency between objects When source/subject /publisher state changes, all dependents/observer /subscribers are notified and updated automatically There are many different ways to implement

Class diagram Loosely coupled objects Subjects and observers barely know each other A subject class only implements the interface, it doesn t know or care who subscribe to it Observer can be added any time Reuse subjects and observers Changing either doesn t affect the other

Weather station class design

Weather station code

Observer 1: current condition display

Main function (client)

I m still not 100% happy with my code... We have to repeat some code across all classes implementing Subject registerobserver, removeobserver, notifyobserver Can we create some framework so we don t copy and paste them?

Java s built-in observer pattern

Built-in vs. home-brew code for subject

Observer using built-in support

Built-in: no guarantee order of observer notification Is it too much to ask the order to be consistent?

Enterprise Service Bus (ESB) Implements a communication system between mutually interacting software applications in a service-oriented architecture (SOA) Distributed computing A service does something and publishes an event on the bus Subscribing services picks up the event and take actions Typical Observer pattern Agile, loosely couple services