Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Interfaces as Ball of Mud Protection

DZone's Guide to

Interfaces as Ball of Mud Protection

Jaime Metcher's response to the article "Is Your Code Too Concrete?" in which Edmund Kirwan hypothesizes that using interfaces delays the onset of Mud.

· Integration Zone ·
Free Resource

Are your API program basics covered? Read the 5 Pillars of Full Lifecycle API Management eBook

A response to the article "Is Your Code Too Concrete?" in which Edmund Kirwan hypothesizes that using interfaces delays the onset of Mud.

A few observations:

  •  Any well-factored system will have more direct dependencies than methods. Having more methods than direct dependencies indicates that code re-use is very low.

  • For any well-structured system, the relationship between direct dependencies and indirect dependencies will be linear, not exponential. The buttons and string experimental result is not surprising but would only apply to software systems where people really do create interconnections at random. The whole purpose of modular program structure, explicitly, is to prevent this.

  • Abstract interfaces are in no way a necessary condition for modular programming.

  • Finally, the notion that interfaces act as a termination point for dependencies seems a little odd. An interface merely represents a point at which a dependency chain becomes potentially undiscoverable by static analysis. Unquestionably, the dependencies are still there. Otherwise, your call to that method at runtime wouldn’t do anything.

So, I suspect that what Edmund has discovered is a correlation between the use of interfaces and modular program structure. But that is just a correlation. A few years back, there was an unfortunate vogue for creating an interface for each and every class, a practice that turned out to be entirely compatible with a Big Ball of Mud architecture. The button and string experiment provides an interesting support for modular programming, but I don’t know that it says much about interfaces.

Establish API creation, publishing and discovery as a master practice with the API Management Playbook.

Topics:
interfaces ,design ,code ,integration

Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}