Model-Driven Methodology for Developing RESTful Web Services

Amir Deljouyi
7 min readJul 5, 2021

Abstract

Offering software in the form of web services has gained great popularity due to the evolution of cloud architectures. REpresentational State Transfer (REST) comprises a set of rules and practices that provide simple and comprehensible APIs, clear representational structures, and scalable services to be used in web engineering. Due to the simplicity and scalability of the REST architecture, it has increasingly become popular among web-service developers. Among the architectures used in web service design (REST, WSDL, SOAP), REST is the most common; it has significantly changed how systems are developed based on web services.

Model-Driven Development (MDD) can facilitate the construction of complex applications. This approach can be an effective method for designing RESTful web services by using modeling languages and can ultimately support automatic code generation through transformations of models. In addition, the Domain-Driven Design (DDD) approach can be effective for producing a rich domain model for web services. However, existing methods do not adequately cover the web service development process, and fail to support high-level modeling at an adequately abstract level. Furthermore, there is no comprehensive methodology that fully covers the process of web services development and produces all of its artifacts.

The aim of this research has been to propose a model-driven methodology for developing RESTful web services in which modeling levels and model transformation rules are precisely defined. To do so, general and model-driven methodologies in the context of web engineering, especially RESTful web services, have first been investigated and evaluated through a comprehensive study; as a result, the strengths and weaknesses of these methodologies have been identified. Based on the results of this review and the challenges confronted in developing RESTful web services, the target modeling framework, and model-driven methodology have been defined. The proposed methodology has then been evaluated by applying four different categories of criteria in order to evaluate its different aspects, namely general software development criteria, model-driven criteria, model-driven web engineering criteria, RESTful web services criteria. Furthermore, the proposed methodology has been empirically validated through application related to a web development project in a real organization; this case study has demonstrated the degree of applicability of the proposed methodology and has helped identify its strengths and weaknesses.

Introduction

Main Problem: Automatically generating web services from requirements

Objective: Proposing a model-driven methodology for developing RESTful web services, in which modeling levels and model transformation rules are precisely defined.

In this project, we used various concepts to reach our goals

  • Model-Driven Development: Increasing automation and abstraction.
  • Domain-Driven Development: Providing a Rich domain model for functional requirements.
  • Event-Driven and Microservice Architectures: Increasing the performance and scalability of the system and tackling non-function requirements.

The Proposed Framework

At the heart of our methodology is a modeling framework that supports the modeling of the target web system. Based on the literature review results, we adequately defined the target modeling framework (Figure 1). The proposed framework consists of four levels of abstraction. In addition, we have developed some tools to support the framework better (Figure 2). All the code, tools, samples, and artifacts for the proposed framework are available on Github.

Figure 1 — Proposed Framework
Figure 2 — Proposed Framework Tools

Architectures

The proposed framework supports various architectural styles and architectural patterns for complex web applications. The generated system with the proposed framework is based on Onion Architecture (Figure 3).

Architectural styles supported:

  • Microservice
  • Event-Driven
  • Monolithic

Architectural patterns supported:

Figure 3 — Generating a System with Onion Architecture
Figure 4 — Generating a system with CQRS Pattern

Level 1: Computationally Independent Level

During level 1, the requirements of the system are identified and modeled. In the framework, we use two approaches to model a domain:

  1. Textual requirements: It’s used for structural modeling.
  2. Activity Storming diagrams: It’s used for behavioral modeling.

Textual Requirements: for structural modeling, we used textual requirements because every project uses them. textual requirements can be annotated by the mdd4rest-annotator developed for the proposed framework (Figure 5). mdd4rest-annotator can also generate a static ontology.

Figure 5 — MDD4REST Annotator (mainly based on the brat annotation tool and S-Case Requirements Annotation tool)

Activity Storming Diagram: for behavioral modeling, we developed a new diagram named “Activity Storming” via combining Activity Diagram elements and Event Sourcing concepts. Also, mdd4rest-activity storming comes as an Eclipse plugin or as a standalone package so as to explore, visualize, design activity stormings.

Figure 6 — Activity Storming elements
Figure 7 — Example of Activity Storming

In the proposed framework, we used ontologies for representing a domain model:

  • Static Ontology
  • Dynamic Ontology
  • Linked Ontology

