Author(s): Nilesh D Kulkarni* and Saurav Bansal
In this paper, we explored the utilization of the Facade design pattern within the realm of software engineering, with a specific focus on its application in a real-world business context for a phone application. We elucidate how the Facade pattern simplifies intricate subsystems by presenting a unified interface, thereby improving both usability and maintainability. The paper includes an in-depth case study that exemplifies the seamless integration of a new service into an existing phone system, highlighting the tangible advantages of employing the Facade pattern in practical situations. Furthermore, the study delves into the influence of design patterns on software maintainability, underscoring their pivotal role in effective software design and architecture.
The importance of design experience is widely recognized. How often have you encountered a familiar problem during design, sensing that you've tackled something similar in the past, yet struggling to recall the specifics of where and how it was resolved? If you were able to recall the nuances of that past challenge and the strategy you employed to overcome it, you could leverage that previous experience instead of having to re-explore the solution from scratch. A design pattern represents a universally recognized solution, widely observed in various cases, that effectively addresses a specific problem in a context that may not be predefined.
It offers a highly efficient approach to developing objectoriented software that is not only flexible and elegant but also reusable. The utilization of design patterns facilitates the reuse of successful designs and architectural models. By translating proven technologies and methodologies into design patterns, they become more easily accessible to developers building new systems. Design patterns guide developers in selecting design options that enhance the reusability of a system, while steering clear of choices that could hinder it. Moreover, design patterns can significantly enhance the documentation and maintenance of existing systems by providing a clear and explicit description of class and object interactions, along with their fundamental purposes. In essence, design patterns empower designers to achieve a more effective design more swiftly
Typically, a design method comprises a set of synthetic notations usually graphical and a set of rules that govern how and when we use each notation. It will also describe problems that occur in a design, how to fix them, and how to evaluate the design. Each pattern describes a problem which occurs over and over again in the 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].
Design patterns describe problems that occur repeatedly, and describe the core of the solution to that problem, in such a way that the solution can be used many times in different contexts and applications. A good design should always be independent of the technology and the design should help both experience and the novice designer to recognize situation in which these designs can be used and reused. Eric gamma at el in their book Design Patterns, discussed total 23 design patterns clarified by two criteria figure 1. The first criterion, called purpose, reflects what a pattern does. Patterns can have either creational, structural, or behavioral purpose. Creational patterns concern the purpose of object creation. Structural pattern deals with the composition of classes or objects. Behavioral pattern characterizes the ways in which classes or objects interact and distribute responsibility [2]. The second criteria called scope, specifies whether the pattern applies primarily to the class or to the object.
The first versions of UML were created by “Three Amigos” - Grady Booch at el defines “The Unified Modeling Language (UML), is a standardized visual language for specifying, constructing, and documenting the artifacts of software systems. It provides a set of diagrams and notations to represent various aspects of software design and architecture, allowing software engineers to communicate, visualize, and model complex systems effectively.”
Composition relationship: a composition is a strong type of aggregation where each component in the composite can belong to just one whole. As shown in figure 4, a dog can have a tail, four legs, two ears, and two eyes, but eyes, legs, tail, and ears cannot exist on its own.
We will using the basic programming tools to show the implementation of the Facade design pattern.
The .NET Framework, is a software development framework designed and supported by Microsoft. It provides a controlled environment for developing and running applications on Windows. Few features listed below
The .NET Framework is designed to work on Windows operating systems.
It includes a large class library known as the Framework Class Library (FCL), providing user interface, data access, database connectivity, cryptography, web application development, numeric algorithms, and network communications.
Programs written for the .NET Framework execute in a software environment named the Common Language Runtime, which provides services such as security, memory management, and exception handling.
The .NET Framework supports multiple programming languages, such as C#, VB.NET, and F#.
Console programming refers to the process of writing software applications that interact with the user through a text-based interface. These applications run in a console or a command-line interface (CLI), where the user inputs text commands and the program provide output in text form.
Visual Studio Code is a lightweight, open-source, and crossplatform code editor developed by Microsoft. It's not specific to any one programming language or framework. With the help of extensions, it can support a wide variety of languages and frameworks, including those of the .NET ecosystem. Few features listed below
VS Code runs on Windows, Linux, and macOS.
The C# extension by Omni Sharp adds support for .NET development, including features like IntelliSense, debugging, project file navigation, and run tasks.
VS Code is designed to be a fast and lightweight editor, with a smaller footprint than a full IDE like Visual Studio.
Developers can use the integrated terminal to execute .NET CLI commands, enabling them to create, build, run, and test .NET applications.
VS Code has built-in Git support, which is essential for modern software development workflows.
VS Code with the C# extension supports advanced language features like code refactoring, unit testing, and code snippets for .NET.
Structural design patterns within the realm of software engineering offer effective solutions for addressing design challenges that revolve around the arrangement of classes or objects. These patterns excel in the creation of software systems that are both flexible and amenable to extension. They do so by prescribing methodologies for the assembly of objects and classes, enabling seamless modification of object composition without impinging on their individual implementations.
Moreover, these design patterns advocate for the judicious reuse of pre-existing classes and objects. This practice facilitates the development of software through the harmonization of existing components in diverse configurations. Furthermore, they enhance the overall lucidity and organizational structure of the codebase by delineating explicit relationships and hierarchies among classes and objects.
In addition, structural design patterns effectively encapsulate the intricacies associated with object composition. This encapsulation simplifies the management and upkeep of large-scale software systems. Furthermore, these patterns place emphasis on minimizing the coupling between classes and objects, thereby fostering modularity and maintainability in the codebase...
The Facade Pattern, a structural design patterns in software engineering, offers a solution to a persistent challenge on how to provide a streamlined interface to intricate subsystems composed of classes, interfaces, or objects. This pattern serves as an invaluable tool for hiding the intricate workings of a system, presenting clients with a cohesive, uncomplicated interface. Its biggest objective is to elevate system usability and comprehensibility by diminishing the convolutions that often permeate complex software systems. Key components and characteristics of the Facade pattern are
This entity, whether it be a class or an interface, functions as the solitary ingress point to a convoluted subsystem. Its role encompasses the encapsulation of interactions and operations involving myriad classes or objects nested within the subsystem.
The subsystem embodies an assembly of classes, objects, or components, collaboratively engaged in the execution of diverse tasks. Frequently, these classes are intricately interlinked, engendering complex relationships among them.
Within the system's framework, the client assumes the role of the entity that interfaces with the Facade, thereby gaining access to the functionalities embedded within the subsystem.
“Rooftop Windows” a window manufacturing local business establishment, install a factory-made window for home and commercial office buildings. The Rooftop Windows is a brick-andmortar shop, operating from the store, website and a phone system. To allow a seamless customer experience, Rooftop windows has developed a phone application with seven different phone numbers (shown in figure 6) which allows the customers to order on phone, get delivery update, pay on phone, request packaging, order supplies, find out the taxes, estimated warehouse delivery dates.
After operating the business for approximately one year and considering the consistent requests from customers to physically inspect the windows before making a purchase, the owner of this local establishment has made the decision to introduce a new service called "Schedule Showroom Appointment." This addition presents a significant challenge for the application developer, as it involves incorporating a new functionality into the existing phone system.
In essence, the phone application offers a user-friendly voice interface for accessing the ordering system, payment gateways, and the newly introduced appointment scheduling service, ensuring a smooth and convenient experience for customers.
Design pattern that provides a facade (1) for interfacing with the subsystems (2) and hides the complexity within the subsystems from the client (3) - see figure 8.
The original study to evaluate the impact of design patterns on software maintenance was applied by [4]. They conducted an experiment call PatMain by comparing the maintainability of two implementations of an application, one using a design pattern and the other using a simple alternative. They used four different subject systems in the same programming language. They addressed five patterns - decorator, composite, abstract factory, observer and visitor. The researchers measure the time and correctness of the given maintenance task for professional participants. They found that it was useful to use a design pattern but in case where simple solution is preferred, it is good to follow the software engineer common sense about whether to use a pattern or not, and in case of uncertainty it is better to use a pattern as a default approach.
A design pattern is a generalized reusable solution two commonly occurring problem in a software design. It can be defined as a description or template for how to solve a problem that can be used in many different situations [5]. In this paper, we aim to demonstrate the practical application of the facade design pattern in a specific use case. Design patterns serve as invaluable communication tools and expedite the design process. They empower solution providers to focus on solving the business problem while promoting reusability in the design. Reusability extends not only to individual components but also to the entire design process, from problem-solving to the final solution. The ability to apply patterns that offer repeatable solutions is well worth the time invested in learning them. There are promising results indicating that the utilization of design patterns enhances quality and contributes to maintainability. The proportion of source code lines involved in design patterns within a system shows a strong correlation with maintainability. However, it's important to note that these findings represent just a small step in the empirical analysis of software quality concerning design patterns. Design patterns should facilitate the reuse of software architecture across different application domains and promote the reuse of flexible components.