david_linthicum
Contributor

Cloud-native apps don’t have to stay DRY

analysis
Jul 20, 20213 mins
Cloud ComputingIT SkillsSoftware Development

Many of those designing microservices and service-based architectures are focusing a bit too much on reuse. ‘Don’t repeat yourself’ is not always good advice.

repetition magritte derby hat dock horizon multiply
Credit: Getty Images

Reuse has been a battle cry of developers since I was a lowly COBOL programmer back in the 1980s. Then we defined functions that could be called many times, and the structural programming age was born.

We then drifted to other languages such as C and the object-oriented C++ as better ways to build on the notion that reuse is good. Next we moved on to distributed objects and SOA (service-oriented architecture) services where reuse grew out of single applications, and then to reusable services that are loosely coupled and reside on different platforms. Now we have the notion of cloud services or APIs and the compelling concept of microservices providing a new granularity of sharing. Whew!

Reuse and/or sharing has taken on a new meaning for cloud and noncloud developers. Many are using the acronym DRY or “don’t repeat yourself,” as their new slogan for building and deploying applications and systems in 2022. However, it’s not as easy as that.

I’ve made two different mistakes when building service-based applications over the years: too much reuse and not enough.

How can you have too much service reuse? It’s when any productivity from using the same services repeatedly diminishes or is even negative. An example would be leveraging services that have to be abstracted and some of their functions changed in order to meet the needs of an application. For example, using a service that accesses customer credit data with all customer information but removing most of the common data back in a response set or a data stream since it’s not needed for this particular purpose within the application.

I’m seeing more of these kinds of hacks that force-fit the reuse. Application development is becoming a mix of services being reused, whether they should be or not. Moreover, these inefficiencies are often overlooked in code reviews and code scanners that don’t yet consider that some reuse could be less than productive. I’m sure some of you who sling code more than me are worried about the reuse baby being tossed out with the unproductivity bathwater, but I’m not saying go back to building services and microservices that are only leveraged once.

It comes down to understanding the trade-offs of leveraging reusable services, including how they should be designed and deployed. The core questions are: Is reusing these services going to make my application better? Should the service I’m reusing be redesigned and deployed? Or should I create a new service that’s purpose built?

You’ll find that it’s often more productive to take different routes, having a bit more of an open mind around what services should be reused. More importantly, learn to recognize when you’re attempting to force-fit a popular philosophy. I’ll take productivity over going along with the crowd any day.

david_linthicum
Contributor

David S. Linthicum is an internationally recognized industry expert and thought leader. Dave has authored 13 books on computing, the latest of which is An Insider’s Guide to Cloud Computing. Dave’s industry experience includes tenures as CTO and CEO of several successful software companies, and upper-level management positions in Fortune 100 companies. He keynotes leading technology conferences on cloud computing, SOA, enterprise application integration, and enterprise architecture. Dave writes the Cloud Computing blog for InfoWorld. His views are his own.

More from this author