mdd4rest-generator can transform activity stormings to dynamic ontology, then aggregate static ontology and dynamic ontology to a linked ontology. Finally, the mdd4rest-generator transforms the linked ontology to a YAML-based DSL.

Level 2: Platform Independent Level

The focus of level 2 is on resource-oriented concepts (REST). the mdd4rest-generator can transform YAML-based DSL to models of level 2 semi-automatically. Figure 8 demonstrates the architecture of level 2.

Level 2 contains two models:

  • Dynamic-Security Model
  • Static Model
Figure 8 — Architecture of Level 2

Level 3 and 4: Platform Specific Level

Levels 3 and 4 both are platform-specific. At level 3, the architecture of the system will be determined (Figure 9,10,11). Level 4 contains models of code generator which code generators can use to generate a system.

Figure 9 — Simple architecture
Figure 10 — CQRS architecture
Figure 11 — Inter applications architecture view

The Proposed Process

We also proposed a process for the framework. This process consists of 4 phases: Start-up, Construction, Transition, Maintenance. the process is mainly based on Process Patterns for Web Engineering.

Figure 12 — the proposed process

Evaluation & Case Study

This methodology has been evaluated from multiple facets according to four groups of criteria: general software development criteria, model-driven criteria, model-driven web engineering criteria, and RESTful web services criteria. In addition, to answer the research questions, the framework was also applied to a case study and has been empirically validated. It has been utilized throughout a web development project in a real organization; this case study has demonstrated the degree of applicability of the proposed methodology, and it has helped identify its strengths and weaknesses. The case study was a virtual gift card generator system defined by Hasin Group (LinkedIn). Figure 13 shows the generated system by the proposed framework.

Figure 13 — the generated system by the proposed framework

Conclusion

In this article, we introduced a Model-Driven Methodology for developing web services. It includes models at four levels of abstraction. we implemented transformation rules to generate models. Also, we developed some tools to support our methodology.

References

[1] L. Richardson and S. Ruby, RESTful web services. O’Reilly Media, 2008.

[2] T. Diamantopoulos, M. Roth, A. Symeonidis, and E. Klein, “Software requirements as an application domain for natural language processing,” Language Resources and Evaluation, vol. 51, no. 2, pp. 495–524, 2017.

[3] C. Zolotas, T. Diamantopoulos, K. C. Chatzidimitriou, and A. L. Symeonidis, “From requirements to source code: A Model-Driven Engineering approach for RESTful web services,” Automated Software Engineering, vol. 24, no. 4, pp. 791–838, 2017.

[4] E. Evans, Domain-driven design: Tackling complexity in the heart of software. Addison-Wesley Professional, 2004.

[5] R. T. Fielding and R. N. Taylor, Architectural styles and the design of network-based software architectures. PhD Thesis, University of California at Irvine, 2000.

[6] H. Ed-douibi, Model-driven round-trip engineering of REST APIs. PhD Thesis, Network and Information Technologies Doctoral Programme, Universitat Oberta de Catalunya (UOC), 2019.

[7] R. C. da C. Gonçalves, RESTful Web Services Development with a Model-Driven Engineering Approach. M.S. Thesis, Instituto Superior de Engenharia do Porto, 2018.

[8] S. Kapferer, A Modeling Framework for Strategic Domain-driven Design and Service Decomposition. M.S. Thesis, University of Applied Sciences of Eastern Switzerland, 2020.

[9] B. Terzić, V. Dimitrieski, S. Kordić, G. Milosavljević, and I. Luković, “Development and evaluation of MicroBuilder: A model-driven tool for the specification of REST Microservice Software Architectures,” Enterp. Information Systems, vol. 12, no. 8–9, pp. 1034–1057, 2018.

[10] R. Babanezhad, Y. M. Bibalan, and R. Ramsin, “Process patterns for web engineering,” in Proceedings of the IEEE Annual Computer Software and Applications Conference, pp. 477–486, 2010.

[11] P. Stenetorp, S. Pyysalo, G. Topić, T. Ohta, S. Ananiadou, and J. Tsujii, “BRAT: a web-based tool for NLP-assisted text annotation,” in Proceedings of the Demonstrations Session at European Chapter of the Association for Computational Linguistics, pp. 102–107, 2012.

--

--

Amir Deljouyi

I’m a student, web developer. Now on the road to be a software architect, trying to grow my skill set.