Design Pattern Contracts
Total Page:16
File Type:pdf, Size:1020Kb
DESIGN PATTERN CONTRACTS DISSERTATION Presented in Partial Fulfillment of the Requirements for the Degree Doctor of Philosophy in the Graduate School of The Ohio State University By Jason O. Hallstrom, B.S., M.A., M.S. ***** The Ohio State University 2004 Dissertation Committee: Approved by Neelam Soundarajan, Adviser Anish Arora Adviser Bruce W. Weide Department of Computer Science and Engineering c Copyright by Jason O. Hallstrom 2004 ABSTRACT A design pattern describes a commonly recurring problem in the design of object- oriented software, a solution to that problem, and the context in which the solution can be applied. The benefits of design patterns are two-fold. First, patterns serve as guidance to the novice designer. Second, they provide an extended vocabulary for documenting software design. In the mid 1990s, the publication of several pattern cat- alogs – compendiums of design patterns – popularized patterns as a tool for designing object-oriented software. Today, many of these catalogs are standard references, and the patterns they contain are an important part of software practice. Unfortunately, the descriptive format popularized by these catalogs is inherently imprecise. As a consequence, it is unclear when a pattern has been applied correctly, or what can be concluded about a system implemented using a particular pattern. This ambiguity threatens to undermine the two principal benefits associated with the use of design patterns. First, novice designers are more prone to error without a precise description of how each pattern must be applied. Second, documentation describing the patterns applied in designing a system may be misleading, as different designers can interpret pattern descriptions in subtly different ways. To address the ambiguity issues associated with design pattern descriptions, we introduce the concept of a design pattern contract as a formalism for precisely spec- ifying design patterns. Like all contracts, a design pattern contract consists of two ii primary components: a responsibilities component and a rewards component. The responsibilities component of a pattern contract precisely characterizes the require- ments that must be satisfied by the designer when applying a particular pattern. The rewards component specifies the system properties that are guaranteed to be exhibited if the contract responsibilities are indeed satisfied. The contract formalism alone, however, is not enough to guarantee that design pat- terns will be applied correctly. After all, software design is a complex task. Even when guided by a precise set of requirements, designers can — and do — make mistakes. To detect such contract violations, we introduce the notion of a contract monitor — an executable unit of deployment used to detect runtime contract violations. During the testing phase of a system’s life cycle, the designer can instrument the system with the appropriate monitors to determine if the contracts used in its construction were applied correctly. We present two approaches to implementing these monitors. The choice of which to use depends on the requirements of the system, and the skill-set of the designer. iii To my family. iv ACKNOWLEDGMENTS During the last six years at Ohio State, I have been fortunate to be involved with a number of people that have encouraged, mentored, and inspired me. First, I would like to express my sincerest gratitude to my advisor, Neelam Soundarajan. Neelam has been closely involved with every aspect of the work presented in this dissertation, and there isn’t a single chapter that doesn’t benefit from his insights. He has been an excellent advisor and friend, and I appreciate his efforts tremendously. I would also like to thank Anish Arora, Bruce Weide, and Bill Leal, who have been my unofficial co-advisors throughout the years. They have provided invaluable guidance and support, and have taken a personal interest in my success. These gents — my four advisors — are constant reminders of why I wanted to become a professor, and the relationships that I hope to build with my own students. I am also grateful to the numerous graduate student colleagues that have shared this experience with me. In particular, I would like to thank the student members of the Reusable Software Research Group — Nigamanth Sridhar, Scott Pike, Hilary Pike, Christopher Bohn, Ben Tyler, and Michael Gibas — as well as the student members of the Dependable Distributed and Networked Systems Group — Santosh Kumar, Murat Demirbas, Hongwei Zhang, Sandip Bapat, Vinayak Naik, Vinod Kulathumani, and Prabal Dutta. These folks have all provided valuable assistance at some point or another, and have helped to make my time at OSU a period that I will look back on v with fond memories. I am especially thankful for my friendships with Nigamanth and Scott. The “team support” that they have shown throughout the years has made a tremendous difference during a number of difficult times. I will dearly miss our late night research sessions in the halls of Dreese Labs — aerobie and foosball included. I would also like to express my gratitude to the remaining members of the Reusable Software Research Group — Bill Ogden, Paolo Bucci, Tim Long, Bob Mathis, Wayne Heym, and Joan Krone. This group has been instrumental in helping me to develop my research and presentation skills — not to mention, toughening my skin. On the other side of the fence — outside of graduate school — I have also been blessed with a team of supporters for whom I am grateful. I would like to thank my friends from Metavante — Bob Stoll, Ruth Wollan, Bastian Knoppers, and many others — for sticking with me throughout the years, despite a schedule that made their lives difficult. I would like to especially thank Bob, who has been a dear friend and mentor, and provides one of the best examples of personal integrity that I know of. I feel very fortunate to have worked with the Willowbrook team, and I count the experience as instrumental in my academic success. I also owe a debt of gratitude to my longtime friend, Adam Foit, whose friendship has been a source of great joy for many years. I am thankful not only for his friendship and laughter, but for his willingness to persist in his efforts to keep in contact, despite my tendency to disappear for months at a time. He has been an invaluable ally, and I want to express my most sincere appreciation. Throughout this process, and throughout my life, I have been supported by the unwavering love and encouragement of my wonderful parents, Duane and Barbara Hallstrom. Their confidence in me has always surpassed my confidence in myself, and vi as a result, I’ve been able to reach goals — humble as they might be — that once seemed unattainable. From the very beginning, that’s how it’s always been — my parents have encouraged me to excel beyond the vision that I had for myself. I can never thank them enough for all that they have done, and for the life that they have made possible for me. I would also like to thank the rest of my family — who are too numerous to name individually — for their love and encouragement, as well as the interest that they’ve shown in my academic career. I have dedicated my dissertation work to them, because being a part of the Hallstrom family is the thing of which I am most proud. Last, but certainly not least, I want to thank my fianc´e,Kimberly Rose, for her unconditional love, laughter, and friendship. She is a reminder to me of all that is good within us, and all that I aspire to be. I could not have accomplished this task without her support, nor would I have been inclined to. Kimberly is my best friend, my love, and my life. vii VITA May 4, 1976 . Born – Palos Heights, Illinois June 2004 . M.S. Computer Science & Engineering, The Ohio State University August 1998 . .M.A. Economics, Miami University May 1998 . .B.S. Systems Analysis, Miami University January 2002 – present . Graduate Research Associate, The Ohio State University September 1998 – December 2001 . .Graduate Teaching Associate, The Ohio State University August 1995 – present . Independent Systems Consultant PUBLICATIONS Research Publications Neelam Soundarajan and Jason O. Hallstrom. Responsibilities and rewards: Specify- ing design patterns. In Proceedings of the 26th International Conference on Software Engineering (ICSE’04), pages 666–675. IEEE Computer Society Press, May 2004. Jason O. Hallstrom, Nigamanth Sridhar, Paolo A.G. Sivilotti, Anish Arora, and William M. Leal. A container-based approach to object-oriented product lines. Jour- nal of Object Technology, vol. 3, no. 4, pages 309–326. April 2004. Jason O. Hallstrom, William M. Leal, and Anish Arora. Scalable evolution of highly- available systems. IEICE/IEEE Joint Special Issue on Assurance Systems and Net- works, E86-B(10), pages 2154–2166. October 2003. viii Arjav J Chakravarti, Xiaojin Wang, Jason O. Hallstrom, and Gerald Baumgartner. Implementation of strong mobility for multi-threaded agents in Java. In Proceedings of the 2003 International Conference on Parallel Processing (ICPP’03), pages 321– 330. IEEE Computer Society Press, October 2003. Nigamanth Sridhar and Jason O. Hallstrom. Generating configurable containers for component-based software. In Proceedings of the 6th Workshop on Component-Based Software Engineering (CBSE6). Portland OR, May 2003. Jason O. Hallstrom and Neelam Soundarajan. Incremental development using object- oriented frameworks: A case study. Journal of Object Technology, vol. 1, no. 3, pages 189–205, July 2002. Jason O. Hallstrom, Scott M. Pike, and Nigamanth Sridhar. Iterators reconsid- ered. In Proceedings of the 5th Workshop on Component-Based Software Engineering (CBSE5). Orlando FL, May 2002. Xiaojin Wang, Jason O. Hallstrom, and Gerald Baumgartner. Reliability through strong mobility. In Proceedings of the 7th ECOOP Workshop on Mobile Object Systems (MOS’01). Budapest Hungary, June 2001. FIELDS OF STUDY Major Field: Computer Science and Engineering Studies in: Software Methodology Prof.