Software Quality Improvement using Design Patterns

Similar documents
Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Design Patterns. Manuel Mastrofini. Systems Engineering and Web Services. University of Rome Tor Vergata June 2011

What is Design Patterns?

Modellistica Medica. Maria Grazia Pia, INFN Genova. Scuola di Specializzazione in Fisica Sanitaria Genova Anno Accademico

Laboratorio di Progettazione di Sistemi Software Design Pattern Creazionali. Valentina Presutti (A-L) Riccardo Solmi (M-Z)

Design Pattern- Creational pattern 2015

Creational Design Patterns

A Reconnaissance on Design Patterns

Object-Oriented Oriented Programming Factory Method Pattern Abstract Factory Pattern. CSIE Department, NTUT Woei-Kae Chen

What is Design Patterns?

Creational Patterns. Factory Method (FM) Abstract Factory (AF) Singleton (SI) Prototype (PR) Builder (BU)

Socket attaches to a Ratchet. 2) Bridge Decouple an abstraction from its implementation so that the two can vary independently.

The GoF Design Patterns Reference

Design Pattern What is a Design Pattern? Design Pattern Elements. Almas Ansari Page 1

Software Design COSC 4353/6353 D R. R A J S I N G H

What is Design Patterns?

LECTURE NOTES ON DESIGN PATTERNS MCA III YEAR, V SEMESTER (JNTUA-R09)

Design Pattern. CMPSC 487 Lecture 10 Topics: Design Patterns: Elements of Reusable Object-Oriented Software (Gamma, et al.)

Object-Oriented Design

Software Design Patterns. Background 1. Background 2. Jonathan I. Maletic, Ph.D.

Design of Software Systems (Ontwerp van SoftwareSystemen) Design Patterns Reference. Roel Wuyts

Software Development. Modular Design and Algorithm Analysis

Trusted Components. Reuse, Contracts and Patterns. Prof. Dr. Bertrand Meyer Dr. Karine Arnout

Design Patterns. Hausi A. Müller University of Victoria. Software Architecture Course Spring 2000

An Expert System for Design Patterns Recognition

Utilizing a Common Language as a Generative Software Reuse Tool

"Charting the Course to Your Success!" MOC B Programming in C# Course Summary

Produced by. Design Patterns. MSc in Communications Software. Eamonn de Leastar

Software Design COSC 4353/6353 D R. R A J S I N G H

Tuesday, October 4. Announcements

EPL 603 TOPICS IN SOFTWARE ENGINEERING. Lab 6: Design Patterns

Lecture 20: Design Patterns II

Topics in Object-Oriented Design Patterns

Prototype Description. Interpreter. interpreter Calculator Design Rationales. Prototype Participants. Interpreter with Factory Method.

20483BC: Programming in C#

The Strategy Pattern Design Principle: Design Principle: Design Principle:

Design Patterns. An introduction

INTERNATIONAL JOURNAL OF COMPUTER ENGINEERING & TECHNOLOGY (IJCET) NEED FOR DESIGN PATTERNS AND FRAMEWORKS FOR QUALITY SOFTWARE DEVELOPMENT

ECE 449 OOP and Computer Simulation Lecture 11 Design Patterns

SDC Design patterns GoF

Programming in C# for Experienced Programmers

CSCI 253. Overview. The Elements of a Design Pattern. George Blankenship 1. Object Oriented Design: Creational Patterns. George Blankenship

CHAPTER 6: CREATIONAL DESIGN PATTERNS

A few important patterns and their connections

Plan. A few important patterns and their connections. Singleton. Singleton: class diagram. Singleton Factory method Facade

Programming in C# (20483)

1 Software Architecture

DESIGN PATTERN - INTERVIEW QUESTIONS

Slide 1. Design Patterns. Prof. Mirco Tribastone, Ph.D

Factory Method Pattern Creational. » Define an interface for creating an object but lets subclasses decide the specific class to instantiate

Design Patterns Reid Holmes

