Download presentation
Presentation is loading. Please wait.
Published byMeryl Green Modified over 9 years ago
1
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, and another may represent an individual item, a leaf.
2
November 200491.3913 Ron McFadyen2 Composite Pattern Generic UML class diagram Component Operation() Leaf Operation() Composite Operation() Other() * Client
3
November 200491.3913 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.”
4
November 200491.3913 Ron McFadyen4 Composite Pattern Refactoring by Martin Fowler Figure 4.1. The composite structure of tests Test TestSuiteTestCase FileReaderTester junit.framework *
5
November 200491.3913 Ron McFadyen5 Composite Pattern Junit is a testing framework for Java (If interested, see www.junit.org)www.junit.org Any class that contains a test, must be subclassed from TestCase Tests can be grouped into test suites Pages 92-93 illustrate how to use junit to manage a suite of tests We’ll look at an example for NextGenPOS
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.