Over a million developers have joined DZone.
Platinum Partner

Design Patterns in the Test of Time: Façade

· Integration Zone

The Integration Zone is brought to you in partnership with 3scale. Discover why Rails + jspm >= ECMAScript 6 awesomeness.

A façade is an object that provides a simplified interface to a larger body of code, such as a class library.

More about this pattern.

The intent of the façade was good: to wrap APIs that are poorly designed in something shiny and nice.

In the real world, however, it is an evil pattern that is used to needlessly add abstractions for no particular reason. For example, look at this article.

Business Facade - Detailed View Data Access - Detailed View

That sound you just heard is your architecture, it is hiding in the closet, weeping silent tears about emotional and physical abuse that just doesn’t end.

I have yet to see a real case were façade was actually used properly. In most cases, people built a façade because That Is How We Do Things. And because of that, they ended up with things like the one above. It adds exactly nothing, and it horrifyingly complicates the code.

Recommendation: Avoid this, you really don’t need to do this most of the time, and most implementations are bad.

The Integration Zone is brought to you in partnership with 3scale. Learn how to deploy an NGINX API gateway on Heroku.


Published at DZone with permission of Ayende Rahien , DZone MVB .

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}