Introduction to Design and Architectural Patterns

Total Page:16

File Type:pdf, Size:1020Kb

Introduction to Design and Architectural Patterns Software Engineering G22.2440-001 Session 7 – Sub-Topic 5 Introduction to Design and Architectural Patterns Dr. Jean-Claude Franchitti New York University Computer Science Department Courant Institute of Mathematical Sciences 1 First Example A Dice Game A Player rolls 10x 2 dices If result = 7, score=score + 10 points At the end, score of the player is registred in the highscore table. 2 1 Activity Diagram menu [highscore] [start] [exit] view Start Highscore turn=0 Roll Dice turn++ [true] Turn<10 [false] Update highscore 3 Analysis Diagram… <<Actor>> Rolls Die Player faceValue : int = 1 name : String 1 2 score : int = 0; roll() Die() 1 Plays play() 1 Player() 1 DiceGame Includes DiceGame() 1 start() 1 Scoring 1 Entry HighScore name:String : type = initval score:int : type = initval Highscore() add() 1 0..* Entry(name:String,score:int)() 4 2 Design Stage Manage User Interface Manage Persistence of highscore in a file or in relational database Realize a layered architecture : Apply the Layer Architectural Pattern 5 Layer Helps structure an application that can be decomposed into groups of subtasks in which each group of subtasks is at a particular level of abstraction. 6 3 Layer: examples 7 Layer :Structure 8 4 Layer: Structure 9 Layer and components… 10 5 Layers : Variants Relaxed Layered System: – A layer « j » can use service of j-1, j-2… – A layer can be partially opaque • Some service to layer j+1, others to all upper services… Layering through inheritance: – Lower layers are implemented as base classes – Higher level can override lower level… 11 Layers : Known Uses • Virtual machines: JVM and binary code format • API : Layer that encapsulates lower layers • Information System – Presentation, Application logic, Domain Layer, Database • Windows NT (relaxed for: kernel and IO and hardware) – System services, – Resource management (Object manager, security monitor, process manager, I/O manager, VM manager, LPC), – Kernel (exception handling, interrupt, multipro synchro, threads), – HAL (Hardware Abstraction Level) – Hardware 12 6 Layers: benefits Reuse of layers Support for standardization (POSIX) Dependencies are kept local Exchangeabilities : – Replacement of old implementation with Adapter Pattern – Dynamic exchange with Bridge Pattern 13 Layers: Liabilities Cascades of changing behavior Lower efficiency Unnecessary work: functions of a layer called many times for one service Difficulty of establishing correct granularity of layers: Too few layers -> less benefits, too many layers -> complexity and overhead… 14 7 Applying Layer Architecture UI Core Play View High Score Persistence Fichier ou BDD 15 Package decomposition <<layer>> UI <<layer>> <<subsystem>> Core Util <<layer>> Persist 16 8 Layer « core » Contain business logic classes… Adapt analysis classes for implementation Use of singleton Idiom… 17 Singleton (Idiom) Ensure a class only has one instance, and provide a global point of access to it. 18 9 Singleton Structure 19 Core « Layer »:First diagram Design Analysis HighScore Entry Rolls $ hs : HighScore = null <<Actor>> name:String : type = initval Player Die Highscore() score:int : type = initval name : String 1 2 add() 1 0..* score : int = 0; faceValue : int = 1 load() Entry(name:String,score:int)() save() play() roll() Player() Die() Plays 1 1 DiceGame Singleton... $ dg = null 1 DiceGame() DiceGame Includes getInstance() start() DiceGame() 1 start() 2 1 -player Scoring -dies Die 1 Player faceValue : int = 1 name : String 1 score : int = 0; Entry roll() HighScore Die() name:String : type = initval Player() display() score:int : type = initval display() Highscore() add() 1 0..* Entry(name:String,score:int)() 20 10 Util « subsystem » • Need for random numbers • Use java.util « random » functionality… • The random number generator is shared by the die… • Another singleton... Subsystem « util » Random (from util) $ serialVersionUID : long = 3905348978240129619L seed : long $ multiplier : long = 0x5DEECE66DL $ addend : long = 0xBL Singleton $ mask : long = (1L << 48) - 1 $ BITS_PER_BYTE : int = 8 $ BYTES_PER_INT : int = 4 nextNextGaussian : double haveNextNextGaussian : boolean = false Random() Randomizer Random() 1 setSeed() getInstance() next() getValue() nextBytes() nextInt() nextInt() nextLong() nextBoolean() nextFloat() nextDouble() nextGaussian() 11 Package decomposition <<layer>> UI <<layer>> <<subsystem>> Core Util <<layer>> Persist 23 Observer One-to-many dependency between objects: change of one object will automatically notify observers 24 12 Observer: Applicability A change to one object requires changing an unknown set of other objects Object should be able to notify other objects that may not be known at the beginning 25 Observer: Structure 26 13 Observer: Consequences Abstract coupling between subject and observer Support for broadcast communication Hard to maintain 27 Applying Observer Pattern Observable (from util) changed : boolean = false <<Interface>> Observable() Observer addObserver() (from util) deleteObserver() 0..* notifyObservers() update(o : Observable, arg : Object) : void notifyObservers() deleteObservers() setChanged() clearChanged() hasChanged() countObservers() Die (from Core) DieView faceValue : int = 1 DieView(die : Die) roll() update(o : Observable, arg : Object) : void Player Die() (from Core) display() name : String PlayerView score : int = 0; Player() PlayerView(player : Player) display() update(o : Observable, arg : Object) : void 28 14 Observer View <<Interface>> Observer (from util) update(o : Observable, arg : Object) : void DieView DieView(die : Die) update(o : Observable, arg : Object) : void PlayerView PlayerView(player : Player) update(o : Observable, arg : Object) : void 29 Views are graphical objects Observable (from util) changed : boolean = false <<Interface>> Observable() Observer addObserver() (from util) deleteObserver() 0..* notifyObservers() update(o : Observable, arg : Object) : void notifyObservers() deleteObservers() setChanged() clearChanged() hasChanged() Panel countObservers() (from awt) Panel() Panel() constructComponentName() addNotify() Die (from Core) DieView faceValue : int = 1 roll() DieView(die : Die) update(o : Observable, arg : Object) : void Player Die() display() (from Core) setValue() name : String PlayerView score : int = 0; PlayerView(player : Player) Player() update(o : Observable, arg : Object) : void display() 30 15 Setting up Observer : RollForm : : PlayerView : Die : DieView Playe 1: display( ) 2: PlayerView(Player) 3: addObserver(Observer) 4: return component 5: display() 6: DieView(Die) 7: addObserver(Observer) 8: return component 31 Observer : Change Propagation : Die : Randomizer : DieView : JLabel 1: getValue( ) 2: setValue(int) 3: notifyObservers( ) 4: update(Observable, Object) 5: getState() 3 6: setText(3) 32 16 UI/Core Separation... HighScore Entry $ hs : HighScore = null name:String : type = initval Highscore() score:int : type = initval add() 1 0..* load() Entry(name:String,score:int)() save() DiceGame <<Interface>> Singleton... Displayable $ dg = null DiceGame() display() getInstance() start() 2 -dies -player Die faceValue : int = 1 1 Player name : String roll() score : int = 0; Die() display() Player() setValue() display() Layered Architecture... RollForm (from UI) roll_action() cancel_action() RollForm() +thePlayerViewPlayerView 2 DieView (from UI) (from UI) +theDieView 1 PlayerView() UI DieView() update() update() <<Interface>> Observable <<Interface>> Decoupling classes Observer Displayable (from util) (from util) and interfaces 0..* Die Core faceValue : int = 1 Player name : String roll() score : int = 0; Die() display() Player() setValue() display() 34 17 MVC • Java AWT Java: Delegation Model – Event propagation from user interface to core application classes • MVC: – State change propagation to graphical objects Package decomposition <<layer>> UI <<layer>> <<subsystem>> Core Util <<layer>> Persist 36 18 Pattern Factory Method Intent – Define an interface for creating an object, but let sub-classes decide which class to instantiate – let a class defer instantiation to subclasses – Also known as Virtual Constructor 37 Factory Method Applicability : Use when – a class cannot anticipate the class of objects it must create – a class wants its subclasses to specify the objects it creates – classes delegate responsibility to one of several helper subclasses, and you want to localize the knowledge of which helper subclass to delegate. 38 19 Structure Facteur Produit produit=Fabrication() Fabrication() UneOperation() FacteurConcret ProduitConcret return new ProduitConcret() Fabrication() 39 Factory method Consequences – Provide hooks for subclasses – connects parallel class hierarchies Known uses – MacApp, ET++ – ClassView in smalltalk80 MVC (controller creation) – Orbix ORB for generating PROXY object 40 20 « Persist » Layer Persistence technical classes Ensure independence of Core/Persist – Be able to switch « persistent engine » For example: – Persistence via « Serialization » – Persistence via a relational database (JDBC). 41 Applying Factory HighScore (from Core) $ hs : HighScore = null Abstract produc Highscore() add() load() save() HighScoreSr Concrete product HighScoreJDBC $ filename : String = "/tmp/high.score" Highscore() Highscore() load() load() save() save() JdbcKit SrKit Concrete Factory makeKit() makeKit() Abstract Factory PersistKit makeKit() 42 21 Applying Factory : DiceGame : S rKit : HighScoreSr : RealPlayer 1: SrKit( ) A ttention! DiceGame voit S rKit comme un PersistKit
Recommended publications
  • The Future of Embedded Software
    The Future of Embedded Software Edward A. Lee Professor, Chair of EE, and Associate Chair of EECS UC Berkeley ARTEMIS 2006 Annual Conference Graz, Austria May 22-24, 2006 Why Embedded Software? Why Now? “Information technology (IT) is on the verge of another revolution. Driven by the increasing capabilities and ever declining costs of computing and communications devices, IT is being embedded into a growing range of physical devices linked together through networks and will become ever more pervasive as the component technologies become smaller, faster, and cheaper... These networked systems of embedded computers ... have the potential to change radically the way people interact with their environment by linking together a range of devices and sensors that will allow information to be collected, shared, and processed in unprecedented ways. ... The use of [these embedded computers] throughout society could well dwarf previous milestones in the information revolution.” National Research Council Report Embedded Everywhere Lee, Berkeley 2 The Key Obstacle to Progress: Gap Between Systems and Computing | Traditional dynamic systems theory needs to adapt to better account for the behavior of software and networks. | Traditional computer science needs to adapt to embrace time, concurrency, and the continuum of physical processes. Lee, Berkeley 3 The Next Systems Theory: Simultaneously Physical and Computational The standard model: Embedded software is software on small computers. The technical problem is one of optimization (coping with limited resources). The Berkeley model: Embedded software is software integrated with physical processes. The technical problem is managing time and concurrency in computational systems. Lee, Berkeley 4 Obstacles in Today’s Technology: Consider Real Time Electronics Technology Delivers Timeliness… … and the overlaying software abstractions discard it.
    [Show full text]
  • Capturing Interactions in Architectural Patterns
    Capturing Interactions in Architectural Patterns Dharmendra K Yadav Rushikesh K Joshi Department of Computer Science and Engineering Department of Computer Science and Engineering Indian Institute of Technology Bombay Indian Institute of Technology Bombay Powai, Mumbai 400076, India Powai, Mumbai 400076, India Email: [email protected] Email: [email protected] TABLE I Abstract—Patterns of software architecture help in describing ASUMMARY OF CCS COMBINATORS structural and functional properties of the system in terms of smaller components. The emphasis of this work is on capturing P rimitives & Descriptions Architectural the aspects of pattern descriptions and the properties of inter- Examples Significance component interactions including non-deterministic behavior. Prefix (.) Action sequence intra-component Through these descriptions we capture structural and behavioral p1.p2 sequential flow specifications as well as properties against which the specifications Summation (+) Nondeterminism choice within a component are verified. The patterns covered in this paper are variants of A1 + A2 Proxy, Chain, MVC, Acceptor-Connector, Publisher-Subscriber Composition (|) Connect matching multiple connected and Dinning Philosopher patterns. While the machines are CCS- A1 | A2 i/o ports in assembly components based, the properties have been described in Modal µ-Calculus. Restriction (\) Hiding ports from Internal The approach serves as a framework for precise architectural A\{p1, k1, ..} further composition features descriptions. Relabeling ([]) Renaming of ports syntactic renaming A[new/old, ..] I. INTRODUCTION In component/connector based architectural descriptions [6], [13], components are primary entities having identities in the represents interface points as ports uses a subset of CSP for system and connectors provide the means for communication it’s formal semantics.
    [Show full text]
  • Automatic Verification of Java Design Patterns
    Automatic Verification of Java Design Patterns Alex Blewitt, Alan Bundy, Ian Stark Division of Informatics, University of Edinburgh 80 South Bridge, Edinburgh EH1 1HN, UK [email protected] [email protected] [email protected] Abstract 2. Design patterns There are a number of books which catalogue and de- Design patterns are widely used by object oriented de- scribe design patterns [4, 1, 6] including an informal de- signers and developers for building complex systems in ob- scription of the key features and examples of their use. ject oriented programming languages such as Java. How- However, at the moment there are no books which attempt ever, systems evolve over time, increasing the chance that to formalise these descriptions, possibly for the following the pattern in its original form will be broken. reasons: We attempt to show that many patterns (implemented in Java) can be verified automatically. Patterns are defined 1. The implementation (and description) of the pattern is in terms of variants, mini-patterns, and constraints in a language-specific. pattern description language called SPINE. These specifi- 2. There are often several ways to implement a pattern cations are then processed by HEDGEHOG, an automated within the same language. proof tool that attempts to prove that Java source code 3. Formal language descriptions are not common within meets these specifications. the object oriented development community. Instead, each pattern is presented as a brief description, and an example of its implementation and use. Designers and developers are then expected to learn the ‘feel’ of a pat- 1.
    [Show full text]
  • Framework Overview with UML Diagrams
    Framework Overview with UML Diagrams Learn to Build Robust, Scalable and Maintainable Applications using PureMVC Framework Overview This document discusses the classes and interfaces of the PureMVC framework; illustrating their roles, responsibilities and collaborations with simple UML (Unified Modeling Language) diagrams. The PureMVC framework has a very narrow goal. That is to help you separate your application’s coding concerns into three discrete tiers; Model, View and Controller. In this implementation of the classic MVC design meta-pattern, the application tiers are represented by three Singletons (a class where only one instance may be created). A fourth Singleton, the Façade, simplifies development by providing a single interface for communications throughout the application. The Model caches named references to Proxies, which expose an API for manipulating the Data Model (including data retrieved from remote services). The View primarily caches named references to Mediators, which adapt and steward the View Components that make up the user interface. The Controller maintains named mappings to Command classes, which are stateless, and only created when needed. The Façade initializes and caches the Core actors (Model, View and Controller), and provides a single place to access all of their public methods. AUTHOR: Cliff Hall <[email protected]> LAST MODIFIED: 3/05/2008 Façade and Core The Façade class makes it possible for the Proxies, Mediators and Commands that make up most of our final application to talk to each other in a loosely coupled way, without having to import or work directly with the Core framework actors. When we create a concrete Façade implementation for our application, we are able to use the Core actors ‘out of the box’, incidental to our interaction with the Façade, minimizing the amount of API knowledge the developer needs to have to be successful with the framework.
    [Show full text]
  • Object-Oriented Analysis, Design and Implementation
    Undergraduate Topics in Computer Science Brahma Dathan Sarnath Ramnath Object-Oriented Analysis, Design and Implementation An Integrated Approach Second Edition Undergraduate Topics in Computer Science Undergraduate Topics in Computer Science (UTiCS) delivers high-quality instruc- tional content for undergraduates studying in all areas of computing and information science. From core foundational and theoretical material to final-year topics and applications, UTiCS books take a fresh, concise, and modern approach and are ideal for self-study or for a one- or two-semester course. The texts are all authored by established experts in their fields, reviewed by an international advisory board, and contain numerous examples and problems. Many include fully worked solutions. More information about this series at http://www.springer.com/series/7592 Brahma Dathan • Sarnath Ramnath Object-Oriented Analysis, Design and Implementation An Integrated Approach Second Edition 123 Brahma Dathan Sarnath Ramnath Department of Information and Computer Department of Computer Science Science and Information Technology Metropolitan State University St. Cloud State University St. Paul, MN St. Cloud, MN USA USA Series editor Ian Mackie Advisory Board Samson Abramsky, University of Oxford, Oxford, UK Karin Breitman, Pontifical Catholic University of Rio de Janeiro, Rio de Janeiro, Brazil Chris Hankin, Imperial College London, London, UK Dexter Kozen, Cornell University, Ithaca, USA Andrew Pitts, University of Cambridge, Cambridge, UK Hanne Riis Nielson, Technical University of Denmark, Kongens Lyngby, Denmark Steven Skiena, Stony Brook University, Stony Brook, USA Iain Stewart, University of Durham, Durham, UK A co-publication with the Universities Press (India) Private Ltd., licensed for sale in all countries outside of India, Pakistan, Bhutan, Bangladesh, Sri Lanka, Nepal, The Maldives, Middle East, Malaysia, Indonesia and Singapore.
    [Show full text]
  • Co-Occurrence of Design Patterns and Bad Smells in Software Systems
    XI Brazilian Symposium on Information System, Goi^ania,GO, May 26-29, 2015. Co-Occurrence of Design Patterns and Bad Smells in Software Systems: An Exploratory Study Bruno Cardoso Eduardo Figueiredo Software Engineering Lab (LabSoft) Software Engineering Lab (LabSoft) Federal University of Minas Gerais (UFMG) Federal University of Minas Gerais (UFMG) Belo Horizonte, MG - Brazil Belo Horizonte, MG - Brazil [email protected] [email protected] ABSTRACT In a previous work [1], we performed a systematic literature A design pattern is a general reusable solution to a recurring review in order to understand how studies investigate these two problem in software design. Bad smells are symptoms that may topics, design patterns and bad smells, together. Our results indicate something wrong in the system design or code. showed that, in general, studies have a narrow view concerning Therefore, design patterns and bad smells represent antagonistic the relation between these concepts. Most of them focus on structures. They are subject of recurring research and typically refactoring opportunities. Among these, some tools [3][7][15][17] appear in software systems. Although design patterns represent have been proposed to identify code fragments that can be good design, their use is often inadequate because their refactored to patterns. Other studies [2][6] establish a structural implementation is not always trivial or they may be unnecessarily relationship between the terms design pattern and bad smell. In employed. The inadequate use of design patterns may lead to a addition, there are reported cases in the literature where the use of bad smell. Therefore, this paper performs an exploratory study in design patterns may not always be the best option and the wrong order to identify instances of co-occurrences of design patterns use of a design pattern can even introduce bad smells in code [19] and bad smells.
    [Show full text]
  • Enterprise Development with Flex
    Enterprise Development with Flex Enterprise Development with Flex Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky Beijing • Cambridge • Farnham • Köln • Sebastopol • Taipei • Tokyo Enterprise Development with Flex by Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky Copyright © 2010 Yakov Fain, Victor Rasputnis, and Anatole Tartakovsky.. All rights reserved. Printed in the United States of America. Published by O’Reilly Media, Inc., 1005 Gravenstein Highway North, Sebastopol, CA 95472. O’Reilly books may be purchased for educational, business, or sales promotional use. Online editions are also available for most titles (http://my.safaribooksonline.com). For more information, contact our corporate/institutional sales department: (800) 998-9938 or [email protected]. Editor: Mary E. Treseler Indexer: Ellen Troutman Development Editor: Linda Laflamme Cover Designer: Karen Montgomery Production Editor: Adam Zaremba Interior Designer: David Futato Copyeditor: Nancy Kotary Illustrator: Robert Romano Proofreader: Sada Preisch Printing History: March 2010: First Edition. Nutshell Handbook, the Nutshell Handbook logo, and the O’Reilly logo are registered trademarks of O’Reilly Media, Inc. Enterprise Development with Flex, the image of red-crested wood-quails, and related trade dress are trademarks of O’Reilly Media, Inc. Many of the designations used by manufacturers and sellers to distinguish their products are claimed as trademarks. Where those designations appear in this book, and O’Reilly Media, Inc. was aware of a trademark claim, the designations have been printed in caps or initial caps. While every precaution has been taken in the preparation of this book, the publisher and authors assume no responsibility for errors or omissions, or for damages resulting from the use of the information con- tained herein.
    [Show full text]
  • The Problem with Threads
    The Problem With Threads Edward A. Lee Robert S. Pepper Distinguished Professor and Chair of EECS UC Berkeley -and - Senior Technical Adviser, director, and co-founder of BDTI Class #: ESC-211 Embedded Systems Conference (ESC) Tuesday, 3 April 2007 Concurrency in Software Practice, As of 2007 | Component technologies z Objects in C++, C#, or Java z Wrappers as service definitions | Concurrency z Threads (shared memory, semaphores, mutexes, …) z Message Passing (synchronous or not, buffered, …) | Distributed computing z Distributed objects wrapped in web services, Soap, CORBA, DCOM, … Lee, Berkeley & BDTI 2 z1 Observations Threads and objects dominate SW engineering. z Threads: Sequential computation with shared memory. z Objects: Collections of state variables with procedures for observing and manipulating that state. Even distributed objects create the illusion of shared memory through proxies. z The components (objects) are (typically) not active. z Threads weave through objects in unstructured ways. z This is the source of many software problems. Lee, Berkeley & BDTI 3 The Buzz “Multicore architectures will (finally) bring parallel computing into the mainstream. To effectively exploit them, legions of programmers must emphasize concurrency.” The vendor push: “Please train your computer science students to do extensive multithreaded programming.” Lee, Berkeley & BDTI 4 z2 Is this a good idea? Lee, Berkeley & BDTI 5 My Claim Nontrivial software written with threads, semaphores, and mutexes are incomprehensible to humans. Lee, Berkeley & BDTI 6 z3 To Examine the Problems With Threads and Objects, Consider a Simple Example “The Observer pattern defines a one-to-many dependency between a subject object and any number of observer objects so that when the subject object changes state, all its observer objects are notified and updated automatically.” Design Patterns, Eric Gamma, Richard Helm, Ralph Johnson, John Vlissides (Addison-Wesley Publishing Co., 1995.
    [Show full text]
  • Prof. Catalin Boja, Phd [email protected] Source Code Quality
    Design patterns Prof. Catalin Boja, PhD [email protected] http://acs.ase.ro/software-quality-testing Source code quality Principles for writing the code: • Easy to read / understand - clear • Easy to modify - structured • Easy to reuse • Simple (complexity) • Easy to test • Implement patterns for the standard problem Left: Simply Explained: Code Reuse 2009-12- acs.ase.ro [email protected] 03.By Oliver Widder, Webcomics Geek Aad Poke.2 Source code quality Forces that influence it: • Available time (delivery terms) • Costs • The experience of the programmer • Programmer competences • Specifications clarity • Solution complexity • Change rates for specifications, requirements, team, etc http://khristianmcfadyen.com/ acs.ase.ro [email protected] 3 Anti-Pattern: Big ball of mud “A Big Ball of Mud is a haphazardly structured, sprawling, sloppy, duct-tape- and-baling-wire, spaghetti- code jungle.” Brian Foote and Joseph Yoder, Big Ball of Mud, September 1997 acs.ase.ro [email protected] 4 Anti-Pattern: Big ball of mud Where from ? Why ? • Throwaway code - Temporary (Prototyping) solutions to be replaced / rewritten • Cut and Paste code • Adapting code by commenting / deleting other solutions • Very short or unrealistic deadlines • Lack of experience • Lack of standards / procedures acs.ase.ro [email protected] 5 Anti-Pattern: Big ball of mud How do you avoid it? • Rewriting the code (Refactoring) to an acceptable maturity level • Use Clean Code Principles • Design Patterns Implementation acs.ase.ro [email protected] 6 Design-pattern • A pattern is a reusable solution for a standard problem in a given context • Facilitates the reuse of architectures and software design • They are not data structures acs.ase.ro [email protected] 7 Design-pattern “A pattern involves a general “..
    [Show full text]
  • Reducing Maintenance Costs Through the Application of Modern Software Architecture Principles
    Reducing Maintenance Costs Through the Application of Modern Software Architecture Principles Christine Hulse and Michael Ubnoske Louis Vazquez Scott Edgerton Architecture Technology Department of the Army United Defense, LP Minneapolis, Minnesota Picatinny Arsenal, Minneapolis, Minnesota 1.612.829.5864 New Jersey 1.612.572.6109/6156 [email protected] 1.973.724.5259 [email protected] [email protected] [email protected] 1. ABSTRACT 1.1 Keywords Large software programs are usually long lived Architecture, design patterns, software maintenance, modeling, real-time software and continually evolve. Substantial maintenance effort is often extended by 2. INTRODUCTION engineers trying to understand the software The Crusader Field Artillery System is the U.S. Army's next prior to making changes. To successfully generation 155-mm self-propelled howitzer (SPH) and its companion resupply vehicle (RSV). The Crusader is a evolve the software, a thorough understanding software-intensive system that is being designed to last well of the architect's intentions about software into the next century. Ada95 is the implementation language organization is required. Software for all software development on the Crusader program. maintenance costs can be reduced significantly Modern software architecture methods are being applied to if the software architecture is well defined, capture the general principles used throughout the design and to provide a guide for further development of the clearly documented, and creates an software. The architecture is being modeled using the environment that promotes design consistency Unified Modeling Language (UML) to bring together the through the use of guidelines and design design vision of all of the key stakeholders.
    [Show full text]
  • Design Patterns in Ocaml
    Design Patterns in OCaml Antonio Vicente [email protected] Earl Wagner [email protected] Abstract The GOF Design Patterns book is an important piece of any professional programmer's library. These patterns are generally considered to be an indication of good design and development practices. By giving an implementation of these patterns in OCaml we expected to better understand the importance of OCaml's advanced language features and provide other developers with an implementation of these familiar concepts in order to reduce the effort required to learn this language. As in the case of Smalltalk and Scheme+GLOS, OCaml's higher order features allows for simple elegant implementation of some of the patterns while others were much harder due to the OCaml's restrictive type system. 1 Contents 1 Background and Motivation 3 2 Results and Evaluation 3 3 Lessons Learned and Conclusions 4 4 Creational Patterns 5 4.1 Abstract Factory . 5 4.2 Builder . 6 4.3 Factory Method . 6 4.4 Prototype . 7 4.5 Singleton . 8 5 Structural Patterns 8 5.1 Adapter . 8 5.2 Bridge . 8 5.3 Composite . 8 5.4 Decorator . 9 5.5 Facade . 10 5.6 Flyweight . 10 5.7 Proxy . 10 6 Behavior Patterns 11 6.1 Chain of Responsibility . 11 6.2 Command . 12 6.3 Interpreter . 13 6.4 Iterator . 13 6.5 Mediator . 13 6.6 Memento . 13 6.7 Observer . 13 6.8 State . 14 6.9 Strategy . 15 6.10 Template Method . 15 6.11 Visitor . 15 7 References 18 2 1 Background and Motivation Throughout this course we have seen many examples of methodologies and tools that can be used to reduce the burden of working in a software project.
    [Show full text]
  • HEDGEHOG: Automatic Verification of Design Patterns in Java
    HEDGEHOG: Automatic Verification of Design Patterns in Java Alex Blewitt I V N E R U S E I T H Y T O H F G E R D I N B U Doctor of Philosophy School of Informatics University of Edinburgh 2006 Abstract Design patterns are widely used by designers and developers for building complex systems in object-oriented programming languages such as Java. However, systems evolve over time, increasing the chance that the pattern in its original form will be broken. To verify that a design pattern has not been broken involves specifying the original intent of the design pattern. Whilst informal descriptions of patterns exist, no formal specifications are available due to differences in implementations between programming languages. This thesis shows that many patterns (implemented in Java) can be verified automatically. Patterns are defined in terms of variants, mini-patterns, and artefacts in a pattern description language called SPINE. These specifications are then processed by HEDGEHOG, an automated proof tool that attempts to prove that Java source code meets these specifications. iii Acknowledgements I am indebted to Alan Bundy who has given me the freedom to work on this thesis whilst at the same time guiding me towards the final production and presentation of these results. I not would have been able to achieve this without Alan’s support through a sometimes difficult, but always busy part of my life. This project, and especially the production of this thesis, would not have been possible without the care and attention that Alan provided. Ian Stark has provided invaluable feedback on all aspects of this thesis, from the low-level technical intricacies of Java’s design patterns through to the high-level structure of the thesis as a whole.
    [Show full text]