Underscore (_) in Scala
What do _._1 and _++_ mean in Scala? _._1 _1 is a method name. Specifically tuples have a method named _1, which returns the first element of the tuple. So _._1 < _._1 means “call the _1 method on both arguments and check whether the first is less than the second”. Example .toList.sortWith(_._1 < _._1) _._1 calls the method _1 on the wildcard parameter _, which gets the first element of a tuple.
"12 Factor App"
What is The Twelve Factor App? The Twelve Factor App a methodology for building modern, scalable, maintainable Software-as-a-Service (SaaS) apps. The Twelve Factor App is a set of principles that describes a way of making software that, when followed, enables companies to create code that can be released reliably, scaled quickly, and maintained in a consistent and predictable manner. Why Do You Need The Twelve Factor App? In the modern era, software is commonly provided as a service: so-called Web Applications or Software as a Service.
Service Discovery
What is a Service Discovery? The service discovery pattern uses a centralized server named “service registry” to maintain a global view of microservice network locations. Microservices update their location in the service registry at fixed intervals. Clients can connect to the service registry and get information about the location of the microservices. There are 2 main service discovery patterns available to implement service discovery for microservices. Client-side service discovery Server-side service discovery Why Do You Need a Service Discovery?
Service Mesh
What is a Service Mesh? A service mesh is a mechanism for managing communications between the various individual services that make up modern applications in a microservice-based system. Why Do You Need a Service Mesh? Once upon a time, programs were developed and deployed as a single application. This traditional approach, called a monolithic architecture, has worked great for simple applications, but becomes a burden as applications become complex and the codebase expands.
Abstract Factory
Also known as Kit Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Explanation Real-world example To create a kingdom we need objects with a common theme. The Elven Kingdom needs Elven King, Elven Castle, and Elven Army, whereas The Orcish Kingdom needs an Orcish King, Orcish Castle, and Orcish Army. There is a dependency between the objects in the kingdom. In plain words
Aggregator Microservices
Intent The user makes a single call to the aggregator service, and the aggregator then calls each relevant microservice. Explanation Real world example Our web marketplace needs information about products and their current inventory. It makes a call to an aggregator service which in turn calls the product information microservice and product inventory microservice returning the combined information. In plain words Aggregator Microservice collects pieces of data from various microservices and returns an aggregate for processing.
API Gateway
Intent Aggregate calls to microservices in a single location, the API Gateway. The user makes a single call to the API Gateway, and the API Gateway then calls each relevant microservice. Explanation With the Microservices pattern, a client may need data from multiple different microservices. If the client called each microservice directly, that could contribute to longer load times, since the client would have to make a network request for each microservice called.
Also known as Given/When/Then Intent Arrange/Act/Assert (AAA) is a pattern for organizing unit tests. It breaks tests down into three clear and distinct steps: Arrange: Perform the setup and initialization required for the test. Act: Take action(s) required for the test. Assert: Verify the outcome(s) of the test. Explanation This pattern has several significant benefits. It creates a clear separation between a test’s setup, operations, and results. This structure makes the code easier to read and understand.
Intent Separate the construction of a complex object from its representation so that the same construction process can create different representations. Explanation Real-world example Imagine a character generator for a role-playing game. The easiest option is to let the computer create the character for you. If you want to manually select the character details like profession, gender, hair color, etc. the character generation becomes a step-by-step process that completes when all the selections are ready.
Intent Callback is a piece of executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at some convenient time. Explanation Real world example We need to be notified after executing task has finished. We pass a callback method for the executor and wait for it to call back on us. In plain words Callback is a method passed to the executor which will be called at defined moment.
Client Session Pattern
Name Client Session pattern Intent Create stateless servers that removes the problem of clustering, as users can switch between servers seamlessly. Makes data more resilient in case of server fail-over. Works well with smaller data sizes. Explanation Real-World Example You’re looking to create a data management app allowing users to send requests to the server to modify and make changes to data stored on their devices. These requests are small in size and the data is individual to each user, negating the need for a large scale database implementation.
Collecting Parameter
Name Collecting Parameter Intent To store the collaborative result of numerous methods within a collection. Explanation Real-world example Within a large corporate building, there exists a global printer queue that is a collection of all the printing jobs that are currently pending. Various floors contain different models of printers, each having a different printing policy. We must construct a program that can continually add appropriate printing jobs to a collection, which is called the collecting parameter.