Application of Patterns to Real-Time Object-Oriented Software Design
Total Page:16
File Type:pdf, Size:1020Kb
APPLICATION OF PATTERNS TO REAL-TIME OBJECT-ORIENTED SOFTWARE DESIGN by ROSS ALBERT MCKEGNEY A thesis submitted to the Department of Computing & Information Science in conformity with the requirements for the degree of Master of Science Queen’s University, Kingston, Ontario Canada July 2000 Copyright © Ross Albert McKegney, 2000 ABSTRACT The design and development of real-time software (i.e. software that must ensure timeliness while interacting with an external environment) is more difficult than for most other software. Modeling tools help deal with this complexity, allowing developers to view the system at various levels of abstraction, animate the models in a simulation environment, and even generate the code for a variety of target hardware/RTOS configurations. A natural extension to these tools is to provide support for design patterns (a method of documenting experience in the form of problem/context/solution triples for recurring problems). Such an extension provides yet another layer of abstraction to the models, and makes explicit the application of design patterns. This thesis will extract from the patterns literature a set of patterns dealing with issues relevant to the design of real-time object-oriented software (in order to demonstrate their variety and quality) - then will propose an extension to Rational Rose-RT to support patterns as an abstraction layer. ii ACKOWLEDGMENTS I would like to acknowledge my supervisor, Dr. Terry Shepard, for his guidance and direction throughout the writing of this thesis. I also acknowledge the members of my ‘hot-topics’ group at ChiliPLoP 2000: Mary-Lynn Manns (UNCS), Linda Rising (AGCS), Don Olson (AGCS), John Letourneau (Lucent Technologies), and Carol Stimmel (MediaOne Labs) for introducing me to pattern writing workshops. Also Grant Larsen of Blueprint-Technologies for providing a free copy of Framework Studio, and Francis Bordeleau (Carleton University) for reading and commenting on drafts of this thesis. Finally, I would like to thank my fiancé Sarah – for all her love and support. iii TABLE OF CONTENTS ACKOWLEDGMENTS................................................................................................................... III TABLE OF CONTENTS ..................................................................................................................IV LIST OF TABLES ...........................................................................................................................VII LIST OF FIGURES ....................................................................................................................... VIII CHAPTER 1: INTRODUCTION ......................................................................................................1 1.1 MOTIVATION................................................................................................................................1 1.2 PROBLEM......................................................................................................................................2 1.3 OBJECTIVES..................................................................................................................................2 1.4 ORGANIZATION OF CONTRIBUTIONS ..........................................................................................3 CHAPTER 2: PATTERNS.................................................................................................................4 2.1 PATTERN ORIGINS – CHRISTOPHER ALEXANDER ......................................................................4 2.1.1 Pattern Languages...............................................................................................................5 2.2 SOFTWARE PATTERNS .................................................................................................................5 2.2.1 Design Patterns....................................................................................................................6 2.2.2 Other Pattern Types.............................................................................................................8 2.3 RELATED RESEARCH .................................................................................................................10 2.3.1 Frameworks........................................................................................................................10 2.3.2 Refactoring.........................................................................................................................11 2.4 SUMMARY ..................................................................................................................................11 CHAPTER 3: REAL-TIME OBJECT-ORIENTED MODELING ............................................12 3.1 REAL-TIME SYSTEMS.................................................................................................................12 3.1.1 Environment .......................................................................................................................13 3.1.2 Effectors & Sensors............................................................................................................13 3.1.3 Hardware Interface............................................................................................................14 3.1.4 Software..............................................................................................................................14 3.2 OBJECT ORIENTATION IN REAL-TIME SOFTWARE....................................................................15 3.3 REAL-TIME OBJECT-ORIENTED PROGRAMMING LANGUAGES.................................................16 3.3.1 Ada 95 ................................................................................................................................16 3.3.2 C++....................................................................................................................................18 3.3.3 Java ....................................................................................................................................18 3.4 RTOO MODELING NOTATIONS & TOOLS ................................................................................19 3.4.1 SDL.....................................................................................................................................19 3.4.2 ROOM ................................................................................................................................20 3.4.3 Statecharts..........................................................................................................................21 3.4.4 UML....................................................................................................................................23 3.5 SUMMARY ..................................................................................................................................25 CHAPTER 4: EXPERIENCES WITH RTOO DESIGN PATTERNS ......................................27 4.1 GENERAL DESIGN PATTERNS EXPERIENCES ............................................................................27 iv 4.1.1 Industrial Experience with Design Patterns .....................................................................27 4.1.2 Patterns in Practice ...........................................................................................................31 4.1.3 Pros and Cons of Adopting and Applying Design Patterns .............................................32 4.1.4 Using Design Patterns to Develop Reusable OO Communication Software...................33 4.1.5 Using Design Patterns Against a Moving Target .............................................................34 4.1.6 How to Preserve the Benefits of Design Patterns .............................................................35 4.2 DESIGN PATTERNS AND FRAMEWORKS....................................................................................36 4.2.1 Speech Recognition Framework........................................................................................36 4.2.2 Communication Software Framework ..............................................................................37 4.2.3 Vessel Control Systems Framework..................................................................................38 4.3 SUMMARY ..................................................................................................................................39 CHAPTER 5: SURVEY OF REAL-TIME OBJECT-ORIENTED DESIGN PATTERNS ...41 5.1 WIDELY APPLICABLE RTOO DESIGN PATTERNS ....................................................................41 5.1.1 Douglass’ Real-time Design Patterns ...............................................................................42 5.1.2 Schmidt et. al.’s Patterns for Concurrent, Parallel, and Distributed Systems.................44 5.1.3 Real-time Constraints as Strategies Pattern .....................................................................48 5.1.4 Multithreaded Rendezvous Pattern ...................................................................................48 5.1.5 Recursive Control Pattern .................................................................................................49 5.1.6 Recoverable Distributor Pattern .......................................................................................49 5.2 DOMAIN SPECIFIC RTOO DESIGN PATTERNS..........................................................................50 5.2.1 Process Control Patterns...................................................................................................50