ArticlePublisher preview available
To read the full-text of this research, you can request a copy directly from the authors.

Abstract and Figures

Several software design patterns have cataloged either with canonical or as variants to solve a recurring design problem. However, novice designers mostly adopt patterns without considering their ground reality and relevance to design problems, which causes to increase the development and maintenance efforts. The existing automated systems to select the design patterns need either high computing effort and time for the formal specification or precise learning through the training of several classifiers with large sample size to select the right design patterns realized on the base of their ground reality. In order to discuss this issue, we propose a method on the base of a supervised learning technique named ‘Learning to Rank’, to rank the design patterns via the text relevancy with the description of the given design problems. Subsequently, we also propose an evaluation model to assess the effectiveness of the proposed method. We evaluate the efficacy of the proposed method in the context of several design pattern collections and relevant design problems. The promising experimental results indicate the applicability of the proposed method as a recommendation system to select the right design pattern(s).
This content is subject to copyright. Terms and conditions apply.
METHODOLOGIES AND APPLICATION
A methodology to rank the design patterns on the base of text
relevancy
Shahid Hussain
1
Jacky Keung
2
Mohammad Khalid Sohail
1
Arif Ali Khan
3
Manzoor Ilahi
1
Ghufran Ahmad
1
Muhammad Rafiq Mufti
4
Muhammad Asim Noor
1
Published online: 18 March 2019
ÓSpringer-Verlag GmbH Germany, part of Springer Nature 2019
Abstract
Several software design patterns have cataloged either with canonical or as variants to solve a recurring design problem.
However, novice designers mostly adopt patterns without considering their ground reality and relevance to design prob-
lems, which causes to increase the development and maintenance efforts. The existing automated systems to select the
design patterns need either high computing effort and time for the formal specification or precise learning through the
training of several classifiers with large sample size to select the right design patterns realized on the base of their ground
reality. In order to discuss this issue, we propose a method on the base of a supervised learning technique named ‘Learning
to Rank’, to rank the design patterns via the text relevancy with the description of the given design problems. Subsequently,
we also propose an evaluation model to assess the effectiveness of the proposed method. We evaluate the efficacy of the
proposed method in the context of several design pattern collections and relevant design problems. The promising
experimental results indicate the applicability of the proposed method as a recommendation system to select the right
design pattern(s).
Keywords Software design patterns Text mining Learning to rank Performance Classification
1 Introduction
In software development life cycle, software design is consid-
ered as a most challenging task as compared to other activities.
An architecture-based design method is one of the main groups
which can be realized during the evolution process. In this
category, different software architectural styles are applied and
can be considered as coordination tools among the activities of
the software development life cycle. An architectural style
describes the components and their relationship and provides a
bridge between satisfactions of system’s critical requirements
to implementation (Bass et al. 2012). The most common
architecture-based design method is Attribute Driven Design
(ADD) which incorporates the different architectural strategies
and patterns to fulfill the quality attributes. In the working
procedure of ADD, a software developer selects an architec-
tural style and chooses the desired quality attributes included in
the software system. Subsequently, software developers use the
description of design requirements related to selected archi-
tectural component and employed software design patterns
(Wood 2007). Over many years, based on their experiences,
software developers have encapsulated and suggested the
Communicated by V. Loia.
&Shahid Hussain
shussain@comsats.edu.pk
&Arif Ali Khan
aakhan@comsats.edu.pk
Jacky Keung
jacky.keung2-c@my.cityu.edu.hk
Mohammad Khalid Sohail
Khaled_sohail7@comsats.edu.pk
Manzoor Ilahi
mitamimy@comsats.edu.pk
Ghufran Ahmad
ghufranahmad23@comsats.edu.pk
Muhammad Rafiq Mufti
Rafiq_muftee16@ciitvehari.edu.pk
Muhammad Asim Noor
asimnoor11@comsats.edu.pk
1
CU, Islamabad, Pakistan
2
City University of Hong Kong, Hong Kong, China
3
Nanjing University, Nanjing, China
4
CU, Vehari, Pakistan
123
Soft Computing (2019) 23:13433–13448
https://doi.org/10.1007/s00500-019-03882-y(0123456789().,-volV)(0123456789().,-volV)
Content courtesy of Springer Nature, terms of use apply. Rights reserved.
... Fortunately, some problems are already known to arise recurrently during software development. To solve these known problems, developers use design patterns that are proven solutions designed by other developers from their experiences [Hussain et al. 2019]. ...
... Generally, a pattern is described through two sections, which are the problem domain and the solution domain. The problem domain exposes the context in which a pattern is applied, while the solution domain presents the structure to solve a problem [Hussain et al. 2019]. Table 4 shows the information used to describe a pattern [Richardson 2018], except for id and link. ...
... Hussain and other authors [Hussain et al. 2019], in addition to dealing with recommending GoF patterns, also deal with recommending security patterns [Schumacher et al. 2013], patterns mentioned by Landay and Hong [Landay and Hong 2003], and Douglass [Douglass 2003]. The authors propose a recommendation approach based on information retrieval and "Learning to Rank". ...
Article
Full-text available
Software developers encounter recurring problems during software development, which can be solved using proven solutions known as design patterns. Microservices architecture, a Service-Oriented Architecture (SOA) variant, presents common communication, deployment, and service definition challenges. However, selecting the appropriate design pattern from a vast pool of patterns to solve a problem is difficult for novice and experienced developers. This paper proposes a recommendation tool based on Information Retrieval (IR) to assist developers in choosing the suitable microservices pattern to solve a given problem. The tool leverages textual descriptions given by developers to provide relevant indications of microservices patterns. It has been evaluated using both toy and industrial problems, demonstrating promising results. The results showed that the tool was able to solve 60% of toy design problems, indicating that it can provide valuable and accurate recommendations. Furthermore, tests with industrial problems revealed that over 70% of the recommended patterns helped to address the problems at hand. Interviews with developers who work in the software industry corroborated the recommendation tool’s effectiveness and practicality.
... In a component-based engineering process, a design pattern (D.P.) for recurrent problems solution for improving the development process for the common situation in all phases [37], [42], [48]- [52]. A DP is optimal to general issue solution that the development team faced during CBSE development process improvement [49], [50]. ...
... A DP is optimal to general issue solution that the development team faced during CBSE development process improvement [49], [50]. As C.B.S. development D.P. based on reuse in the same situations for designing systems and have different types of D.P., i.e., adapter, template, observer, strategy, etc. suitable in different scenarios [48], [49], [51], [52]. Therefore, D.P. applicable is different in different situations, i.e., for component integration, analysis, testing etc. ...
Article
Full-text available
To survive in the competitive environment, most organizations have adopted component-based software development strategies in the rapid technology advancement era and the proper utilization of cloud-based services. To facilitate the continuous configuration, reduce complexity, and faster system delivery for higher user satisfaction in dynamic scenarios. In cloud services, customers select services from web applications dynamically. Healthcare body sensors are commonly used for diagnosis and monitoring patients continuously for their emergency treatment. The healthcare devices are connected with mobile or laptop etc. on cloud environment with network and frequently change applications. Thus, organizations rely on regression testing during changes and implementation to validate the quality and reliability of the system after the alteration. However, for a large application with limited resources and frequently change component management activities in the cloud computing environment, component-based system verification is difficult and challenging due to irrelevant and redundant test cases and faults. In this study, proposed a test case selection and prioritization framework using a design pattern to increase the faults detection rate. First, we select test cases on frequently accessed components using observer patterns and, secondly, prioritize test cases on adopting some strategies. The proposed framework was validated by an experiment and compared with other techniques (previous faults based and random priority). Hence, experimental results show that the proposed framework successfully verified changes. Subsequently, the proposed framework increases the fault detection rate (i.e., more than 90%) than previous faults based and random priority (i.e., more than 80% respectively).
... Previous work has applied learning-to-rank to software engineering tasks. For example, on fault localization [40,[70][71][72], bug-finding process [73][74][75], code search [76], defects prediction [77,78], rule-specification mining [79], recommendation system to classify and select design patterns [80], third-party libraries [81]. Differently from these works, our work is the first to apply learning-to-rank to suggest file-level migrations. ...
Article
Context A Legacy system can be defined as a system that significantly resists modification and evolution. According to the literature, there are two main strategies to migrate a legacy system: (a) to replace the legacy system by a new one, (b) to incrementally migrate parts from the legacy system to the new one. Incremental migration allows developers to better control the risks that may occur during the migration process. However, this strategy is more complex because it requires decomposition of the legacy system into different parts, e.g. a set of files, and to define the order of migration of them along the migration process. To our knowledge, there is no approach to support developers on those activities. Objective This paper presents an approach, named MigrationExp, to support incremental language migrations of applications from one source language to another target language. MigrationExp recommends the files that should be migrated first in a particular migration iteration. As a novelty, our approach relies on a ranking model learned, using a learning-to-rank algorithm, from migrations made by developers. Method We validate our approach in the context of the migrations of Android apps, from Java to Kotlin, a new official language for Android. We train our model using migrations of Java code to Kotlin written by developers on open-source applications. Results The results show that, on the task of proposing files to migrate, our approach outperforms a previous migration strategy proposed by Google, in terms of its ability to accurately predict empirically observed migration orders. Conclusion Since most Android applications are written in Java, we conclude that approaches to support developers such as MigrationExp may significantly impact the development of Android applications.
... Hussain et al. [122] used an LTR method to create a prototype of an automated recommendation system to classify and select design patterns. Given a design problem description, their approach ranks the design patterns according to the text relevancy. ...
Thesis
In recent years, with more than 3 million applications on its official store, Google’s Android has dominated the market of mobile operating systems worldwide. Despite this success, Google has continued evolving its operating system and its toolkits to ease application development. In 2017 Google declared Kotlin as an official Android programming language. More recently, during the Google I/O 2019, Google announced that Android became ‘Kotlin-first’, which means that new API, libraries, and documentation will target Kotlin and eventually Java and Kotlin as preferred language to create new Android applications. Kotlin is a programming language that runs on the Java Virtual Machine (JVM) and it is fully interoperable with Java because both languages are compiled to JVM bytecode. Due to this characteristic, Android developers do not need to migrate their existing applications to Kotlin to start using Kotlin in these applications. Moreover, Kotlin provides a different approach to write applications because it combines object-oriented and functional features. Therefore, we hypothesize that the adoption of Kotlin by developers may affect different aspects of Android applications’ development. However, one year after this first announcement, there were no studies in the literature about Kotlin. In this thesis, we conducted a series of empirical studies to address these lacks and build a better understanding of creating high-quality Android applications using Kotlin. First, we carried a study to measure the degree of adoption of Kotlin. Our results showed that 11% of the studied Android applications had adopted Kotlin. Then, we analyzed how the adoption of Kotlin impacted the quality of Android applications in terms of code smells. We found that the introduction of Kotlin in Android applications initially written in Java produces a rise in the quality scores from 50% to 80% according to the code smell considered. We analyzed the evolution of usage of features introduced by Kotlin, such as Smart cast, and how the amount of Kotlin code changes over applications’ evolution. We found that the number of instances of features tends to grow throughout applications’ evolution. Finally, we focused on the migration of Android applications from Java to Kotlin. We found that 25% of the open source applications that were initially written in Java have entirely migrated to Kotlin, and for 19%, the migration was done gradually, throughout several versions, thanks to the interoperability between Java and Kotlin. This migration activity is challenging because: a) each migrated piece of code must be exhaustively tested after the migration to ensure it preserves the expected behavior; b) a project can be large, composed of several candidate files to be migrated. In this thesis, we present an approach to support migration, which suggests, given a version of an application written in Java and eventually, in Kotlin, the most convenient files to migrate. We evaluated our approach’s feasibility by applying two different machine learning techniques: classification and learning-to-rank. Our results showed that both techniques modestly outperform random approaches. Nevertheless, our approach is the first that proposes the use of machine learning to recommend file-level migrations. Therefore, our results define a baseline for future work. Since the migration from Java to Kotlin may positively impact the application’s maintenance and that migration is time-consuming and challenging, developers may use our approach to select the files to be migrated first. Finally, we discuss several research perspectives opened by our results that can improve the experience of creating high-quality Android applications using Kotlin.
... Haas and Hummel [83] applied learningto-rank to derive a scoring function that suggests extract method refactoring of long Java methods. Hussain et al. [84] used learning-to-rank to create a prototype of an automated recommendation system to classify and select design patterns. Different from these works, our work is the first one to apply learning to rank to suggest file-level migrations. ...
Preprint
Full-text available
In 2017, Google announced Kotlin as an official Android programming language, and more recently, as the preferred programming language to build applications. These facts motivated developers to migrate their applications, which is challenging because each migrated piece of code must be tested after the migration to ensure it preserves the expected behavior. Due to the interoperability between Java and Kotlin, most developers decided to migrate their applications gradually. Thus, developers have to decide which file(s) to migrate first on each migration step. However, there are no tools available to help developers make these choices. This paper presents an approach to support a gradual migration of Android applications that given a version of an application written in Java and eventually, in Kotlin, it suggests the most convenient files to migrate. To this end, we built a large-scale corpus of open-source projects that migrated Java files to Kotlin. Then, we trained a learning to rank model using the information extracted from these projects. To validate our model, we verify whether these recommendations made by them correspond to real migrations. The results showed our approach modestly outperforms random approaches. Since most Android applications are written in Java, we conclude that our approach may significantly impact Android applications' development. Therefore, we consider this result is the first step into long-term research towards a model capable of predicting precisely file-level migration, establishing the initial baseline on file migrations.
Conference Paper
Clean Architecture (CA) aims to address the need for more loosely coupled components and better cohesion. CA focuses on prepar- ing software engineers to write more stable, durable, and flexible appli- cations capable of distinguishing between details (e.g., what framework it uses) and the business logic requirements. A literature review shows that considerable effort has been devoted to cataloging and solving code smells related to code, often called code smells. However, the same does not apply to architecture smells – its software architecture counterpart. Similar research regarding other programming languages such as Java, PHP, or C# represents noteworthy works in the area, but they do not address Python applications directly. This work directs efforts towards redesigning and adapting existing Python programs to the CA principles by detecting the code smells that break the CA constraints through the developed CALint tool. Moreover, this approach proposes two extended refactoring techniques to solve these smells efficiently by grouping and comparing static code analysis and reuse them to enforce Clean Archi- tecture’s Dependency Rule programmatically. To demonstrate the feasi- bility of the two refactoring techniques described in this work and the CALint tool, we applied them to three different case studies. The major findings of this work include two extended refactoring techniques and the development of a tool to verify non-conformities related to the Clean Architecture dependency rule. The results show common cases where the dependency rule was violated and highlighted by the CALint tool, which are fixed with the support of refactoring steps.
Chapter
Microservices are becoming increasingly popular for the development of distributed systems. However, in order to adopt microservices in practice, one has to deal especially with decomposition, communication and deployment of services. These issues can be solved by applying design patterns to microservices. Although it seems simple, developers may present difficulties when selecting the correct pattern to solve a given problem. This situation happens both to beginners and experienced professionals, as there are a considerable number of patterns to master. This study proposes an information retrieval-based approach to recommend patterns applied to microservices considering problems expressed by developers in natural language. To evaluate the proposed approach, we created two corpus, the first one containing 10 patterns, and the second 10 problems. When performing the experiments, we were able to achieve a precision rate of 60%. From this study, it is possible to support developers in selecting patterns applied to microservices, which facilitates their adoption and the development of higher quality systems, also benefiting organizations, as well as assisting researchers in future studies, presenting a possible way to recommend these patterns.
Conference Paper
We focus on needs of software developers, aiming to increase quality of test suites. We defined a software architecture of a tool to assist software developers for conducting automated test case generation and executing the test cases in object-oriented programs, considering white-box techniques such as the data flow criteria. The architecture, named Test Case Generator (TCG), includes functional and non-functional requirements based on the attribute-driven design method. We evaluated the architecture using the architecture tradeoff analysis method and usage scenarios.
Conference Paper
Full-text available
Several software design patterns have been familiarized either in canonical or as variant solutions in order to solve a problem. Novice designers mostly adopt patterns without considering their ground reality and relevancy with design problems, which may cause to increase the development and maintenance efforts. In order to realize the ground reality and to automate the selection process, the existing automated systems for the selection of design patterns either need formal specification or precise learning through training the numerous classifiers. In order to address this issue, we propose an approach on the base of a supervised learning technique named ‘Learning to Rank’, to rank the design patterns with respect to text similarity with the description of the given design problems. Subsequently, we also propose an evaluation model in order to assess the effectiveness of the proposed approach. We evaluate the effectiveness of the proposed approach in the context of several design pattern collections and relevant design problems. The promising experimental results indicate the applicability of the proposed approach.
Article
Full-text available
Design patterns were popularized by the GoF catalog in 1995. This catalog contains 23 design patterns which concern 23 design problems. Each pattern is detailed with its structure, its intent, and some information including applicability conditions and some possible variations which enable it to be re-used. In 1995, they were the cutting edge thought processes. We consider that design patterns have two major features. First, they are the result of emergent conceptions validated by a community through a well-defined acceptance process. They are a field of expert knowledge. Secondly, they must be as abstract as needed to be able to maximize their reusability. They constitute a compilation of best practices concerning object codes and designs. We propose to extend the GoF with a new concept that we have named “spoiled patterns”. They are midway between bad smells in design necessary to go ahead with a refactoring and a necessary learned lesson in order to explain anti-patterns. Each design pattern corresponds to some spoiled patterns. In this paper, we present how we have compiled the first spoiled patterns catalog, by carrying out several experiments with a lot of young inexperienced designers.
Article
Numerous software design patterns have been introduced and cataloged either as a canonical or a variant solution to solve a design problem. The existing automatic techniques for design pattern(s) selection aid novice software developers to select the more appropriate design pattern(s) from the list of applicable patterns to solve a design problem in the designing phase of software development life cycle.
Article
Today, many software architecture design methods consider the use of architectural patterns as a fundamental design concepts. When making an effective pattern selection, software architects must consider, among other aspects, its impact on promoting or inhibiting quality attributes. However, for inexperienced architects, this task often requires significant time and effort. Some reasons of the former include: the number of existing patterns, the emergence of new patterns, the heterogeneity in the natural language descriptions used to define them and the lack of tools for automatic pattern analysis. In this paper we describe an approach, based on knowledge representation and information extraction, for analysing architectural pattern descriptions with respect to specific quality attributes. The approach is automated by computable model that works as a prototype tool. We focus on the performance quality attribute and, by performing experiments on a corpus of patterns with forty-five architects of varying levels of experience, demonstrate that the proposed approach increases recall and reduces analysis time compared to manual analysis.
Conference Paper
The success of software applications that collect and process personal data does not only depend on technical aspects, but is also linked to social compatibility and user acceptance. It requires experts from different disciplines to ensure legal compliance, to foster the users' trust, to enhance the usability of the application and to finally realize the application. Multidisciplinary requirements have to be formulated, interwoven and implemented. We advocate the use of interdisciplinary design patterns that capture the design know-how of typical, recurring features in socially aware applications with particular concern for socio-technical requirements. The proposed patterns address interdisciplinary concerns in a tightly interwoven manner and are intended to facilitate the development of accepted and acceptable applications that in particular deal with sensitive user context information.
Article
Feature selection is known as a good solution to the high dimensionality of the feature space and mostly preferred feature selection methods for text classification are filter-based ones. In a common filter-based feature selection scheme, unique scores are assigned to features depending on their discriminative power and these features are sorted in descending order according to the scores. Then, the last step is to add top-N features to the feature set where N is generally an empirically determined number. In this paper, an improved global feature selection scheme (IGFSS) where the last step in a common feature selection scheme is modified in order to obtain a more representative feature set is proposed. Although feature set constructed by a common feature selection scheme successfully represents some of the classes, a number of classes may not be even represented. Consequently, IGFSS aims to improve the classification performance of global feature selection methods by creating a feature set representing all classes almost equally. For this purpose, a local feature selection method is used in IGFSS to label features according to their discriminative power on classes and these labels are used while producing the feature sets. Experimental results on well-known benchmark datasets with various classifiers indicate that IGFSS improves the performance of classification in terms of two widely-known metrics namely Micro-F1 and Macro-F1.