Need help with microservices?

These days I’m focussed on microservices.

I provide consulting services and training classes that help you get started with microservices.

I am the founder of Eventuate, Inc, a startup that is building a microservices application platform.

Contact me if you want to learn more or need help with developing microservice-based applications.

Here is some of my latest articles and presentations:

Posted in microservices | Tagged | Leave a comment

Don’t forget about value objects!

The other day I came across some code that looks something like this (class names changed to hide and the code simplified to protect the privacy of the developer 🙂 ):

public class Person {

  private String name;
  private String phoneNumber;
  ...
}
public class PhoneNumberUtil {

  public static String areaCode(String phoneNumber) {
    return phoneNumber.substring(0, 3);
  }
}

This code suffers from the code smell known as Primitive Obsession. Primitive obsession occurs when a primitive type is used to represent a domain concept. In this example, names and phone numbers, which are  important domain concepts, are represented strings. Whats more, the areaCode() method is implemented as a static method in a separate class, which is not particularly object-oriented.

While the code works, too much primitive obsession will seriously impact maintainability. There is no proper type checking. You could, for example, pass the phone number instead of a name. Another problem is that behavior, such as the areaCode() method, is no longer associated with the state, which results in procedural-style code.

The solution is to implement the name and phone number concepts with Value Objects. A value object, which is an idea from Domain-Driven Design, is a class that does not have an identity. Instead, it is simply a collection of values. Two value objects are equal and can be used interchangeably when their corresponding values are equal. Using value objects makes domain concepts explicit. It also provides a place to define methods for operating on those concepts.

Here is the code after applying the Replace Data Value with Object refactoring:

public class Person {

  private Name name;
  private PhoneNumber phoneNumber;
  ...
}
public class PhoneNumber {

 private String pn;

 public String getAreaCode() {
    return pn.substring(0, 3);
 }

 public boolean equals(Object o) { ... }

 public int hashCode() { ... }

...
}

In this new and improved code, the phone number concept is explicitly represented by a PhoneNumber value object class. Not only do we now have type checking but the area code behavior is now where it belongs: a getAreaCode() method in the PhoneNumber class.

Here is a presentation from 8 years ago that talks about eliminating code smells 🙂 .

 

Posted in coding | Tagged , , , | 1 Comment

Oracle Code NYC and Reddit AMA: No such thing as a microservice!

Next Tuesday at Oracle Code NYC, I’ll be giving a keynote There is No Such Thing as a Microservice! This talk will clarify the definition of the term Microservice Architecture, describe why it is not a silver bullet and outline the issues you must address in order to be successful.

I’ll also describe why some questions that I sometimes get asked during consulting engagements such as “Is this a microservice?” or “Can we use a microservice to do X?” are not always the most useful questions to ask.

Later on Tuesday at 1pm ET, I’ll be doing a Reddit AMA.

Posted in microservices | Tagged , | Leave a comment

The human side of adopting the microservice architecture

Adopting the Microservice Architecture changes your architecture, your organization and your development processes. Ultimately, however, it changes the working environment of people, who are fundamentally emotional. Their emotions, if ignored, can make the adoption of microservices a bumpy ride.

The best selling book Managing Transitions by William and Susan Bridges introduces the concept of a transition, which is the process of how people respond emotionally to a change. It describes a three stage Transition Model:

  1. Ending, Losing, and Letting Go – the period of emotional upheaval and resistance when people are presented with a change that forces them out of their comfort zone. They often mourn the loss of the old way of doing things. For example, when people reorganize into cross-functional teams they miss their former team-mates. Similarly, a data modeling group, which owns the global data model, will be threatened by the idea of each service having its own data model.
  2. The Neutral Zone – the intermediate stage between the old and new ways of doing things where people are often confused. They are, often, struggling to learn the new way of doing things.
  3. The New Beginning – the final stage where people have enthusiastically embraced the new way of doing things and are starting to experience the benefits.

The book describes how best to manage each stage of the transition and increase the likelihood of successfully implementing the change. In order to successfully adopt microservices you must take into account the transition model and consider people’s emotions.

Posted in microservices | Tagged , , , | Leave a comment

Navigating the microservice architecture pattern language – part 1

The microservice architecture pattern language consists of numerous groups of patterns. The value of a pattern language exceeds the sum of it’s individual patterns because it defines  these relationships between the patterns:

  • Predecessor – a predecessor pattern is a pattern that motivates the need for this pattern. For example, the Microservice Architecture pattern is the predecessor to the rest of the patterns in the pattern language except the monolithic architecture pattern.
  • Successor – a pattern that solves an issue that is introduced by this pattern.
    For example, if you apply the Microservice Architecture pattern you must then apply numerous successor patterns including service discovery patterns and the Circuit Breaker pattern.
  • Alternative – a pattern that provides an alternative solution to this pattern. For example, the Monolithic Architecture pattern and the Microservice Architecture pattern are alternative ways of architecting an application. You pick one or the other.