be used for more than one use case (for instance, for use cases Create User and Delete User, one can have one UserController, instead of two separate

SOFTWARE ENGINEERING. To discuss several different ways to implement software reuse. To describe the development of software product lines.

Software Engineering - I An Introduction to Software Construction Techniques for Industrial Strength Software

Review Software Engineering October, 7, Adrian Iftene

Lecture 21: Design Patterns III

The Design Patterns Matrix From Analysis to Implementation

Introduction and History

CSCD01 Engineering Large Software Systems. Design Patterns. Joe Bettridge. Winter With thanks to Anya Tafliovich

Idioms and Design Patterns. Martin Skogevall IDE, Mälardalen University

Finding Source Code On The Web For Remix And Reuse READ ONLINE

Information systems modelling UML and service description languages

Microsoft Visual Basic 2005: Reloaded

Keywords: Abstract Factory, Singleton, Factory Method, Prototype, Builder, Composite, Flyweight, Decorator.

GoF Design Pattern Categories

SYLLABUS CHAPTER - 1 [SOFTWARE REUSE SUCCESS FACTORS] Reuse Driven Software Engineering is a Business

Towards The Adoption of Modern Software Development Approach: Component Based Software Engineering

THOMAS LATOZA SWE 621 FALL 2018 DESIGN PATTERNS

Automatic Code Generation for Non-Functional Aspects in the CORBALC Component Model

Lecture 4: Observer Pattern, Event Library and Componentization

What are the characteristics of Object Oriented programming language?

Ingegneria del Software Corso di Laurea in Informatica per il Management. Design Patterns part 1

Web Application Design. Husni Husni.trunojoyo.ac.id

Design Patterns #3. Reid Holmes. Material and some slide content from: - GoF Design Patterns Book - Head First Design Patterns

Application Architectures, Design Patterns

Goals of Lecture. Lecture 27: OO Design Patterns. Pattern Resources. Design Patterns. Cover OO Design Patterns. Pattern Languages of Programming

Software Architecture

Train control language teaching computers interlocking

Foundations of Software Engineering Design Patterns -- Introduction

Summary of the course lectures

A Primer on Design Patterns

From Design Patterns: Elements of Reusable Object Oriented Software. Read the sections corresponding to patterns covered in the following slides.

Semantics, Metadata and Identifying Master Data

Qlik Sense Desktop. Data, Discovery, Collaboration in minutes. Qlik Sense Desktop. Qlik Associative Model. Get Started for Free

Microsoft Programming in C#

The Skill Research of Interactive Web Site Based on.net: The Design and Development Yanwei XU 1, a, Honghui GONG 2, Ting ZHANG 3

6.3 Patterns. Definition: Design Patterns

Design Pattern and Software Architecture: IV. Design Pattern

Development and Implementation of Workshop Management System Application to Explore Combing Multiple Design Patterns

Generalized Document Data Model for Integrating Autonomous Applications

Patterns. Erich Gamma Richard Helm Ralph Johnson John Vlissides

Software Engineering

Object-Oriented Oriented Programming

Learning Objectives. C++ For Artists 2003 Rick Miller All Rights Reserved xli

CS 520/620 Advanced Software Engineering Spring February 11, 2016

3 Product Management Anti-Patterns by Thomas Schranz

Introduction to Design Patterns

Start Up Benoît Langlois / Thales Global Services Eclipse (EMFT) EGF 2011 by Thales; made available under the EPL v1.

Object Oriented Paradigm

Concept as a Generalization of Class and Principles of the Concept-Oriented Programming

Transcription:

Volume 5, No. 6, July-August 2014 International Journal of Advanced Research in Computer Science RESEARCH PAPER Available Online at www.ijarcs.info Software Quality Improvement using Design Patterns Ms. Renu Bala Department of Computer Science and Application Chaudhary Devi Lal University Sirsa, Haryana, India ISSN No. 0976-5697 Mr. Kapil Kumar Kaswan Department of Computer Science and Application Chaudhary Devi Lal University Sirsa, Haryana, India Abstract Design patterns usually describe abstract systems of interaction between classes, objects, and communication flows. So, a description of a set of interacting classes that provide a generalized solution framework to a generalized/specific design problem in a specific context can be said as a design pattern. There are many design patterns that can be used to solve real-life problems, but it remains very difficult to design, implement and reuse software for complex applications. Examples of these include enterprise system, real-time market data monitoring and analysis system. Design patterns provide an efficient way to create more flexible, elegant and ultimately reusable object-oriented software. Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. The solutions of the given problems are expressed in terms of objects and interfaces. Among 23 design patterns, Strategy pattern defines an interface common to all supported algorithms. Context uses this interface to call the algorithm defined by a Concrete Strategy. In accounting framework one thing is mostly needed that is tax calculation. To solve this problem author in the current study has chosen the strategy pattern. Keywords: Design Pattern, Context, Abstract Factory,Object. I. INTRODUCTION A design pattern is a generic solution that has been observed in multiple instances to help resolve a particular problem within a known context. Design patterns provide an efficient way to create more flexible, elegant and ultimately reusable object-oriented software. Design methods are supposed to promote good design, to teach new designers how to design well and to standardize the way designs are developed. Typically, a design method comprises a set of syntactic notations usually graphical and a set of rules that govern how and when to use each notation. It will also describe problems that occur in a design, how to fix them, and how to evaluate a design. Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice [1]. The solutions of the given problems are expressed in terms of objects and interfaces. Design patterns are being increasingly used in software design. Design patterns are a good means for recording design experience as they systematically name, explain and evaluate important and recurrent designs in software systems. They describe problems that occur repeatedly, and describe the core of the solution to that problem, in such a way that this solution can be used many times in different contexts and applications. A good design is a good solution regardless of the technology. And no matter how good the technology may be, it is only as good as its design, and specifically the implementation of that design. In fact, a great design with older technology may still be good, but a bad design with new technology is usually just bad. A design pattern is a form of design information and the design that worked well in past will be used in future in any application similar to existing application which uses these designs. These design information can help both the experienced and the novice designer to recognize situations in which these designs can be reused. There are three categories of design patterns: Creational, structural and Behavioral. II. NET FRAMEWORK A.net is a new software platform for the desktop and the Web. The.NET Framework is an integral Windows component that supports building and running the next generation of applications. The.NET Framework has two main components: the common language runtime and the.net Framework class library. The common language runtime is the foundation of the.net Framework [2]. The.NET Framework is designed to fulfill the following objectives: a. To provide a consistent object-oriented programming environment whether object code is stored and executed locally, executed locally but Internetdistributed, or executed remotely. b. To provide a code-execution environment that minimizes software deployment and versioning conflicts. c. To provide a code-execution environment that promotes safe execution of code, including code created by an unknown or semi-trusted third party. d. To provide a code-execution environment that eliminates the performance problems of scripted or interpreted environments. e. To make the developer experience consistent across widely varying types of applications, such as Windows-based applications and Web-based applications. f. To build all communication on industry standards to ensure that code based on the.net Framework can integrate with any other code [2]. 2010-14, IJARCS All Rights Reserved 242

III. ABSTRACT FACTORY PATTERN The abstract factory pattern is a design pattern that provides a way to encapsulate a group of individual factories that have a common theme. This pattern provides interfaces for creating families of related or dependent objects without specifying their concrete classes. Modularization is a big issue in today's programming. Programmers all over the world are trying to avoid the idea of adding code to existing classes in order to make them support encapsulating more general information. Take the case of an information manager which manages phone number. Phone numbers have a particular rule on which they get generated depending on areas and countries. If at some point the application should be changed in order to support adding numbers form a new country, the code of the application would have to be changed and it would become more and more complicated. In order to prevent it, the Abstract Factory design pattern is used. Using this pattern a framework is defined, which produces objects that follow a general pattern and at runtime this factory is paired with any concrete factory to produce objects that follow the pattern of a certain country. In other words, the Abstract Factory is a super-factory which creates other factories (Factory of factories) the classes that participate to the Abstract Factory pattern are: a. AbstractFactory - declares an interface for operations that create abstract products. b. ConcreteFactory - implements operations to create concrete products. c. AbstractProduct - declares an interface for a type of product objects. d. Product - defines a product to be created by the corresponding ConcreteFactory; it implements the AbstractProduct interface. e. Client - uses the interfaces declared by the AbstractFactory and AbstractProduct classes. The Abstract Factory pattern has both benefits and flaws. On one hand it isolates the creation of objects from the client that needs them, giving the client only the possibility of accessing them through an interface, which makes the manipulation easier. The exchanging of product families is easier, as the class of a concrete factory appears in the code only where it is instantiated. Also if the products of a family are meant to work together, the Abstract Factory makes it easy to use the objects from only one family at a time. On the other hand, adding new products to the existing factories is difficult, because the Abstract Factory interface uses a fixed set of products that can be created. That is why adding a new product would mean extending the factory interface, which involves changes in the AbstractFactory class and all its subclasses. This section will discuss ways of implementing the pattern in order to avoid the problems that may appear. A. Factories as singletons: An application usually needs only one instance of the ConcreteFactory class per family product. This means that it is best to implement it as a Singleton. B. Creating the products: The AbstractFactory class only declares the interface for creating the products. It is the task of the ConcreteProduct class to actually create the products. For each family the best idea is applying the Factory Method design pattern. A concrete factory will specify its products by overriding the factory method for each of them. Even if the implementation might seem simple, using this idea will mean defining a new concrete factory subclass for each product family, even if the classes are similar in most aspects. For simplifying the code and increase the performance the Prototype design pattern can be used instead of Factory Method, especially when there are many product families. In this case the concrete factory is initiated with a prototypical instance of each product in the family and when a new one is needed instead of creating it, the existing prototype is cloned. This approach eliminates the need for a new concrete factory for each new family of products. C. Extending the factories: The operation of changing a factory in order for it to support the creation of new products is not easy. What can be done to solve this problem is, instead of a CreateProduct method for each product, to use a single Create method that takes a parameter that identifies the type of product needed. This approach is more flexible, but less secure. The problem is that all the objects returned by the Create method will have the same interface, that is the one corresponding to the type returned by the Create method and the client will not always be able to correctly detect to which class the instance actually belongs[3]. IV. RELATED WORK There are various design patterns that can be used to solve any of the industrial application. Here in this paper work, Singleton pattern, Abstract factory pattern is used to build a framework. Using these patterns, design solution of the industrial problem will be described. The father of the pattern concept, proposed a description template stating nine essential pattern elements. These patterns element describes the design patterns effectively; also describe how these patterns are useful to solve the problem. Industrial applications typically require different kinds of interfaces to the data they store and the logic they implement are data loaders, user interface and integration gateways and others. Instead of using for different purpose, these interfaces often need common interactions with the application to access and manipulate its data and invoke its business logic. These interactions may be complex, involving transaction across multiple resources and the coordination of several responses to an action. These interfaces decide the interaction between different layers of the application; how user interacts with middleware layer and the database layer. The framework is implemented in.net. As we are using the design patterns to build this framework hence the developer can use this framework to build any kind of industrial application and can implement it in any other programming language using object-oriented concepts. Using the concept of design patterns, now we are proposing a class diagram of an industrial application. There are various classes with their methods and properties [5]. 2010-14, IJARCS All Rights Reserved 243

V. ANALYZE ABSTRACT FACTORY PATTERN BY REFLECTION Reflection is simply a mechanism that allows components or classes to interrogate each other at run time and discover information that goes beyond the information gleaned from the publicly available interfaces the objects expose. In essence, reflection enables objects to provide information about themselves (metadata). The common language runtime loader manages application domains. This management includes loading each assembly into the appropriate application domain and controlling the memory layout of the type hierarchy within each assembly. The use of reflection in current study is to create an instance of a class once (Singleton pattern) and used that instance forever in that application. The reflection methods works as a singleton pattern in this framework. Figure: 1 VI. SIMULATION OF ABSTRACT FACTORY DESIGN PATTERN The abstract factory pattern is a design pattern that provides a way to encapsulate a group of individual factories that have a common theme. This pattern provides interfaces for creating families of related or dependent objects without specifying their concrete classes. In this research paper, we are building a framework using patterns that can be used to solve various industrial designs problem. This framework can be used by various programmers but its implementation may vary. There are various form created under this framework. Industrial Application Model describes main classes and relationships which could be used during analysis phase to better understand domain area for any kind of Industrial Application. ViewIfc interface is a user interface through which users can interact to the application model. There is a state class through which a user can decide in which state the ViewIfc will open the application i.e. to edit or to delete the entry in the application. RequestHandler class is an intermediate class between the ViewIfc and WorkerIfc that how a user can add a new worker or can use existing workers. There are two interfaces which implements the WorkerIfc that are MasterWorkerIfc and TransactionWorkerIfc. Any action performed on these two interfaces is stored in Action enumeration. All the workers stored in the DBInteraction enumeration. All the actions that are performed on DBInteraction are stored in DbActions enumeration. The form ViewIfc interface form. Item form is Graphic user Interface (GUI) for interacting with user. Every GUI implements viewifc Interface. Method GetWorker provides the workers by using singleton class object RequestHandler. The state enumeration describes the state in which it is open. There are various methods available in the state enumerations that are Add, Edit, Delete, and Query. That defines whether to add new records or edit or delete existing records. The ViewIfc interface is a user interface form from which user can interact with application. There are three methods in the ViewIfc interface that are FillBag, GetWorker, and SetFilter. The FillBag method is used to fill the entries in the database. We can use the GetWorker method of ViewIfc interface to call the RequestHandler class. RequestHandler is a singleton class. It contains static reference variable minstance of type RequestHandler. AddEventHandler method uses reflection to make object of worker classes and add them into _eventhandler collection using Actions enum as parameter and return the worker. The framework is inspired from MVC model (Model, View, and Controller). The model consists of application data and business rules, and the controller mediates input, converting it to commands for the model or view. A view can be any output representation of data, such as a chart or a diagram. With the responsibilities of each component thus defined, MVC allows different views and controllers to be developed for the same model. It also allows the creation of general-purpose software frameworks to manage the interactions. 2010-14, IJARCS All Rights Reserved 244

The ViewIfc interface is a user interface form from which user can interact with application. There are three methods in the ViewIfc interface that are FillBag, GetWorker, and SetFilter. The FillBag method is used to fill Figure:2 Framework of industrial application the entries in the database. We can use the GetWorker method of ViewIfc interface to call the RequestHandler class. RequestHandler is a singleton class. It contains static reference variable minstance of type RequestHandler. Figure 3 The tendencies of pattern line density and maintainability. Table 1. The tendency of the quality attributes in case of design pattern changes Revision (r) pattern Pattern line density(pdensr) maintainablity(mr) testability analyzability stability Change ability 531 +3 574 +1 609-1 - - - - - 716 +1 758 +1 2010-14, IJARCS All Rights Reserved 245

VII. CONCLUSION Although the belief of utilizing design patterns to create better quality software is fairly widespread, there is relatively little research objectively indicating that their usage is indeed beneficial. In this paper we try to reveal the connection between design patterns and software maintainability. It is very hard to understand better what the patterns are and how they relate to each other. At this point there is a fundamental picture as reacting to an event to produce accounting entries. We used our probabilistic quality model for estimating the maintainability. We found that every introduced pattern instance caused an improvement in the different quality attributes. Moreover, the average design pattern line density showed a very high, 0.89 Pearson correlations with the estimated maintainability values. Design patterns are outstanding communication tool and help to make the design process faster. This allows solution providers to take the time to concentrate on the business implementation. Patterns help the design to make it reusable. Reusability not just applies to the component, but also the stages of the design that must go from a problem to final solution. The ability to apply a pattern that provides a repeatable solution is worth the little time spent learning formal patterns. There are some promising results showing that applying design patterns improve the different quality attributes according to our maintainability model. In addition, the ratio of the source code lines taking part in some design patterns in the system has a very high correlation with the maintainability. However, these results are only a small step towards the empirical analysis of design patterns and software quality [4].Design patterns shall support reuse of a software architecture in different application domains as well as reuse of flexible components[6]. VIII. REFERENCES [1] http://blogs.infragistics.com/blogs/ux/archive/2009/02/03/ what-is-a-design-pattern-and-why-use-them-forquince.aspx [2] Bertrand Meyer, Karine Arnout, Componentization: The Visitor Example, to appear in Computer (IEEE), 2006. [3] http://www.oodesign.com/abstract-factory-pattern.html [4] P eter Heged us, D enes B an, Rudolf Ferenc, and Tibor Gyim othy University of Szeged, Department of Software Engineering Arp ad t er 2. H-6720 Szeged, Hungary {hpeter,zealot,ferenc,gyimothy}@inf.u-szeged.hu [5] Meyer, Bertrand "Componentization: The Visitor Example". IEEE computer (IEEE) 39 (7): 23 30. [6] Jurgen Dorn and Tabbasum Naz,Institute of Information Sysytems 184/2 Technicla University Vienna,Favoritenstrabe 9-11, Vienna A-1040, Austria {dorn/naz}@dbai.tuwien.ac.at 2010-14, IJARCS All Rights Reserved 246