Menu
Sign In Search Podcasts Charts People & Topics Add Podcast API Pricing
Podcast Image

Develpreneur: Become a Better Developer and Entrepreneur

The Swiss Army Knife AntiPattern

21 Jun 2019

Description

A swiss army knife is a great tool to carry around with you.  However, this anti-pattern tells us that building a one-stop-shop for your design functionality is a wrong approach.  Several problems arise when you throw almost everything into a single class. Defining the Swiss Army Knife Anti-Pattern I found a good blog post on this anti-pattern to provide our definition.  The article focuses on an interface, but it holds for a class in general as well. [Click Here to See The Page] "Swiss Army Knife Interface is an interface class which has excessive number of method definitions. Architect/designer may design this interface to use for every need of the software, but this is a wrong approach and an antipattern. More than one interface must be designed using some design approaches." We stumble onto the idea of what is a proper number of methods for an interface or class.  Unfortunately, this is not a hard and fast rule.  It is something that varies by situation.  Thus, "too much" is left up to the designer and not a single number or even range, although 7-10 seems like a comfortable range for most people. Design First, Then Code It may feel like we have gone down this path before.  And we have.  Many anti-patterns, including the swiss army knife, can be avoided with design and planning before you dive into implementation.  However, in this case, there needs to be an on-going habit of designing before coding.  When you skip that step, you can find yourself building a solution that grows ever closer to this anti-pattern. Easy To Miss The toughest challenge with this situation is stepping back and seeing it approaching.  It is far easier to tack on function after function without keeping the big picture in mind.  When you stay in the weeds too much, it is easy to overlook the swiss army knife you have created.

Audio
Featured in this Episode

No persons identified in this episode.

Transcription

This episode hasn't been transcribed yet

Help us prioritize this episode for transcription by upvoting it.

0 upvotes
🗳️ Sign in to Upvote

Popular episodes get transcribed faster

Comments

There are no comments yet.

Please log in to write the first comment.