Skip to main content

Posts

Microservice integration patterns - Binary Consulting

The following question was recently asked on the team. We have an e-commerce application comprised of an order service where orders are placed, a billing service for taking payments, and a shipping service for delivering the order. We want to introduce a notification service to send emails, such as order confirmation. The confirmation email has a template, provided by marketing, and contains information about the order such as products purchased, delivery address, and payment information. How do I get the data contained in these separate services without too much coupling? I’ve taken an Amazon order confirmation email as an example and have highlighted the content provided by each of the four services named above within the email. Aggregating data from multiple autonomous services can be approached in many different ways. Driving our architectural choice is the understanding that an autonomous service is responsible for its own data and domain logic. We want services to fulfill
Recent posts

What Are Containers? A Simple Guide to Containerization and How Docker Works

Docker is awesome. I was late to the party and didn’t get hands-on until last year. But Docker has quickly become one of the favorite tools. It enables software developers to package, ship and run their applications anywhere without having to worry about setup or dependencies. Combined with Kubernetes, it becomes even more powerful for streamling cluster deployments and management. I digress. Back to Docker. Docker is loved by software developers and its adoption rate has been remarkable. So what exactly is Docker? It’s a platform for building, testing, deploying and publishing containerized applications. I say platform because Docker is a set of tools for managing all-things related to containers. Containers are at the heart of Docker so that’s what we’re going to explore in depth next. What is a Container? Containers provide a way to install and run your applications in isolated environments on a machine. Applications running inside a container are limited to resources (C

Technical debt — leverage or liquidate?

It’s not always a case of debt = bad. Used intelligently, technical debt provides quick fixes to problems and boosts innovation. However, you’ll soon know when your tech debt’s not serving you well. Below: three signs your tech debt needs paying off. (Tech) debt: not always a bad thing Understanding tech debt — beware the buzzword Technical debt is an overused term, often used to indicate ‘bad code’ or ‘work we don’t approve of’. Towards and Understanding of Technical Debt by Kellan Elliot McCrea, 2016, sheds light on how technical debt looks in practice. Leaning on the concept that ‘all code is a liability’ McCrea pinpoints five distinct aspects of how ‘tech debt’ manifests itself. Maintenance work Features of the codebase that resist change Operability choices that resist change Code choices that suck the will to live Dependencies that resist upgrading De-demonizing technical debt Taken in isolation, none of the above are going to topple your business. In

Virtual Method in C#

A virtual method is a method that can be redefined in derived classes. A virtual method has an implementation in a base class as well as derived the class. It is used when a method's basic functionality is the same but sometimes more functionality is needed in the derived class. A virtual method is created in the base class that can be overriden in the derived class. We create a virtual method in the base class using the virtual keyword and that method is overriden in the derived class using the override keyword. When a method is declared as a virtual method in a base class then that method can be defined in a base class and it is optional for the derived class to override that method. The overriding method also provides more than one form for a method. Hence it is also an example for polymorphism. When a method is declared as a virtual method in a base class and that method has the same definition in a derived class then there is no need to override it in the derived class. B

REST Resource Identifier (URI) Naming – REST API Tutorial

In REST, primary data representation is called Resource .  Having a strong and consistent REST resource naming strategy – will definitely prove your one of the best design decisions in long term. The key abstraction of information in REST is a resource. Any information that can be named can be a resource: a document or image, a temporal service (e.g. “today’s weather in Los Angeles”), a collection of other resources, a non-virtual object (e.g. a person), and so on. In other words, any concept that might be the target of an author’s hypertext reference must fit within the definition of a resource. A resource is a conceptual mapping to a set of entities, not the entity that corresponds to the mapping at any particular point in time. Roy Fielding’s dissertation A resource can be a singleton or a collection . For example, “ customers ” is a collection resource and “ customer ” is a singleton resource (in a banking domain). We can identify “ customers ” collection resource using the

Best practices for a clean and performant Angular application

This article outlines the practices we use in our application and is related to Angular, Typescript, RxJs and @ngrx/store. We’ll also go through some general coding guidelines to help make the application cleaner. 1) trackBy When using ngFor to loop over an array in templates, use it with a trackBy function which will return an unique identifier for each item. Why? When an array changes, Angular re-renders the whole DOM tree. But if you use trackBy , Angular will know which element has changed and will only make DOM changes for that particular element. For a detailed explanation on this, please refer to this article by Netanel Basal . Before <li *ngFor="let item of items;">{{ item }}</li> After // in the template <li *ngFor="let item of items; trackBy: trackByFn">{{ item }}</li> // in the component trackByFn(index, item) { return item.id; // unique id corresponding to the item } 2) const vs let When