November 200491.3913 Ron McFadyen1 Composite Pattern A composite is a group of objects in which some objects contain others; one object may represent groups,

Slides:



Advertisements
Similar presentations
A Brief Introduction to Test- Driven Development Shawn M. Jones.
Advertisements

Winter 2007ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
Jan 23, Ron McFadyen1 SSD for a samplePOS Use Case Figure 13.1 Input Events invoke a system operation of the same name same idea as in object-oriented.
Feb 18, R McFadyen > An approach promoted by Martin Fowler in Analysis Patterns.
Oct 22, Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
March Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Jan Ron McFadyen1 Singleton To guarantee that there is at most one instance of a class we can apply the singleton pattern. Singleton Static.
Fall 2009ACS-3913 Ron McFadyen Composite Pattern Problem: How do we treat a composition structure of objects the same way as a non-composite object? Arises.
Nov R McFadyen1 Design Patterns (GoF) contains the creational patterns: Abstract factory Builder Factory method (section 23.3 has a Simple.
Fall 2009ACS-3913 Ron McFadyen1 Decorator Pattern The Decorator pattern allows us to enclose an object inside another object. The enclosing object is called.
Feb Ron McFadyen1 Iterator Pattern Recall Generic UML class diagram The iterator is used to access the elements of some aggregate. The aggregate.
Patterns – Day 9 Façade Composite Reminders: Faculty candidate talk Friday 4:20 PM O-267. Brian Postow: Games and Complexity Theory Another talk on Monday!
Sept 2004Ron McFadyen Decorator Pattern The decorator pattern allows us to enclose an object inside another object. The enclosing object is called.
Fall 2007ACS Ron McFadyen1 Composite Pattern (see pages ) A composite is a group of objects in which some objects contain others; one object.
Fall 2009ACS Ron McFadyen1 The context maintains an instance of a concrete state subclass State Pattern Each subclass (concrete state) implements.
Spring 2010ACS-3913 Ron McFadyen1 Command The command pattern encapsulates a request or unit of work into an object. An invoker will ask a concrete command.
Feb Ron McFadyen1 Iterator Pattern Generic UML class diagram The iterator is used to access the elements of some aggregate. The aggregate interface.
ACS-3913Fall 2009 Ron McFadyen1 Contracts Used to help understand requirements more completely (and so may not always be necessary) based on assertions;
The Need for Packages How do you break down a large system into smaller systems? Structured methods use functional decomposition Functions represent something.
Oct Ron McFadyen1 Collaborations Collaboration : an arrangement of classes, links, roles in a context to implement some behaviour. Useful for.
Winter 2015ACS Ron McFadyen1 Composite Pattern A composite is a group of objects in which some objects contain others; one object may represent.
November Ron McFadyen1 Design Class Diagrams n Class diagram with – classes – associations – attributes – methods – navigability – interfaces,
Presentation Outline What is JUnit? Why Use JUnit? JUnit Features Design of JUnit Downloading JUnit Writing Tests – TestCase – TestSuite Organizing The.
Spring 2010ACS-3913 Ron McFadyen1 Duck Example Consider the text example (up to page 6). Each type of duck is a subclass of Duck Most subclasses implement.
Programmer Testing Testing all things Java using JUnit and extensions.
A Survey of Software Refactoring Tom Mens, Tom Tourwé
JUnit The framework. Goal of the presentation showing the design and construction of JUnit, a piece of software with proven value.
Refactoring Cristescu Marilena. Definitions Loose Usage: Reorganize a program(or something) As a noun: a change made to the internal structure of some.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 4 Slide 1 Slide 1 Architectural Design.
Sadegh Aliakbary Sharif University of Technology Spring 2012.
Design and Programming Chapter 7 Applied Software Project Management, Stellman & Greene See also:
Sept Ron McFadyen1 UML & Design Patterns Course outlineoutline /3 Advanced Systems Design.
11 Partnership for Performance How to hear this lecture Click on the icon: to hear the narration for each slide.
Course Overview & Topics CSc 335: Object-Oriented Programming and Design © Rick Mercer 1.
Software Engineering 1 Object-oriented Analysis and Design Chap 21 Test-Driven Development and Refactoring.
Jan Ron McFadyen1 Decorator Sometimes we need a way to add responsibilities to an object dynamically and transparently. The Decorator pattern.
Refactoring1 Refactoring DEPARTMENT OF COMPUTER SCIENCE AND SOFTWARE ENGINEERING CONCORDIA UNIVERSITY February 6, 2009.
Refactoring An Automated Tool for the Tiger Language Leslie A Hensley
1-1 C Sc 335 Course Overview Object-Oriented Programming and Design Rick Mercer.
©Ian Sommerville 2006Software Engineering, 8th edition. Chapter 11 Slide 1 Design.
Refactoring1 Improving the structure of existing code.
Alcatel-Lucent CDC Workshop, Coaching & Knowledge Transfer Coding.
A Practical Guide To Unit Testing John E. Boal TestDrivenDeveloper.com.
Sept Ron McFadyen1 Today Sept 16: Chapters 1, 2, 3 Introductory material Next Tuesday Sept 21: Rational Rose and Use Cases Chapter 6 - Use.
Incremental Design Why incremental design? Goal of incremental design Tools for incremental design  UML diagrams  Design principles  Design patterns.
Software Engineering CS3003 Lecture 4 Code bad smells and refactoring.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Investigation of Opportunities for Refactoring.
RE’05 The 13 th International conference on Requirements Engineering Reverse Engineering Goal Models from Legacy Code Yijun Yu 1 Yiqiao Wang 1 John Mylopoulos.
Sadegh Aliakbary Sharif University of Technology Spring 2011.
Computer Science Topical Paper Presentation #NN Presenter Name Pattern Name P a t t e r n X Y Z – P a g e 1 Original Paper Title by Paper Author.
Using UML, Patterns, and Java Object-Oriented Software Engineering Chapter 11, Testing.
Five design principles
Chapter 16 UML Class Diagrams 1CS6359 Fall 2012 John Cole.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall Object-Oriented Systems Analysis and Design Using UML Systems Analysis and Design,
Refactoring. 2 Process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal.
1 JUnit. 2 Unit Testing with JUnit If code has no automated test case written for it to prove that it works, it must be assumed not to work. An API that.
Software Engineering 1 Object-oriented Analysis and Design Applying UML and Patterns An Introduction to Object-oriented Analysis and Design and Iterative.
Principles and examples
Unit testing Java programs Using JUnit
Design Patterns (GoF) contains the creational patterns:
Reverse Engineering Goal Models from Legacy Code
Composite Pattern Oct 7, 2003 A composite is a group of objects in which some objects contain others; one object may represent groups, and another.
State Design Pattern 1.
Code Smells 1.
Advanced Programming Behnam Hatami Fall 2017.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Graphical User Interfaces in Java Event-driven programming
References: Eddie Burris, Rick Mercer
Decorator Pattern The decorator pattern allows us to enclose an object inside another object. The enclosing object is called a decorator. The other object.
Refactoring.
Presentation transcript:

November Ron McFadyen1 Composite Pattern A composite is a group of objects in which some objects contain others; one object may represent groups, and another may represent an individual item, a leaf.

November Ron McFadyen2 Composite Pattern Generic UML class diagram Component Operation() Leaf Operation() Composite Operation() Other() * Client

November Ron McFadyen3 Composite Pattern Consider the handout from Refactoring by Martin Fowler “Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code yet improves its internal structure.” P 76 Long Method: “object programs … short methods” “the longer a procedure is, the more difficult it is to understand” “A heuristic we follow is that whenever we feel the need to comment something, we write a method instead” “How do you identify the clumps of code to extract? A good technique is to look for comments. They often signal a kind of semantic distance.”

November Ron McFadyen4 Composite Pattern Refactoring by Martin Fowler Figure 4.1. The composite structure of tests Test TestSuiteTestCase FileReaderTester junit.framework *

November Ron McFadyen5 Composite Pattern Junit is a testing framework for Java (If interested, see Any class that contains a test, must be subclassed from TestCase Tests can be grouped into test suites Pages illustrate how to use junit to manage a suite of tests We’ll look at an example for NextGenPOS