Effective Code — Interfaces

//Effective Code — Interfaces

One of the benefits of regularly designing software systems here at Nebbia Technology is having the first-hand experience of what works and what doesn’t across a vast spectrum of technologies.  With every project that we engage, our knowledge and insights gained from previous experiences allow us to deliver solutions that not only make technological sense, but also serve the capabilities of an organization in a complimentary way.  After all, how much value have we truly provided if we turn over software that can’t grow with a client?  In this article, we explore the idea of creating effective code that serves a client in this way and one of the techniques that we commonly employ to make effective code possible.

Effective Code

So, what does “effective code” mean to us?  When our engagement with a client ends, we want to be certain that the software we are delivering can be used by the client for the foreseeable future.  That means the code should be:

  • Maintainable – Business requirements change. Being able to rapidly modify the code to match evolving requirements means better organizational alignment and happier managers/stakeholders.
  • Extensible – No software system is ever complete. Writing code that is easily extended means new features can be added with relative simplicity.
  • Performant – Slow software is costly and painful. Writing software that is performant means that hosting costs can remain optimized for the long haul and businesses can realize smaller customer churn rates.

One of the concepts that we use regularly to write effective code is interface-based programming.  Using this technique is indubitably powerful and scalable for creating systems that are susceptible to change.  Now let’s look at what it means to do interface-based programming.

Interface-Based Programming

An interface can be thought of as a contract that says, “If x is requested with parameter y, then the response will consist of z.”  Simply put, they are used to convey expectations between components.

Organizational Alignment

Planning and defining interfaces in software means that developers must acquire the business requirements before writing functionality.  It also reduces the likelihood that a developer could write code that is the result of misinterpreted business requirements.  Ultimately, this technique aligns developers with the business to inform how the code should be written.

Developer Alignment

For developers, interfaces serve as an agreement for how components will interact.  The interface informs the developer on how a component fits into the bigger picture.  Even better, that knowledge of the bigger picture allows two developers to develop components that will interact with one another, but the two developers will never even need to speak.  Natural alignment of a development team is a true strength of interface-based programming!

Testability

Software tests often capture business requirements and protect code from straying from the requirements.  Without tests, there is no guarantee that a change to the software won’t affect an expected behavior of the system.  Using interface-based programming enables test-driven development which means that developers will write tests that describe business requirements and then write the functionality of the system to make those tests pass.  This is just one more way that developers can ensure that they are not affecting existing business requirements when modifying or extending the system.

Disclaimer: This method is not a perfect fit for all software, but in systems where it does work well, it works REALLY well.

Next Steps

To learn more about implementing interfaces in software, please check out this article where I explore a real-world scenario of implementing interfaces in a microservices environment: https://www.jvanwinkle.com/interfaces-in-the-wild/

Looking for Custom Software Development?

We have expert .NET developers specializing in Azure and DevOps who would love to collaborate with you to find the solution that enables your business to realize its maximum potential!

By |2018-11-14T11:26:21+00:00October 31st, 2018|

About the Author:

Justin is a U.S. Air Force Veteran and a Full-Stack Software Developer who emphasizes simplistic code, robust end-to-end solutions, and maintainable architecture. He earned a Bachelor of Science in Computer Science from the University of Maryland University College and is a Certified Agile Professional through the International Consortium for Agile. In his previous roles, Justin has worked extensively in DevOps and Infrastructure, giving him a breadth of knowledge to bring entire systems together with seamless cohesion. You can find Justin at csrecap.com, tweet to him @FundamentalDev, or connect with him on LinkedIn.