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 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
Recommended publications
  • Neuroscience, the Natural Environment, and Building Design
    Neuroscience, the Natural Environment, and Building Design. Nikos A. Salingaros, Professor of Mathematics, University of Texas at San Antonio. Kenneth G. Masden II, Associate Professor of Architecture, University of Texas at San Antonio. Presented at the Bringing Buildings to Life Conference, Yale University, 10-12 May 2006. Chapter 5 of: Biophilic Design: The Theory, Science and Practice of Bringing Buildings to Life, edited by Stephen R. Kellert, Judith Heerwagen, and Martin Mador (John Wiley, New York, 2008), pages 59-83. Abstract: The human mind is split between genetically-structured neural systems, and an internally-generated worldview. This split occurs in a way that can elicit contradictory mental processes for our actions, and the interpretation of our environment. Part of our perceptive system looks for information, whereas another part looks for meaning, and in so doing gives rise to cultural, philosophical, and ideological constructs. Architects have come to operate in this second domain almost exclusively, effectively neglecting the first domain. By imposing an artificial meaning on the built environment, contemporary architects contradict physical and natural processes, and thus create buildings and cities that are inhuman in their form, scale, and construction. A new effort has to be made to reconnect human beings to the buildings and places they inhabit. Biophilic design, as one of the most recent and viable reconnection theories, incorporates organic life into the built environment in an essential manner. Extending this logic, the building forms, articulations, and textures could themselves follow the same geometry found in all living forms. Empirical evidence confirms that designs which connect humans to the lived experience enhance our overall sense of wellbeing, with positive and therapeutic consequences on physiology.
    [Show full text]
  • Open Source Architecture, Began in Much the Same Way As the Domus Article
    About the Authors Carlo Ratti is an architect and engineer by training. He practices in Italy and teaches at the Massachusetts Institute of Technology, where he directs the Senseable City Lab. His work has been exhibited at the Venice Biennale and MoMA in New York. Two of his projects were hailed by Time Magazine as ‘Best Invention of the Year’. He has been included in Blueprint Magazine’s ‘25 People who will Change the World of Design’ and Wired’s ‘Smart List 2012: 50 people who will change the world’. Matthew Claudel is a researcher at MIT’s Senseable City Lab. He studied architecture at Yale University, where he was awarded the 2013 Sudler Prize, Yale’s highest award for the arts. He has taught at MIT, is on the curatorial board of the Media Architecture Biennale, is an active protagonist of Hans Ulrich Obrist’s 89plus, and has presented widely as a critic, speaker, and artist in-residence. Adjunct Editors The authorship of this book was a collective endeavor. The text was developed by a team of contributing editors from the worlds of art, architecture, literature, and theory. Assaf Biderman Michele Bonino Ricky Burdett Pierre-Alain Croset Keller Easterling Giuliano da Empoli Joseph Grima N. John Habraken Alex Haw Hans Ulrich Obrist Alastair Parvin Ethel Baraona Pohl Tamar Shafrir Other titles of interest published by Thames & Hudson include: The Elements of Modern Architecture The New Autonomous House World Architecture: The Masterworks Mediterranean Modern See our websites www.thamesandhudson.com www.thamesandhudsonusa.com Contents
    [Show full text]
  • Design Patterns Promote Reuse
    Design Patterns Promote Reuse “A pattern describes a problem that occurs often, along with a tried solution to the problem” - Christopher Alexander, 1977 • Christopher Alexander’s 253 (civil) architectural patterns range from the creation of cities (2. distribution of towns) to particular building problems (232. roof cap) • A pattern language is an organized way of tackling an architectural problem using patterns Kinds of Patterns in Software • Architectural (“macroscale”) patterns • Model-view-controller • Pipe & Filter (e.g. compiler, Unix pipeline) • Event-based (e.g. interactive game) • Layering (e.g. SaaS technology stack) • Computation patterns • Fast Fourier transform • Structured & unstructured grids • Dense linear algebra • Sparse linear algebra • GoF (Gang of Four) Patterns: structural, creational, behavior The Gang of Four (GoF) • 23 structural design patterns • description of communicating objects & classes • captures common (and successful) solution to a category of related problem instances • can be customized to solve a specific (new) problem in that category • Pattern ≠ • individual classes or libraries (list, hash, ...) • full design—more like a blueprint for a design The GoF Pattern Zoo 1. Factory 13. Observer 14. Mediator 2. Abstract factory 15. Chain of responsibility 3. Builder Creation 16. Command 4. Prototype 17. Interpreter 18. Iterator 5. Singleton/Null obj 19. Memento (memoization) 6. Adapter Behavioral 20. State 21. Strategy 7. Composite 22. Template 8. Proxy 23. Visitor Structural 9. Bridge 10. Flyweight 11.
    [Show full text]
  • Applying the Proactor Pattern to High-Performance Web Servers
    APPLYING THE PROACTOR PATTERN TO HIGH-PERFORMANCE WEB SERVERS James Hu Irfan Pyarali Douglas C. Schmidt [email protected],edu [email protected] [email protected] Department of Computer Science, Washington University St. Louis, MO 63130, USA This paper is to appear at the 10th International Confer- 1 INTRODUCTION ence on Parallel and Distributed Computing and Systems, IASTED, Las Vegas, Nevada, October 28-31, 1998. Computing power and network bandwidth on the Internet has increased dramatically over the past decade. High- speed networks (such as ATM and Gigabit Ethernet) and high-performance I/O subsystems (such as RAID) are be- ABSTRACT coming ubiquitous. In this context, developing scalable Web servers that can exploit these innovations remains a Modern operating systems provide multiple concurrency key challenge for developers. Thus, it is increasingly im- mechanisms to develop high-performance Web servers. portant to alleviate common Web server bottlenecks, such Synchronous multi-threading is a popular mechanism for as inappropriate choice of concurrency and dispatching developing Web servers that must perform multiple oper- strategies, excessive filesystem access, and unnecessary ations simultaneously to meet their performance require- data copying. ments. In addition, an increasing number of operating sys- Our research vehicle for exploring the performance im- tems support asynchronous mechanisms that provide the pact of applying various Web server optimization tech- benefits of concurrency, while alleviating much of the per- niques is the JAWS Adaptive Web Server (JAWS) [1]. JAWS formance overhead of synchronous multi-threading. is both an adaptive Web server and a development frame- This paper provides two contributions to the study of work for Web servers that runs on multiple OS platforms high-performance Web servers.
    [Show full text]
  • The Origins of Pattern Theory: the Future of the Theory, and the Generation of a Living World
    www.computer.org/software The Origins of Pattern Theory: The Future of the Theory, and the Generation of a Living World Christopher Alexander Vol. 16, No. 5 September/October 1999 This material is presented to ensure timely dissemination of scholarly and technical work. Copyright and all rights therein are retained by authors or by other copyright holders. All persons copying this information are expected to adhere to the terms and constraints invoked by each author's copyright. In most cases, these works may not be reposted without the explicit permission of the copyright holder. © 2006 IEEE. Personal use of this material is permitted. However, permission to reprint/republish this material for advertising or promotional purposes or for creating new collective works for resale or redistribution to servers or lists, or to reuse any copyrighted component of this work in other works must be obtained from the IEEE. For more information, please see www.ieee.org/portal/pages/about/documentation/copyright/polilink.html. THE ORIGINS OF PATTERN THEORY THE FUTURE OF THE THEORY, AND THE GENERATION OF A LIVING WORLD Christopher Alexander Introduction by James O. Coplien nce in a great while, a great idea makes it across the boundary of one discipline to take root in another. The adoption of Christopher O Alexander’s patterns by the software community is one such event. Alexander both commands respect and inspires controversy in his own discipline; he is the author of several books with long-running publication records, the first recipient of the AIA Gold Medal for Research, a member of the Swedish Royal Academy since 1980, a member of the American Academy of Arts and Sciences, recipient of dozens of awards and honors including the Best Building in Japan award in 1985, and the American Association of Collegiate Schools of Architecture Distinguished Professor Award.
    [Show full text]
  • Frontiers of Pattern Language Technology
    Frontiers of Pattern Language Technology Pattern Language, 1977 Network of Relationships “We need a web way of thinking.” - Jane Jacobs Herbert Simon, 1962 “The Architecture of Complexity” - nearly decomposable hierarchies (with “panarchic” connections - Holling) Christopher Alexander, 1964-5 “A city is not a tree” – its “overlaps” create clusters, or “patterns,” that can be manipulated more easily (related to Object-Oriented Programming) The surprising existing benefits of Pattern Language technology.... * “Design patterns” used as a widespread computer programming system (Mac OS, iPhone, most games, etc.) * Wiki invented by Ward Cunningham as a direct outgrowth * Direct lineage to Agile, Scrum, Extreme Programming * Pattern languages used in many other fields …. So why have they not been more infuential in the built environment??? Why have pattern languages not been more infuential in the built environment?.... * Theory 1: “Architects are just weird!” (Preference for “starchitecure,” extravagant objects, etc.) * Theory 2: The original book is too “proprietary,” not “open source” enough for extensive development and refinement * Theory 3: The software people, especially, used key strategies to make pattern languages far more useful, leading to an explosion of useful new tools and approaches …. So what can we learn from them??? * Portland, OR. Based NGO with international network of researchers * Executive director is Michael Mehaffy, student and long-time colleague of Christopher Alexander, inter-disciplinary collaborator in philosophy, sciences, public affairs, business and economics, architecture, planning * Board member is Ward Cunningham, one of the pioneers of pattern languages in software, Agile, Scrum etc., and inventor of wiki * Other board members are architects, financial experts, former students of Alexander Custom “Project Pattern Languages” (in conventional paper format) Custom “Project Pattern Languages” create the elements of a “generative code” (e.g.
    [Show full text]
  • The Origins of Pattern Theory the Future of the Theory, and the Generation of a Living World
    THE ORIGINS OF PATTERN THEORY THE FUTURE OF THE THEORY, AND THE GENERATION OF A LIVING WORLD Christopher Alexander Introduction by James O. Coplien nce in a great while, a great idea makes it across the boundary of one discipline to take root in another. The adoption of Christopher O Alexander’s patterns by the software community is one such event. Alexander both commands respect and inspires controversy in his own discipline; he is the author of several books with long-running publication records, the first recipient of the AIA Gold Medal for Research, a member of the Swedish Royal Academy since 1980, a member of the American Academy of Arts and Sciences, recipient of dozens of awards and honors including the Best Building in Japan award in 1985, and the American Association of Collegiate Schools of Architecture Distinguished Professor Award. It is odd that his ideas should have found a home in software, a discipline that deals not with timbers and tiles but with pure thought stuff, and with ephemeral and weightless products called programs. The software community embraced the pattern vision for its relevance to problems that had long plagued software design in general and object-oriented design in particular. September/October 1999 IEEE Software 71 Focusing on objects had caused us to lose the pattern discipline that the software community has system perspective. Preoccupation with design yet scarcely touched: the moral imperative to build method had caused us to lose the human perspec- whole systems that contribute powerfully to the tive. The curious parallels between Alexander’s quality of life, as we recognize and rise to the re- world of buildings and our world of software con- sponsibility that accompanies our position of influ- struction helped the ideas to take root and thrive in ence in the world.
    [Show full text]
  • Assessing Alexander's Later Contributions to a Science of Cities
    Review Assessing Alexander’s Later Contributions to a Science of Cities Michael W. Mehaffy KTH Royal Institute of Technology, 114 28 Stockholm, Sweden; mmehaff[email protected] or michael.mehaff[email protected] Received: 23 April 2019; Accepted: 28 May 2019; Published: 30 May 2019 Abstract: Christopher Alexander published his longest and arguably most philosophical work, The Nature of Order, beginning in 2003. Early criticism assessed that text to be a speculative failure; at best, unrelated to Alexander’s earlier, mathematically grounded work. On the contrary, this review presents evidence that the newer work was a logically consistent culmination of a lifelong and remarkably useful inquiry into part-whole relations—an ancient but still-relevant and even urgent topic of design, architecture, urbanism, and science. Further evidence demonstrates that Alexander’s practical contributions are remarkably prodigious beyond architecture, in fields as diverse as computer science, biology and organization theory, and that these contributions continue today. This review assesses the potential for more particular contributions to the urban professions from the later work, and specifically, to an emerging “science of cities.” It examines the practical, as well as philosophical contributions of Alexander’s proposed tools and methodologies for the design process, considering both their quantitative and qualitative aspects, and their potential compatibility with other tools and strategies now emerging from the science of cities. Finally, it highlights Alexander’s challenge to an architecture profession that seems increasingly isolated, mired in abstraction, and incapable of effectively responding to larger technological and philosophical challenges. Keywords: Christopher Alexander; The Nature of Order; pattern language; structure-preserving transformations; science of cities 1.
    [Show full text]
  • Introducing Patterns (Or Any New Idea) Into Organizations
    Introducing Patterns (or any new idea) into Organizations ** A WORK-IN-PROGRESS ** Last Update: August 8, 2001 Copyright © 2001, Mary Lynn Manns, Linda Rising Mary Lynn Manns Linda Rising University of North Carolina at Asheville 1109 E. Tapatio Dr. Department of Management & Accountancy Phoenix, AZ 85020-1185 USA Asheville, NC 28804 USA [email protected] [email protected] Submitted to PLoP’01 August 8, 2001 Note: Since we have been working on this document for many years, there are quite a few patterns in this growing language-in-progress. However, many of the patterns have been shepherded and workshopped at previous PLoPs and other events -- this information is noted at the end of each of these patterns. In order to prevent those who shepherd and workshop these patterns for PLoP’01 from becoming too overwhelmed, we ask that they read the complete document (in order to understand the domain), provide feedback on anything, but concentrate their efforts on the patterns that have not yet been exposed to review. These are designated with asterisks in the pattern list on the next page. Thank you! The work in using and writing patterns began with Christopher Alexander who wrote A Timeless Way of Building [Alexander79] and A Pattern Language [Alexander+77] in the 1970s. When the software community began studying his ideas, interest in patterns began to spread throughout the software development industry in the 1990s. However, efforts to introduce patterns into organizations have had mixed success. The patterns presented here are the beginning of a pattern language whose focus is the introduction of patterns into an organization, with the long-term goal of developing a patterns culture.
    [Show full text]
  • A Design Framework for Highly Concurrent Systems
    A Design Framework for Highly Concurrent Systems Matt Welsh, Steven D. Gribble, Eric A. Brewer, and David Culler Computer Science Division University of California, Berkeley Berkeley, CA 94720 USA mdw,gribble,brewer,culler @cs.berkeley.edu f g Abstract In addition to high concurrency, Internet services have three other properties which necessitate a fresh Building highly concurrent systems, such as large-scale look at how these systems are designed: burstiness, Internet services, requires managing many information flows continuous demand, and human-scale access latency. at once and maintaining peak throughput when demand ex- Burstiness of load is fundamental to the Internet; deal- ceeds resource availability. In addition, any platform sup- ing with overload conditions must be designed into the porting Internet services must provide high availability and be able to cope with burstiness of load. Many approaches system from the beginning. Internet services must also to building concurrent systems have been proposed, which exhibit very high availability, with a downtime of no generally fall into the two categories of threaded and event- more than a few minutes a year. Finally, because ac- driven programming. We propose that threads and events cess latencies for Internet services are at human scale are actually on the ends of a design spectrum, and that and are limited by WAN and modem access times, an the best implementation strategy for these applications is important engineering tradeoff to make is to optimize somewhere in between. for high throughput rather than low latency. We present a general-purpose design framework for build- ing highly concurrent systems, based on three design com- Building highly concurrent systems is inherently dif- ponents | tasks, queues, and thread pools | which encapsu- ficult.
    [Show full text]
  • Leader/Followers a Design Pattern for Efficient Multi-Threaded I/O
    Leader/Followers A Design Pattern for Efficient Multi-threaded I/O Demultiplexing and Dispatching Douglas C. Schmidt and Carlos O’Ryan g fschmidt,coryan @uci.edu Electrical and Computer Engineering Dept. University of California, Irvine, CA 92697, USA Michael Kircher Irfan Pyarali [email protected] [email protected] Siemens Corporate Technology Department of Computer Science, Washington University Munich, Germany St. Louis, MO 63130, USA 1 Intent The front-end communication servers are actually “hybrid” client/server applications that perform two primary tasks. The Leader/Followers design pattern provides a concurrency First, they receive requests arriving simultaneously from hun- model where multiple threads can efficiently demultiplex dreds or thousands of remote clients over wide area commu- events and dispatch event handlers that process I/O handles nication links, such as X.25 or the TCP/IP. Second, they vali- shared by the threads. date the remote client requests and forward valid requests over TCP/IP connections to back-end database servers. In contrast, the back-end database servers are “pure” servers that perform 2 Example the designated transactions. After a transaction commits, the database server returns its results to the associated commu- Consider the design of a multi-tier, high-volume, on-line trans- nication server, which then forwards the results back to the action processing (OLTP) system shown in the following fig- originating remote client. ure. In this design, front-end communication servers route FRONT--END BACK--END The servers in this OLTP system spend most of their time COMM.. SERVERS DATABASE SERVERS processing various types of I/O operations in response to re- quests.
    [Show full text]
  • Introduction to Patterns and Frameworks
    OO Patterns Douglas C. Schmidt Patterns and Frameworks Introduction to Patterns and Frameworks Motivation for Patterns and Frameworks Douglas C. Schmidt What is a Pattern? A Framework? Professor Department of EECS Pattern Categories [email protected] Vanderbilt University www.cs.wustl.edu/ schmidt/ (615) 343-8197 Pattern Examples Vanderbilt University 1 OO Patterns Douglas C. Schmidt OO Patterns Douglas C. Schmidt Motivation for Patterns and Frameworks Overview of Patterns and Frameworks DX Developing software is hard BLOB Patterns support reuse of software architecture and design STORE Developing reusable – Patterns capture the static and dynamic structures and ATM software is even harder collaborations of successful solutions to problems that arise when LAN DIAGNOSTIC STATIONS building applications in a particular domain Proven solutions include patterns and frameworks Frameworks support reuse of detailed design and code ATM www.cs.wustl.edu/ schmidt/ – A framework is an integrated set of components that collaborate MAN CLUSTER patterns.html to provide a reusable architecture for a family of related ATM BLOB LAN STORE applications Together, design patterns and frameworks help to improve software MODALITIES CENTRAL quality and reduce development time (CT, MR, CR) BLOB STORE – e.g., reuse, extensibility, modularity, performance Vanderbilt University 2 Vanderbilt University 3 OO Patterns Douglas C. Schmidt OO Patterns Douglas C. Schmidt Patterns of Learning Becoming a Chess Master First learn the rules Successful solutions to many areas of human endeavor are deeply rooted in patterns – e.g., names of pieces, legal movements, chess board geometry and orientation, etc. – In fact, an important goal of education is transmitting patterns of learning from generation to generation Then learn the principles – e.g., relative value of certain pieces, strategic value of center In a moment, we’ll explore how patterns are used to learn chess squares, power of a threat, etc.
    [Show full text]