Blog

Microservices and Gardening

What does gardening have to do with software development? In a word, Microservices.

In software development, the speed and efficiency by which you can deliver code is vital to a project’s success. Updates and fixes need to happen smoothly and quickly, otherwise you’re looking at lost time and money. To maximize productivity, Cuttlesoft utilizes what are called “services oriented architectures” comprised of “Microservices.”

We like to compare this development approach to cultivating a garden.

Services and Scalability

First, imagine you want an app for your small business. It needs to be able to let users sign in, create a profile, handle sales and transactions, plan and promote a calendar of events, and send push notifications about sales and discounts. We’ll refer to these different functions as ‘services.’ You also need these services to be able to grow and take on new users easily. We’ll call this aspect of your app ‘scalability.’

Now imagine that you want to start a vegetable garden in your backyard. You decide you want to grow carrots, broccoli, spinach, cucumber, and squash. These can be considered the ‘services’ of your garden. You pick a large enough area for your plots, fence it in, and dig up all the weeds and grass. Then you dig neat rows all the way across and plant your seeds. The amount you can grow at one time is akin to the “scalability” of your garden.

Monolithic Designs

monolithic software garden

Right now, your software (and your garden) has a ‘monolithic’ arrangement. Your app is one big set of code with all of your services housed under one roof – and your garden is a big plot with all of your vegetables planted side by side. Everything looks great. Your garden is planted and your application is in development. You sit back, relax, and watch them grow. 

Once you begin testing your app, however, you find there are some delays. The user profiles aren’t communicating with the sales service and the push notifications won’t promote the events on the calendar. The whole system is using way too much data. Because the software is written all together, you can’t change one aspect of one service without it affecting the rest of the code. This makes fixing problems and making even minor alterations cumbersome, time consuming, and expensive. 

Your sprouts run into problems as well. The broccoli is cramped, the cucumbers are getting too much sun, the carrots are tangled with the spinach, and the squash needs more water. The big plot is also hard to maintain. You’re tripping over roots and stems as you prune, your hose doesn’t quite reach all the way to the back, and the whole thing sucks up too much water. 

Cultivating Growth with Microservices

You decide that instead of having all your veggies in one big plot, you should erect separate beds for each. You start by re-digging your plots as individual beds for each type of plant. You replant the broccoli with more space, the carrots apart from the spinach, the cucumbers under a shady tree, and the squash closer to the hose. This new design allows you to fix things as needed for each individual plant without having it affect the others, giving them all plenty of room to grow. 

You then realize that you can do the same thing with your software. Instead of putting all of your code into one monolithic program, you split up your application’s services into ‘microservices’ designed to handle each individual function. The user profile service is written as one compact microservice separate from the sales, calendar, and notification services. With services oriented architectures, you can make edits and update any element of your application at a moment’s notice without affecting other independent services or causing major downtime or expensive rewrites.

While there is no precise definition of this architectural style, there are certain common characteristics around organization around business capability, automated deployment, intelligence in the endpoints, and decentralized control of languages and data.
– Martin Fowler

Scalability

Now back to the garden. Because of the individualized care each plant receives, your garden starts producing plentiful, lush vegetables that you prepare and combine into a delicious salad. You decide that while your fresh salad is good, you need some spices to garnish it with. You also think that you could expand your current plots to grow a higher volume to share with your neighbors. Because you set up an organized grid of separate garden plots early on, it’s easy for you to expand your current beds as well as plant parsley, basil, and oregano in just the right spot without having to disturb existing plants.

At the same time, you have a great new idea for your app (which now has a few thousand users). You want your customers to be able to find the nearest store location using GPS and offer them specific deals based on where they are. Because your app used a microservices based approach, you are able to easily add on another package of code creating the new service.

microservices gardening

The new feature works perfectly with the other microservices, because they are all packaged in their own unique batch of code connected only by the front-end application. And because each microservice is covering only a small range of responsibilities, it is easy to expand each one individually as more people sign on, allowing your application to handle a higher user volume as needed.

The garden analogy shows how using services oriented architectures allows applications to develop quickly, test and update with ease, and scale to support as many users as you can sign on. The microservices approach makes your app a “living” software, much like a bountiful garden changing and adapting with the seasons. Just as your vegetables and herbs thrive and grow under a dynamic approach, so can your application under a services oriented architecture.

Want to learn more about Cuttlesoft and cultivating microservices? Get in touch!