Send
Send
Send
Thesis
Submitted to
UNIVERSITY OF DAYTON
The Degree of
By
Dayton, Ohio
August 2023
DESIGNING MICROSERVICES WITH USE CASES AND UML
APPROVED BY:
1
© Copyright by
2023
2
ABSTRACT
DESIGNING MICROSERVICES WITH USE CASES AND UML
In recent years microservices architecture (MSA) has been widely adopted as an alternative
to the traditional monolithic architecture in most of the commercial applications because
of the need for the extensibility of a wide variety of services and deployability. Monolithic
software architectures include Data-Centered Architectures, Data-Flow Architectures, Call
and Return Architectures, Object-Oriented Architectures, and Layered Architectures. The
monolithic approach included where all the logic and data requirements are bundled
together. In recent years large scale software applications by Amazon, Netflix, Uber, and
other organizations have felt a need to partition the functionalities into independently
deployable units which are called microservices.
In this thesis we also explore using the essential concepts of coupling, cohesion, and top-
down decomposition that are used for monolithic architectures to microservices also. One
of the major requirements for an independently deployable microservice is embedding data
components in that microservice unit. We identify use cases with data components for any
task and define them using use case descriptions, input/output designs, activity diagram,
entity descriptions for the inputs/outputs and a system sequence diagram. The system
sequence diagram triggers the logical aspects of the system with the domain classes and
data access and view classes. The completeness of the various classes is examined using
Class Responsibility Collaboration (CRC) cards informally or through detailed sequence
diagrams. Resulting refined design class diagrams are packaged into monolithic or
microservices architecture. We illustrate and implement the microservice architecture for
a Farm Produce Procurement and Sales System.
3
DEDICATION
4
ACKNOWLEDGMENTS
Raghava Gowda for his invaluable guidance and support throughout my research journey.
His expertise and insightful feedback have been instrumental in shaping the direction of
my study. Additionally, I am grateful for his patience and encouragement, which have
motivated me to overcome challenges and strive for excellence in my work. I would like
to thank Dr. Mehdi Zargham and Dr. James Buckley for serving on my thesis committee.
Special thanks to my family and friends for their unwavering support and understanding
5
TABLE OF CONTENTS
ABSTRACT........................................................................................................................ 3
DEDICATION .................................................................................................................... 4
ACKNOWLEDGMENTS .................................................................................................. 5
CHAPTER 4 IMPLEMENTATION................................................................................. 51
4.1 Technology .............................................................................................................. 52
4.3 Environment Setup .................................................................................................. 53
6
4.4 Project Setup ........................................................................................................... 53
4.5 Implementation........................................................................................................ 55
BIBLIOGRAPHY ............................................................................................................. 66
7
LIST OF FIGURES
Figure 4 Use case description for P11 – Create Producer Account. ................................. 36
Figure 8 ER-Diagram for P11ER1 – Producer Account and Produce Details ................. 41
Figure 10 Class Diagram For P11DCD1 – Producer Account and Producer Details ....... 43
Figure 11 Detailed Sequence Diagram For P11DSD1 – Producer Account and Producer
Details ............................................................................................................................... 44
8
Figure 15 Project Structure ............................................................................................... 54
Figure 19 serializers.py for converting model data types to python native datatypes. ..... 57
9
LIST OF TABLES
Table 1 Entity Table for P11E1 – Producer Account and Produce Details ...................... 40
microservices..................................................................................................................... 49
10
LIST OF ABBREVIATIONS AND NOTATIONS
11
CHAPTER 1
INTRODUCTION
software architects and researchers are always working hard to find the most efficient
provide clients with software that is of a consistently high-quality software while also
effectively managing the team’s efforts of the team and ensuring that all members
strategies.
Software development has always been viewed as a primary area of focus for software
developers, with the primary objective being to simplify and streamline the process. As a
direct consequence of this, there is a persistent push to either enhance or establish brand-
regarded as one of the most cutting-edge developments in the field of software architecture.
group of individual services that are relatively small and loosely coupled to one another.
Each service is developed to particular business function, and each service can be
independently developed, deployed, and scaled. The goal of the microservices approach
12
However, it is not uncommon for people and businesses to adopt microservices without
fully comprehending the principles and implications of what they are doing. This is a
common problem. This phenomenon, known as "microservice envy," takes place when
and potential difficulties associated with that trend. When integrating microservices into
each of which operates as its process, is at the core of the microservices architecture. These
services are designed so that they can be deployed independently with a minimal amount
of centralized management [2], and they are based on particular business capabilities.
Developers can create a set of services that are only loosely coupled when they use an
approach known as microservices. Dedicated teams can independently develop, test, and
deploy these.
In contrast to this, the traditional approach to developing software entails the construction
A monolithic application manages not only the business logic but also the data operations
and the user interfaces. This frequently results in complex and tangled codebases, which
13
Every service in a microservices architecture runs inside its own bounded context,
determined by the business functions being used and designed using domain-driven
principles [3]. Consequently, the management of data is simplified because each service
maintains its dedicated database in which it only stores data pertinent to the achievement
of its particular goal. The ability to choose the technology stack that is best suited for each
service is one of the primary benefits of using microservices. This helps to ensure that each
service is developed in the most effective way possible for its intended purpose. In addition,
deployment of microservices can be done on demand, which allows them to overcome the
makes it possible to place more of an emphasis on rapid delivery rather than difficult
maintenance procedures.
Adopting microservices makes code management much easier, helps to keep interfaces
emphasizing speedy value delivery. This aspect of their design contributes to the disruptive
nature of the technology they represent. The approach known as microservices is highly
architectural style but are also deeply matted with a given company’s organizational
the limitations of this architecture and the fact that there are more appropriate solutions to
14
the problems of scalability and codebase management problems that can arise within an
application. The complexity that could delay performance is introduced when a single
application is divided into multiple distributed components that communicate over the web.
Increased latency and longer response times are common problems that can harm the user
work from developers and requires careful planning before it can be done.
On the other hand, the additional effort invested in microservices may not yield significant
describes this idea, highlighting the trade-off between the benefits and complexities of
Additional evidence for the concept of complexity in microservices comes from research
conducted by Nicola Dragoni [5]. It was hypothesized that smaller components would have
a fault density that was lower than larger ones; however, it was discovered that smaller
components frequently exhibit a higher fault density [6]. The low availability resulting
addition, as was discussed earlier, the transmission of information across a network result
in latency, which harms performance. The community of people who work with distributed
systems is already familiar with certain challenges, such as service discovery, load
dynamic nature of microservices, which allows scaling based on demand, the number of
15
instances of a particular service cannot be determined in advance. As a consequence of
this, the mechanisms that were mentioned need to have the capacity to manage runtime
operational point of view. Figuring out which metrics are most important and setting up
alerting systems are two of the most important things that need to be done to enable prompt
knowledge and the ability to trace system actions are required. Reporting is frequently
automated.
Many early adopters of microservices have been transparent, sharing their experiences with
adoption and documenting their change processes while also contributing solutions to
businesses such as Amazon [7], [8], Netflix [9], [10], Uber [11], [12], and others [13] for
as anticipated. This in and of itself presents a challenge because it calls for comprehensive
test coverage and frequently necessitates post-inspection of the code to guarantee its
quality. Even when designing a system to resist failures, it is essential to validate its
capacity to withstand heavy loads during peak times and prevent faults from propagating
to dependent services. Validation can be done by testing the system's ability to pass a stress
test.
16
The inherent complexity that comes with adopting the microservices architectural style is
directly tied to the challenges that have been highlighted above. Making decisions based
on accurate information is necessary to guarantee that the completed system will follow
the original proposal. Please do so to avoid subsequent problems that are difficult to rectify,
development. If you fail to do so, this can lead to subsequent problems that are difficult to
rectify. To prevent these challenges from becoming significant concerns for architects and
developers, the first step is to dismantle the monolithic architecture and replace it with a
series of smaller architectures known as microservices. During the migration process, you
will need to get past this initial obstacle, which requires a comprehensive investigation into
the system's architecture across all of its layers, including the storage of data and the
interaction between users. To ensure a seamless transition, the migration process should be
carried out in stages, with each phase concentrating on the migration of a single service.
1.1 Objective
The main objective of this thesis is to design microservice architecture for Procurement
First, we identify use cases and define them. Then, we draw input/output screens and
activity diagrams. We also derive E-R diagrams to understand the data flow within the
system better. Later, object-oriented analysis and design methods were used to identify the
components with unique functionality, and later, they were partitioned into suitable
microservices. This may be like a monolithic architecture approach, but the components
17
would be services. Finally, we develop the application with suitable tools and deploy the
1.2 Contribution
adaptable system. The modular nature of microservices allows for quick iterations
technological advancements.
incorporating user requirements from the early stages, the microservice architecture
approach allows for flexible scaling of individual services based on demand and
1.3 Significance
architecture lies in its systematic and structured approach to designing the Procurement
18
Management System. By first identifying and defining use cases, the assigned development
screens and activity diagrams helps visualize the system's behavior and user interactions,
ensuring a user-centric design and deriving E-R diagrams aids in comprehending the data
flow within the system, facilitating data modeling and database design decisions. The
object-oriented analysis and design methods assist in identifying the components with
unique functionality, which are then partitioned into suitable microservices. This approach
allows for a more precise and modular design, enhancing the system's scalability and
19
CHAPTER 2
LITERATURE REVIEW
computing, HTTP and web frameworks, cloud computing, and virtualization. These
concepts made it easier to develop, deploy, and manage microservices. The concept of
component-based software helped break down software applications into smaller, self-
contained components. This made it easier to develop microservices, which are also self-
to microservices. HTTP and web frameworks make it easier to develop and deploy
microservices, as they provide a standardized protocol for exchanging data over the
Internet. Cloud computing and virtualization provide a scalable and reliable infrastructure
for hosting microservices. Overall, combining these technologies and approaches has
complex systems.
has long been an aim. Combining these reusable components, which communicate via
documented interfaces, enables the creation of systems [14]. To overcome this issue,
component-based software became a popular concept in the late 1990s [15]. A software
package, web service, web resource, or module that contains a group of connected
20
The emergence of Service-Oriented Computing (SOC), which sought to accomplish the
paradigms. With the introduction of the web, software became more and more focused on
it, and the idea of "services" became more important. Experts agreed that the web needed
to change to enable automated interactions better, as it was initially designed for human
usage [17]. The idea of "services" was created as a result of these automated interactions,
which would include machines interacting with one another to accomplish a task. The
services were developed as individual software components specifically adapted for use on
the web.
Adopting the services concept had several benefits. First of all, load balancing and
replication made services easily scalable. Second, services could be combined to create
more complicated services since they were modular and reusable. Thirdly, once a service's
interface was developed, external entities might use it as is, simplifying development. Only
a service's inputs and outputs were important; its internal operations were no longer a
As businesses grew more dependent on software and the Internet, it became clear that
software design must be closely coordinated with the organizational business topology.
capabilities led to the creation of Service Oriented Architecture (SOA) [18], which
21
Although there is still some disagreement about whether microservices are merely a subset
of SOA, it is generally accepted that the two ideas are interconnected. Although they are
not the same, microservices can be considered a means to implement SOA [19].
The Web 2.0 evolution has provided a community-focused strategy that prioritizes user-
service interactions and offers more dynamic functionality. Because of this transition, the
individual components that go into making up the web are now more complicated. In the
beginning, web servers used a program called CGI to provide static data in response to
components to provide dynamic content. This dynamic behavior was made feasible by
integrating executable code with the code for the HTML interface. This allowed for the
These frameworks also offered developers a clearer distinction between view and
application logic. As a result, the MVC paradigm soon gained popularity and is now
commonly utilized with frameworks like Rails, AngularJS, and React. Interprocess
regarded as a standard, the SOAP protocol enabled IPC over HTTP. It soon became clear
that this new paradigm's primary goal was not simply to provide content to browsers.
Because of this, text-based serialization formats like XML and JSON were popular among
services that performed activities or communicated data with other services. Developers
migrated to lighter and more adaptable protocols like REST when the SOAP protocol and
22
WS-* standards grew more complicated and intricately tied to implementations in
Over the course of development's history, there have been numerous important shifts in the
kinds of resources that are readily available to developers. New models for Cloud
Computing have arisen after the initial emergence of Grid Computing. According to
customer demand, these models offered resources as general utilities that users could rent
and release via the Internet. This shift was largely driven by the web's popularity, providing
Cloud services altered the traditional worries of businesses over physical resources by
making an "infinite" pool of resources available with no upfront expenses, low operational
costs, and on-demand provisioning. Monitoring is still vital, but careful planning and
in accordance with those calculations, are no longer required. Resource availability was
made a provider's duty. As a result, businesses might shift their attention to creating better
The widespread availability of important cloud service providers such as Amazon's AWS,
Microsoft's Azure, and Google's Cloud Platform, amongst others, brought a unique
resources became more readily accessible on demand, architects started to wonder why
entire applications were scaled up, raising overall costs, rather than judiciously scaling only
23
the components that needed more capacity for the workload. This way of thinking gave
rise to the idea of microservices, which are segments of software that may be independently
deployed.
Recent developments in cloud computing have brought about capabilities that work well
with applications built on microservices. For example, access to particular resources can
be limited, enabling services to cater to just designated entities while going unnoticed by
modify the number of active instances during periods of high load. The cloud infrastructure
also makes it easier to schedule operations to run at particular times or respond to specified
events without continuously using up needless resources and to maintain updated data
replicas automatically.
The widespread adoption of these technologies does, however, raise the prospect of
confined contracts with specific vendors. Each vendor creates their proprietary technology
due to the need for uniformity across cloud resource providers. Consequently, making a
long-term commitment to a specific vendor and expanding one's technological stack based
on that vendor's offerings can result in difficulties if the decision is made to switch
makes the question of vendor portability a delicate and complicated one. Before Docker
attained its popularity, Amazon had its proprietary virtualization method called Amazon
Machine Image (AMI), which serves as an illustration. AMI is exclusive to the AWS
platform even though it shares a basic similarity with Docker images. As a result, an
24
organization would need to adopt a separate virtualization technology if it wanted to switch
2.3 Virtualization
The use of virtualization technologies and techniques, which aim to supply computing
resources as a utility, has made it possible for new cloud computing models to develop.
This was made possible by the exploitation of these technologies and techniques. However,
of the complexity of their use and the efficiency with which they utilize resources.
Consequently, using these tools to host small components such as microservices was not a
realistic choice because the total process did not produce significant benefits.
outstanding performance. They offer this advantage because containers are a lightweight
and flexible alternative. Docker has become an industry standard because it enables
developers to easily execute programs within containers, alongside other apps on the same
host, in a secure manner. This makes Docker an attractive option for businesses.
As a result of this new information, software engineers are reevaluating the processes they
use to create software and thinking more carefully about the distinctions between deploying
possible to run a streamlined program inside of a container alongside other apps while
25
maintaining a high level of security and making it easier to perform efficient administration
tasks.
2.4 Microservices
Having established the origins and driving factors behind microservices, we can now
explore their advantages and disadvantages more comprehensively. This will enable us to
Several authors have provided their own definitions of microservices, each with their
approach, emphasizing creating new systems from scratch. Others have focused on the
We will also look into the various definitions of microservices provided by other
is built as a suite of small services, each running in its process and communicating with
break down monolithic applications into smaller, more manageable services that can be
26
According to Hilbrich [20], the greenfield approach to microservices architecture involves
the development of new systems using microservices-based architecture from the ground
up. This approach is often seen as the ideal way to implement microservices, allowing for
greater flexibility and scalability. However, it also presents several challenges, such as the
need for a highly skilled development team and the potential for increased complexity.
On the other hand, the brownfield approach involves migrating existing monolithic
and infrastructure. However, it also presents several challenges, such as the need for careful
of the various perspectives and insights put forth by different authors, allowing for a
defining use cases, activity diagrams, and input and output screens to encompass the entire
27
application. Subsequently, we will utilize Entity-Relationship (ER) diagrams and employ
an object-oriented methodology to break down the application's use cases into individual
microservices based on their distinct functionalities. This approach will ensure a systematic
28
CHAPTER 3
METHODOLOGY
This chapter shows how we derive monolithic and microservice architectures using use
cases and UML. First, we start by considering the work breakdown structure, which shows
the decomposition of the system into smaller components. This decomposition allows us
to identify the different use cases and their relationships within the system.
everything from Managing projects to delivering the system. WBS is the key tool for
Analysis" aspect of the WBS. The traditional approach for decomposing any task is guided
by function, time, and event (external, internal, or state events). There is no guarantee that
Work Breakdown Structure (WBS): The WBS, as exemplified by [21] for any project, is
29
The same WBS can be shown in an indented form as follows:
1. Manage Project
2. Do System Analysis
3. Develop Software
4. Verify System
5. Validate System
6. Perform CM
8. Deliver System
For naming WBS components, we will also use verbs that would be carried to the lower
levels of use cases. Some of the components of the WBS structure and corresponding
microservices for the Procurement Management System and their breakdown to some of
the use cases P11, P12, etc., are shown in following Figure 2.
The tasks listed under the WBS are from the organization point of view. Generally, use
cases are represented from the actor’s point of view. One has to be careful in naming WBS
tasks and use cases from these perspectives otherwise it may lead to some confusion for
example for produce the producer needs to get advance payment that can be a use case such
as “Get Payment for Produce” in producer point of view. The same use case could be
represented as “Pay for Produce” in admin point of view. In WBS to avoid confusion we
should use an admin point of view. In the below WBS from Figure 2, we have used admin’s
point of view.
30
Figure 2 Work Breakdown Structure for PMS application
Once we have a clear understanding of the use cases, we can create UML diagrams
depicting the interactions and dependencies between these components. These diagrams
serve as a blueprint for both monolithic and microservice architectures, guiding the
3.1 Background
The Farm Produce Procurement and Sales System (PMS) is mainly for Plantations with
the goals of enhancing the efficiency of the crop purchasing and selling process and
improving the overall effectiveness of the activities linked to Plantation. PMS is a service-
based platform that enables users to locate professionals that offer services at plantations,
as well as professionals who provide services such as product procurement and product
sales. This platform offers the chance for freelance professionals to become microservice
entrepreneurs for the PMS platform by selling their services as products and the agricultural
goods they have bought. The proposed PMS can easily be defined as an integrated approach
Many independent e-commerce applications provide services for procuring and selling
farm produce in the market, which differs from the proposed PMS application. PMS can
be used for complete plantation needs such as procurement, sales, workforce management,
and so on.
The Word use case has been used in multiple ways by software development personnel,
assigning various meanings such as an example, function, or instance of system use. One
32
of the early books on use cases [22] with some specific notations for describing use cases.
In our approach, we ensure manual processes are not represented as use cases, and each
use case has at least appropriate inputs/outputs in forms, screens, or report formats. We
derived entities for these inputs and made them a part of the use case.
The term "Procurement System" refers to an e-commerce system that was taken into
account as part of our modeling. This system buys goods directly from producers, such as
farm produce and other artifacts, and then sells them to wholesalers. The top-down
These can be partitioned to use cases. The following naming convention has been used to
understand better and relate it with the use case. The naming convention used in this
document is as follows:
• Entities for P11: P11E1, P11E2, etc. (Normalize the entities with the repeating
groups)
The first two use cases related to the Producer, which consist of registering the Producer,
providing produce availability are shown in Figure 3. Each use case will consist of the
following:
c) Activity diagram.
e) ER-diagram.
This use case diagram can be used to identify which actor is associated with the selected
use cases. Here we have considered the common use cases related to the Producer. The
three selected use cases below are the main functionalities the Producer can perform.
34
Figure 3 Use case diagram for P1 - Get Producer Data.
A use case description is a textual representation of the steps and interactions involved in
a particular use case. It explains how the system will behave when the user or actor
performs a specific action. The use case description for creating a producer account would
include entering personal information and providing produce information. It also specifies
the information related to the actors involved in the use case, such as the Producer and
In the use case description shown below in Figure 4, the activities flow has been
incorporated to easily identify what data needs to be exchanged while performing this
functionality. Additionally, the use case description may outline any necessary validations
35
Figure 4 Use case description for P11 – Create Producer Account.
b) Input/Output Screens:
The input screens for creating a producer account typically include fields for entering
personal information such as name, address, contact details, and possibly identification
documents. The user would also be prompted to provide specific product information, such
36
Figure 5 Input Screen for P11I1 – Register Producer Account
The output screens would then confirm the successful creation of the account and provide
the Producer with their unique login credentials. It may also display any additional steps
or requirements that must be completed before the account can be fully activated. This
provides the Producer with a clear understanding of the necessary information and steps to
37
Figure 6 Output Screen for P11I2 - Producer Information.
c) Activity diagram:
The activity diagram would illustrate the actions involved in creating a producer account.
It would show the steps of inputting personal information, selecting the type of crops, and
confirming the successful creation of the account. Additionally, it may depict any
additional steps or requirements that need to be completed before the account can be fully
representation helps to simplify and streamline the account creation process for producers.
38
Figure 7 Activity Diagram for P11A1 – Producer Information
Mapping entities using the Input/output Diagram (I/O Diagram) is a visual representation
that shows the flow of data between different entities within a system. It helps to identify
the inputs and outputs of each entity, allowing for a better understanding of how
producers can easily identify the necessary inputs for their account creation process and
ensure that all required information is provided. Based on the Input/output screen, the
derived entity table is shown below in Table 1. In this entity table, the initial dependencies
are identified, and we perform normalization to eliminate any redundant data and improve
the system's overall efficiency. This process involves breaking down the entity table into
smaller, more manageable tables, each representing a distinct entity with its attributes.
39
Table 1 Entity Table for P11E1 – Producer Account and Produce Details
3rd NF:
e) ER-diagram:
Using the entity table as a starting point, the normalization process involves identifying the
functional dependencies between attributes and determining the appropriate table structure.
This ensures that each table is focused on a specific entity and its related attributes,
promoting data integrity, and reducing update anomalies. Furthermore, normalization helps
and easier database system maintenance. Later ER diagram is created to represent the
relationships between the entities in the database visually. This diagram provides a clear
overview of how different tables are connected and allows for easier understanding and
analysis of the database structure. Additionally, the ER diagram serves as a blueprint for
40
designing and implementing the database system, making it an essential tool in database
development.
41
f) System Sequence Diagram:
A system sequence diagram (SSD) is another important tool to illustrate the flow of
interactions between the system and external actors, helping to identify the necessary inputs
and outputs for each system function. This is the starting point for object-oriented analysis
and design. From this point onwards, domain classes are identified for each use case. The
domain class attributes and methods are further verified with an informal approach using
42
Figure 10 Class Diagram For P11DCD1 – Producer Account and Producer Details
Detailed Sequence Diagram shows the specific sequence of events and interactions
between different objects or components in a system. We can be used to visualize the flow
of control and data between various components, helping us identify potential bottlenecks
or areas for optimization. It can also be used as a communication tool between developers
43
Figure 11 Detailed Sequence Diagram For P11DSD1 – Producer Account and Producer Details
We can derive the package structure and class diagrams from the use case realization,
which provides a high-level overview of the system's architecture and the relationships
between different modules. These diagrams help us identify the key components and their
Additionally, they can serve as documentation for future maintenance and enhancements,
making it easier for new developers to understand the system's structure and make changes
if needed. This package diagram is a project in MVT architecture, which stands for Model-
View-Template. It illustrates how the system's components are organized into three main
layers: the model layer, responsible for managing data and business logic; the view layer,
responsible for presenting information to users; and the template layer, responsible for
generating dynamic web pages. This can serve as an individual service or as part of a larger
system, allowing developers to easily integrate and customize the functionality based on
44
their specific requirements. This can be considered a microservice, as other use cases have
no functional dependencies. The only common requirement is that the microservice must
The package diagram derived from the use case realization of the Producer provides a
visual representation of the different components in the MVT (Model View Template)
45
pattern. It helps to illustrate how the subsystem is organized and how the different modules
encapsulates a specific functionality within the larger system. It allows for independent
deployment and scalability, making it easier to maintain and update the producer account
subsystem without affecting other parts of the system. Providing a common database for
this producer subsystem, the package diagram ensures that data is shared and consistent
across all modules. Additionally, it allows for efficient communication between different
This producer microservice is independent and can be deployed and scaled separately from
producer profiles, such as creating and updating producer information, providing produce
46
information such as available produce name, type, quantity, price, available date, and
Like the Producer, the order microservice manages and processes vendor orders. It
In the below architecture diagram from Figure 14, Each microservice is derived from the
use case realization as followed in Chapter 3.4 for the producer account. Containerizing
each package with an individual database, as shown below, can act as an independent
service. There is a need for a common API gateway to handle the communication between
these microservices and external clients. This API gateway will provide a unified interface
When users access the system, they will interact with the API gateway, which will route
their requests to the appropriate microservice. This allows for a simplified and streamlined
user experience, as they only need to interact with one interface instead of multiple
individual services. The API gateway can also handle authentication and authorization,
ensuring that only authorized users can access the system's functionalities.
47
Figure 14 Overall Architecture Diagram for PMS Application
Table 3 Comparison of general approach and our approach for designing microservices.
Design Various methodologies can be used Using use cases and UML
etc.
diagrams.
requirements.
49
Design Artifacts Design artifacts may vary based on UML diagrams such as use
diagram, sequence
application.
Maintenance and May require additional effort and Facilitates maintenance and
information.
50
CHAPTER 4
IMPLEMENTATION
As described before, there are several tools and techniques that support application
development using microservice architecture. These tools include Python Django, Java
Spring Boot, Node.js Express, etc. These frameworks provide developers with the tools
and libraries to build and deploy microservices efficiently. Additionally, these tools offer
scalability, fault tolerance, and easy integration with other services, making them ideal for
also available, such as Kubernetes and Docker, which help manage and orchestrate
microservices at scale. These tools enable developers to easily deploy, scale, and manage
resource utilization.
There are a lot of concerns during the tool selection that developers need to consider. One
of the main concerns is the compatibility and integration of these tools with existing
infrastructure and technologies. It is important to ensure that the selected tools can
seamlessly work with other application stack components. Developers should also evaluate
the learning curve and support available for these tools, as well as their community
adoption and active development. By carefully considering these concerns, developers can
make informed decisions and choose the most suitable tools for their microservices
architecture. There should also be careful consideration of some aspects, such as the
increased complexity of debugging and monitoring multiple services and the potential for
challenging. However, with proper planning and implementation of best practices, these
architecture fully.
scalability of the selected tools. It is crucial to choose tools that can efficiently handle high
volumes of data and requests and support various communication protocols such as HTTP,
TCP, or messaging queues. Additionally, we should consider the security features offered
by these tools to ensure the confidentiality and integrity of data exchanged between
microservices.
handling strategies. Well-designed APIs can greatly enhance the usability and
4.1 Technology
For implementing the Procurement Management System, we have opted Python Django
framework as it is suitable for Microservice architecture and provides a robust and scalable
management, and template engine, make it easier to develop and maintain the system. We
52
use PostgreSQL as our database management system, offering advanced features and
strong data integrity. This combination of Python Django and PostgreSQL ensures efficient
data storage and retrieval, enhancing the overall performance of the Procurement
Management System.
using the Python Django framework. Start by installing Python, which can be downloaded
from the official Python website. Once Python is installed, installing the Django framework
Django" in the terminal or command prompt using the package installer (pip command).
Additionally, using a virtual environment to isolate the project's dependencies and avoid
conflicts with other Python projects is recommended. This will ensure that all the necessary
For PostgreSQL, you will need to download and install PostgreSQL on your machine. Once
installed, you can configure Django to use PostgreSQL as the database backend by
updating the settings.py file in your Django project. This will allow you to take advantage
As we are developing applications from scratch, we will need to create a new Django
53
terminal. This will generate your project's necessary files and folders, as shown in Figure
15. You can also create a virtual environment to isolate your project's dependencies and
Once the project is created and the necessary files and folders are generated, you can
configure the database settings in the project's settings.py file, as shown in Figure 16. This
includes specifying PostgreSQL as the database engine and providing the database name,
PostgreSQL's advanced features, such as support for JSON data types and full-text search
capabilities, you can enhance the functionality and performance of your application.
54
Figure 16 Database Information in environment file
4.5 Implementation
Considering the methodology from Chapter 3, we have to create three microservices for
our application: user, product, and order management. Here we have created 3 Django apps
for each microservice. Each app will have its models, views, and serializers to handle the
specific functionality of that microservice. Separating the application into these smaller
55
The database schema for each microservice has been derived during the design phase,
ensuring each service has tables and relationships that align with its specific functionality.
Attributes for each database are derived based on the functionality of the service, as
mentioned in the entity table, and those attributes will be used in model classes to represent
the data in the microservice, as shown in Figure 18. This ensures that each microservice
serializers.py as shown in Figure 19, should be created in the Django project, this file helps
us to convert the native datatypes used in the models.py file to python datatypes. By
converting the native datatypes to python datatypes that can be easily rendered into any
content types such as XML, JSON, or any other. These content types can be used with
GET, POST, PUT, PATCH, DELETE, HEAD methods of API functionality. After creating
56
serializers.py we must create an API view in the views.py file as shown in Figure 20. Now,
url.py as shown in Figure 21 should be created to define the routes and map them to the
corresponding functions or views. This file will handle incoming requests and direct them
these endpoints and their functionality to facilitate integration with other services or clients.
Additionally, testing should be conducted to ensure that the API endpoints are functioning
Figure 19 serializers.py for converting model data types to python native datatypes.
Input for the API endpoints should include the parameters and data required for each
endpoint. This information can be provided through query parameters, request headers, or
57
consider authentication and authorization mechanisms to secure the API endpoints and
restrict access to authorized users or clients. We can test the created API using tools like
Postman or we can also test it using CURL, Python terminal, etc. Here to test the API
Postman tool is used as shown in Figure 21. Django admin panel can be used to manage
and monitor the API endpoints, as shown in Figure 22, allowing administrators to perform
tasks such as creating, updating, and deleting data. Additionally, logging and error handling
should be implemented to track and handle any issues that may arise during API endpoint
usage.\
58
Figure 22 Django admin panel
After creating the Model, view, and API endpoints, we must create templates for rendering
the data in a user-friendly format. These templates can be customized to match the design
and branding of the application, providing a seamless user experience. Additionally, client-
side validation can be implemented to ensure that any data entered by users through the
templates is valid and meets the required criteria. This will help prevent any potential errors
or inconsistencies in the submitted data. These templates are placed within the front-end
framework of the application, allowing for easy integration and dynamic rendering of the
data. By utilizing these templates, developers can save time and effort in designing and
formatting the data presentation and ensure a consistent and visually appealing user
interface.
Moreover, regular updates and improvements to these templates can be made without
affecting the underlying functionality of the application, providing flexibility for future
enhancements. The outcome after developing the user interface is shown in Figure 23 and
Figure 24. This application can be viewed and tested in real-time, allowing developers to
make any necessary adjustments or modifications before deployment. This allows for a
59
seamless and efficient development process, resulting in a polished and user-friendly
60
CHAPTER 5
As discussed in the earlier chapters, various methods, and approaches such as domain-
many others can be used to design a microservice architecture. Each of these approaches
has its own advantages and considerations, focusing on different aspects of microservice
design. Through the analysis of these approaches and methodologies, it is evident that there
is no universal solution that can be applied to all cases when it comes to designing
In the literature review, we have discussed about few approaches that are similar to the
from the paper titled "GreenMicro: Identifying Microservices from Use Cases in
Greenfield Development" [23]. This paper has provided an overview of a methodology that
utilizes use cases for identifying microservices in greenfield development. While the paper
offers valuable insights into the general approach for designing microservices using unique
functionality of the use cases, it does not explore into the specific details of the
methodology.
Similarly, there are other papers such as [24] that discuss methodologies using functional
decomposition UML for designing microservices. This approach involves the 4SRS (Four
Step Rule Set) method consists of component creation, component elimination, component
61
packaging, and component association. However, the method described in this paper
architecture.
thesis specifically focuses on a use case related to PMS application, providing a practical
The proposed methodology in thesis is described in thorough and detailed manner using
use cases, input/output screen, forms, or report, activity diagram, system sequence diagram,
detailed sequence diagram, domain class diagram, ER-diagram, and package diagram. This
approach starts by considering the work breakdown structure which shows decomposition
of the system into smaller components. This decomposition allows us to identify the
different use cases and their relationships within the system. By deriving/defining use cases
from WBS it is ensured that each use case consists of appropriate input/output screens,
form, or report. This leads to an appropriate data entity incorporated with each use case.
For each use case we also the design process that involves deriving design classes through
the analysis of system sequence diagrams and packaging these classes into a three-tier
Furthermore, the thorough examination of all packages for their suitability for
microservices ensures that the resulting system aligns with the fundamental principles of
62
microservice design. This includes considerations such as loose coupling, service
autonomy, and scalability. A similar approach can also be used for designing monolithic
This approach not only ensures the successful implementation of the microservices but also
enhances the overall understanding and documentation of the system. It enables effective
Python Django has been partially carried. The development process involved translating
the designed microservice architecture, which incorporated use cases, domain classes, and
system sequence diagrams, into functional code by using Django framework. The
Django's robust features and capabilities, such as its ORM (Object-Relational Mapping)
and built-in authentication system, have greatly facilitated the development process. By
implementing the microservices using Python Django, the system has benefited from the
Throughout the implementation, careful attention was given to adhering to the principles
of microservice design, such as loose coupling and service autonomy. Each microservice
63
In future work, there are several areas that can be explored to enhance the derived
microservice architecture and extend its applicability to other domains. Firstly, deriving
packages for other use cases of PMS application can help to identify common patterns and
functionalities that can be reused across different microservices. This would promote code
appropriate programming languages, frameworks, and tools to build and deploy the
microservices. Detailed research should be done on the important aspects such as security
measures, data storage and retrieval, and communication protocols to ensure the robustness
technologies like Docker and orchestration frameworks like Kubernetes could facilitate the
would enable seamless scaling and handling of high loads, ensuring the system's
64
comparative studies with alternative methodologies, such as domain-driven design (DDD),
or API-first approach, would provide insights into the strengths and weaknesses of each
approach and their applicability to different contexts. Comparative evaluations could focus
Additionally, gathering feedback and insights from other practitioners who have
collecting data on their experiences, challenges, and lessons learned would further enrich
65
BIBLIOGRAPHY
[1] Lewis, J., & Fowler, M. (2014, March 25). Microservices. martinfowler.com.
https://martinfowler.com/articles/microservices.html
[2] Jamshidi, P., Pahl, C., Mendonça, N. C., Lewis, J., & Tilkov, S. (2018). Microservices:
The journey so far and challenges ahead. IEEE Software, 35(3), 24-35.
https://martinfowler.com/bliki/BoundedContext.html
[4] Carneiro Jr, C., Schmelmer, T., Carneiro, C., & Schmelmer, T. (2016). Microservices:
The what and the why. Microservices From Day One: Build robust and scalable software
[5] Dragoni, N., Giallorenzo, S., Lafuente, A. L., Mazzara, M., Montesi, F., Mustafin, R.,
& Safina, L. (2017). Microservices: yesterday, today, and tomorrow. Present and ulterior
[6] Yin, K., & Du, Q. (2021). On representing resilience requirements of microservice
[7] Villamizar, M., Garcés, O., Castro, H., Verano, M., Salamanca, L., Casallas, R., & Gil,
S. (2015, September). Evaluating the monolithic and the microservice architecture pattern
66
to deploy web applications in the cloud. In 2015 10th Computing Colombian Conference
[8] Montesi, F., & Weber, J. (2016). Circuit breakers, discovery, and API gateways in
[9] Tonse, S. (2018). Scalable microservices at Netflix. challenges and tools of the trade.
[10] Vučković, J. (2020). You are not netflix. Microservices: Science and Engineering,
333-346.
[13] Aksakalli, I. K., Celik, T., Can, A. B., & Tekinerdogan, B. (2021). Systematic
Access, 9, 29505-29529.
[14] Papazoglou, M. P., & Van Den Heuvel, W. J. (2006). Service-oriented design and
2(4), 412-442.
[15] Hasselbring, W. (2018). Software architecture: Past, present, future. The Essence of
[17] Wei, Y., & Blake, M. B. (2010). Service-oriented computing and cloud computing:
[18] Valipour, M. H., AmirZafari, B., Maleki, K. N., & Daneshpour, N. (2009, August). A
brief survey of software architecture concepts and service oriented architecture. In 2009
2nd IEEE International Conference on Computer Science and Information Technology (pp.
34-38). IEEE.
[19] Kwan, A., Jacobsen, H. A., Chan, A., & Samoojh, S. (2016, October). Microservices
in the modern software world. In Proceedings of the 26th Annual International Conference
[21] Fairley, R. E. (2011). Managing and leading software projects. John Wiley & Sons.
[23] Bajaj, D., Goel, A., & Gupta, S. C. (2022). GreenMicro: Identifying Microservices
68
[24] Santos, N., Salgado, C. E., Morais, F., Melo, M., Silva, S., Martins, R., ... & Pereira,
69