Microservices, Tech

Working with Micro-services, one year later. Part: 1

What is the blog about?

It’s about my experiences on a commercial project which uses micro-services*. I hope to cover some of the challenges faced, the approaches we took and my learnings from them.

Ok, What are micro-services again?

Sam Newman defines micro-services as

Small, autonomous services that work together.

On similar lines, I think of micro-services as an extension of the Single-Responsibility Principle, where in a service does only one thing but one thing well.

Sounds interesting, how was this used in your project?

Continue reading

Advertisements
Standard
Code Smells

Comments == Code Smells ?

In this post, I am doing something different. Above is a link to a great article on ‘Can Comments become Code Smells ?’ by Neal Ford. I would like to know your opinion on it and have a good discussion on the that. To start off, here are my views on the topic.

Continue reading

Link
Code Smell of the Week, Design Patterns

Code Smell of the Week : Broken Encapsulation

Lets take a scenario of a customer placing an order on an ecommerce website. The order may comprise of several products. This order once placed cannot be changed but it will need to be displayed to the customer

public class Order
{
 private List<Product> products;
 //other variables, methods and constructors

 public List getProducts()
 {
  return products;
 }

 public void setProducts(
    List<Products> products)
 {
  this.products=products;
 }
}
//sample usage of Order
displayOrders(orders.getProducts());

However comparing the requirement to the code it is evident that something is wrong.

Continue reading

Standard
Code Smell of the Week, Design Patterns

Code Smell of the Week : Magic Numbers

if(order.getStatus() != 1)
{
 ordersList.add(order);
}
displayOrders(ordersList);

First look at this code tells you that an order with a particular status is not displayed. But what is that particular status ? When is it changed ? Who the hell wrote this ? These are the frustrating questions that pop-up in the programmers head. What follows is a quest to find the creator of the code by navigating the Maze (a.k.a. The Code Repository). The creator may also have ‘moved on’ which leads to further pain.

Continue reading

Standard