These relationships provide valuable guidance when using a pattern language. Applying a pattern creates issues that you must then address by applying successor patterns. The selection of patterns continuously recursively until you reach patterns with no successor. If two or more patterns are alternatives then you must typically pick just one. In many ways, this is similar to traversing a graph.

Let’s look at how you can apply the microservice architecture pattern language to architect your application. In this post we will look at 3 critical decisions you must make. In later posts, we will look at other important, albeit not quite as critical patterns.

Decision #1: Monolithic architecture or microservice architecture?

The first decision you must make is whether to use a Monolithic architecture pattern or the Microservice architecture pattern. If you pick the Microservice architecture pattern you must choose numerous other patterns to deal with the consequences of your decision.

patternsrelatedtomicroservices

As you can see, there are lots of other patterns that you must apply. Lets look at a couple of choices you must make.

Decision #2: How to decompose an application into services?

If you have decided to use the microservice architecture you must define your services. There are two main options,

This patterns yield equivalent results: a set of services organized around business concepts rather than technical concepts.

Decision #3: how to maintain data consistency and perform queries?

A key feature of the microservice is the Database per Service pattern. It’s alternative, the Shared Database pattern is essentially an anti-pattern and best avoided. The Database per service pattern dramatically changes how you maintain data consistency and perform queries. You will need to use one of Event-driven architecture patterns such as Transaction Log tailing or Event Sourcing to maintain data consistency. You will often need to implement queries using the Command Query Responsibility Segregation pattern.

Summary

That is it for now. In later posts, we will continue to navigate through the pattern language and describe other important decisions that you must make when using the microservice architecture.

 

Posted in microservices | Tagged , , , , | 1 Comment

Microservices training at Healthesystems in Tampa, FL

Earlier this year, I taught three microservices training classes at Healthesystems. They are a Tampa, FL based company that is migrating their large, complex monolithic application to a microservices architecture.  They have invested heavily in bringing outside expertise to help with the modernization of their application and my training classes were part of that.

At SpringOne Platform, I chatted with Sam Alexander, the Enterprise Architect at Healthesystems, and Mark Sinclair, a solutions architect, about how the developers at Healthesystems benefited from the training.

I really enjoyed my time at Healthesystems. They are smart people embarking on an exciting project. If you live in the Tampa area please take a look at their open positions.

 

Posted in microservices, training | Tagged , , | Leave a comment

Microservices training and good food in Lisle, IL

Last week, I spent 4 days in Lisle, IL teaching a condensed version of my hands on 5 day microservices class. You are probably wondering where and what is Lisle, IL? That was my reaction when the client told me the training location. Lisle is a village west of Chicago with a surprisingly large number of corporate offices.

As you would imagine, the days were teaching and most of the evenings were spent working as well. However, I  was able to find time to have some unexpectedly good food. Twice, I had great dinners in the Hilton Hotel’s restaurant. Another night I had some excellent Korean BBQ pork and sushi at Tanaka Sushi. On the last night I had some delicious German food – Liver Dumpling Soup and Schnitzel at the Bavarian Lodge:

And, on the way home I had my usual Cochinita Pibil Torta with Habanero Salsa at Rick Bayless’s Tortas Frontera restaurant next to gate B11.

Overall, it was a good trip. The class went well: microservices were developed and deployed on Docker. And, I ate some great food.

 

Posted in food, microservices, training, travel | Tagged , , , , | Leave a comment

There are no silver bullets

Earlier this year, I wrote a blog post for O’Reilly describing my motivations for creating the microservices pattern language. It begins with:

Back in 1986, Fred Brooks, author of The Mythical Man-Month, said that in software engineering, there are no silver bullets. In other words, there are no techniques or technologies that if you adopted would give you a 10X boost in productivity. Yet 30 years later, developers are still arguing passionately about their favorite silver bullets, absolutely convinced that their favorite technology will give them a massive boost in productivity.

This is something to remember next time you listen to a presentation or read an article (especially a manifesto!) that only describes the benefits of a technology.

Every technology has drawbacks and limitations, which are often overlooked by its advocates.

To learn why patterns are a more objective (the benefit) albeit less exciting way (the downside) to describe a technology read the blog post.

 

 

Posted in microservices | Tagged , , | Leave a comment