Book Image

Embracing Microservices Design

By : Ovais Mehboob Ahmed Khan, Nabil Siddiqui, Timothy Oleson
Book Image

Embracing Microservices Design

By: Ovais Mehboob Ahmed Khan, Nabil Siddiqui, Timothy Oleson

Overview of this book

Microservices have been widely adopted for designing distributed enterprise apps that are flexible, robust, and fine-grained into services that are independent of each other. There has been a paradigm shift where organizations are now either building new apps on microservices or transforming existing monolithic apps into microservices-based architecture. This book explores the importance of anti-patterns and the need to address flaws in them with alternative practices and patterns. You'll identify common mistakes caused by a lack of understanding when implementing microservices and cover topics such as organizational readiness to adopt microservices, domain-driven design, and resiliency and scalability of microservices. The book further demonstrates the anti-patterns involved in re-platforming brownfield apps and designing distributed data architecture. You’ll also focus on how to avoid communication and deployment pitfalls and understand cross-cutting concerns such as logging, monitoring, and security. Finally, you’ll explore testing pitfalls and establish a framework to address isolation, autonomy, and standardization. By the end of this book, you'll have understood critical mistakes to avoid while building microservices and the right practices to adopt early in the product life cycle to ensure the success of a microservices initiative.
Table of Contents (16 chapters)
1
Section 1: Overview of Microservices, Design, and Architecture Pitfalls
6
Section 2: Overview of Data Design Pitfalls, Communication, and Cross-Cutting Concerns
10
Section 3: Testing Pitfalls and Evaluating Microservices Architecture

Unit testing

Unit testing helps us meet the shift-left approach by moving the testing to the development phase and helps meet the automation portion as well. Developers need to embrace the use of unit testing by using methods such as test-driven development (TTD), which prescribes writing the test first based on good acceptance criteria. The TTD process has a life cycle of writing a test that fails, then writing the code that makes the test pass, and finally, refactoring the test and the code.

The unit testing life cycle

The unit testing life cycle is made up of three steps; the following figure demonstrates the process:

Figure 9.2 – Unit testing life cycle

When deploying distributed systems, having a high level of confidence in your code base is vital and also lets you worry less about introducing bugs that can have a rippling effect across microservices. Unit tests can prove to you that the code is working the way you expect it to and help...