Formal Specification of Design Patterns

Formal Specification of Design Patterns

FORMAL SPECIFICATION OF DESIGN PATTERNS: A COMPARISON OF THREE EXISTING APPROACHES AND PROPOSING TWO-LEVEL GRAMMARS AS A NEW APPROACH By DEEPA BALASUNDARAM Bachelor of Technology in Information Technology Bharathidasan University Tiruchirapalli, Tamilnadu 2006 Submitted to the Faculty of the Graduate College of the Oklahoma State University in partial fulfillment of the requirements for the Degree of MASTER OF SCIENCE July 2010 FORMAL SPECIFICATION OF DESIGN PATTERNS: A COMPARISON OF THREE EXISTING APPROACHES AND PROPOSING TWO-LEVEL GRAMMARS AS A NEW APPROACH Thesis Approved: Dr. M. H. Samadzadeh Thesis Advisor Dr. John P. Chandler Dr. Blayne Mayfield Dr. A. Mark E. Payton Dean of the Graduate College ii PREFACE Patterns are Object-Oriented reusable units. The principal idea behind patterns is to capture and reuse the abstractions that have been formed by expert programmers and designers to solve problems that occur in particular contexts. These abstractions capture the valuable experiences of experts in solving problems. Although patterns are currently being used successfully, there is no general agreement among the software community as to how patterns should be formalized or represented. Various formal specification schemes have been proposed to complement the natural language description of patterns in order to alleviate the ambiguities inherent in the natural language description by rigorously reasoning about the structural and behavioral aspects of patterns. Existing formal specification languages of design patterns have generally failed to provide a standard definition, specification, or representation for patterns because there is no general agreement as to how patterns should be formalized. Also, each formal specification is generally based on a different mathematical formalism and when pattern users want to understand a pattern, first they have to understand the respective mathematical formalism. In addition to comparing three existing formal specification schemes, the main objective of this research work was to lay the foundation for developing a formal specification scheme that could be understandable without having to delve into the details iii of the underlying formalism. This research work attempted to capture and represent the structural aspects of design patterns since capturing the behavioral aspects of design patterns is a semantic issue and is beyond the scope of this work. Two-Level Grammar (TLG) was used to capture and represent the structural aspects of design patterns. This study was conducted using the GoF design patterns [Gamma et al. 1995]. It has already been demonstrated that TLGs have the capability to represent the building blocks of object-oriented software systems. The primary advantage of TLGs in defining design patterns is that specifications written in TLGs are understandable due to their natural- language-like vocabulary [Edupuganty 1987] [Lee 2003] [Maluszynski 1984]. The TLG representation of the observer pattern was developed to gauge the feasibility of the proposed pattern representation scheme. TLGs could help pattern users understand the formalized version of patterns more readily compared to other formal specification methods that are difficult to understand due to their arcane mathematical notations. iv ACKNOWLEDGMENTS A famous Sanskrit phrase delineates the order of priorities for a child, “Matha, Pitha, Guru, Deivam (mother, father, teacher, and god)”, implying that first it is mother, then father, then teacher, and, only after all of them, God. In a sense, mother, father, and, guru show the children the path to God. I am very fortunate to have the best mother, father, and guru one could ever have in their life. It is believed in Hinduism that self-realization cannot be achieved without the guidance and blessings of a proper guru. My advisor, Dr. Samadzadeh has been a proper guru. Thus, I would first like to express my gratitude towards Dr. Samadzadeh for showing enormous trust in me. Without his guidance, support, and constant encouragement, this research work would have been impossible and my studies in the US would have been quite difficult. His unique teaching skills and guidance towards the thesis and constant encouragement has been the driving force of my learning experience. My sincere thanks to my committee members, Dr. Chandler and Dr. Mayfield, for providing valuable input during the proposal meeting. I should thank Dr. Amon Eden and Dr. Ralph Johnson who have always clarified my doubts related to design patterns whenever I contacted them. I am deeply indebted to my parents and sister for their love, support, prayers, and constant encouragement throughout my life. My Success in each and v every step of life would have been impossible without them. Very special thanks goes to my fiancée, Karthic, who has been the source of inspiration for me and who has been very patient and understanding, and who was with me whenever I needed any kind of help. I am very thankful to my friends Malar and Neena who were the actual sources of inspiration for my pursuing graduate studies in the US. I would also like to extend my thanks to my friends Anusha, Bhavna, Janet, and Sudha for their help and support. I would also like to express my thanks to few of my friends in the department, Alireza, Arif, Jaro, Mun, Peyman, Senthil, and Richard who have helped me in this thesis by asking probing questions. Without these friends and Friday group meetings, this piece of work would have been less enjoyable. Finally, my sincere thanks go to Mr. Gary Kearans, Dr. Joyce Lucca, the Computer Science Department, ITLE, and CREC for partially funding my graduate studies. Without their financial support, my stay in US would have been virtually impossible. vi TABLE OF CONTENTS Chapter Page I. INTRODUCTION .................................................................................................. 1 1.1 Introduction ................................................................................................... 1 1.2 The Problem .................................................................................................. 2 1.3 The Approach ................................................................................................ 5 1.4 Contributions ................................................................................................. 7 1.5 Organization of the Thesis ............................................................................. 8 II. REVIEW OF LITERATURE ................................................................................ 9 2.1 History of Patterns ......................................................................................... 9 2.2 GoF Representation of the Observer Pattern ................................................. 15 2.2.1 Deficiencies in the GoF Representation ............................................... 29 2.3 Distributed Cooperative (DisCo) .................................................................. 34 2.3.1 Introduction ......................................................................................... 34 2.3.2 Building Blocks of DisCo .................................................................... 35 2.3.3 DisCo Representation of the Observer Pattern ..................................... 37 2.4 Balanced Pattern Specification Language (BPSL) ........................................ 38 2.4.1 Introduction ......................................................................................... 38 2.4.2 Building Blocks of DisCo .................................................................... 39 2.4.3 Representation of Structural Aspects in BPSL ..................................... 40 2.4.4 Representation of Behaviroal Aspects in BPSL ................................... 41 2.4.5 Representation of the Observer Pattern in BPSL .................................. 42 2.5 Language for Uniform Pattern Specification3 (LePUS3) and Class-Z........... 44 2.5.1 Introduction ......................................................................................... 44 2.5.2 Building Blocks of LePUS3 and Class-Z ............................................. 44 2.6 Comparison of DisCo/BPSL/LePUS and Need for Another Specification Scheme ........................................................................................................ 49 2.7 Two-Level Grammars (TLG) ....................................................................... 55 2.7.1 Formal Specification of Reusable Units Using Two-Level Grammars . 61 2.7.2 Formal Specification Language for Design Patterns ............................. 63 vii Chapter Page III. TLG IN THE CONTEXT OF A CLASS ............................................................ 64 3.1 Introduction ................................................................................................. 65 3.2 TLG and Design Patterns ............................................................................. 66 3.2.1 Building Blocks of Object-Oriented Design Patterns ........................... 67 3.2.2 Static vs. Dynamic............................................................................... 68 3.2.3 Classes ................................................................................................ 68 3.2.4 Functions............................................................................................. 78 3.2.5 Types .................................................................................................. 81 IV. TLG SPECIFICATION OF THE OBSERVER DESIGN PATTERN

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    154 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us