Professional Documents
Culture Documents
Boat Anchor Anti Pattern Presentation
Boat Anchor Anti Pattern Presentation
Boat Anchor Anti Pattern Presentation
B – Anti-Patterns’ categories
Based on the approach it intents to prevent, anti-patterns are divided into numerous categories:
• Organizational anti-patterns identify bad general company wide behavior.
• Project management anti-patterns pinpoint what can run a project against the wall?
• Analysis anti-patterns detect analysis and reporting issues.
• Software design anti-patterns ascertain bad patterns used in architecture.
• Object-oriented design anti-patterns recognize wrong implementation in detailed design.
• Programming anti-patterns classify bad low-level coding practices.
• Methodological anti-patterns indicate bad coding behavior.
• Configuration management anti-patterns signify bad relationship between components.
• Branching and Merging anti-patterns identify difficult integration situations.
(ColoreOfCode, 2020).
I – DESCRIPTION
Generally, a boat anchor is a metaphor used to describe a piece of hardware or software serving no
useful purpose on a project and weighing down its success. In the software realm, a boat anchor can refer
to a standalone software product or a chunk of code (Gilliland, n.d.). Boat Anchor belongs to
programming anti-patterns category. It takes place when a part of a system is kept despite it no longer
has any use. In a project, Boat Anchor signifies low-level coding practices. Habitually, it is due to the
belief – based on prior experience – that the code might be needed in the future (Broadhead, 2019).
Obsolete or not-in-use code that is still a part of the code base is a boat anchor. Retaining outdated
functionality in the system is an invitation to an invisible risk. Although the unused modules, classes or
any other structs seem highly unlikely to cause a problem, they still can at any moment (Mehra, 2021).
II – TYPICAL SCENARIOS
Explanation
As shown in the UML diagram, there are two methods – “editAccount(Account account)” and
“updateAccount(Account account)” – serving the same purpose with different approaches for a local gift shop
(GiftShop class). In this – studied – case, the best approach is going to be the simplest one. When developers
find themselves dealing with this anti-pattern, the best solution is to take it out of the picture immediately.
The cost of keeping this thing around is growing over time. It is a bad investment so keep throwing good
resources away with the bad should not happen (Broadhead, 2019). If the developer leaves the extraneous
method in place just in case someone needs to refer to it in the future, it is a Boat Anchor. It could lead to
difficulty to read the code, hard debugging, unnecessary maintenance and testing, or call an obsolete code. This
pattern is one of the few anti-patterns that has a clear, concise solution, one that has been known for decades.
YAGNI – "You Ain't Gonna Need It" – as solution is one of the oldest programming adages (Jones, 2018). To
appropriately design the system, the Boat Anchor – “updateAccount(Account account)” – must be removed
from “GiftShop” class.
IV – UML DIAGRAMS
V – PROS & CONS
For been a bad software design pattern, Boat-Anchor is more likely to:
• Bloat the code base.
• Mislead developers during debugging. They may end up working the wrong code before they eventually
get to know that it is not related to the problem they are solving at all.
• Be unknowingly referred to and used in the active code leading to some unwarranted behavior.
• Influence the system’s performance by starting up some scheduled or queueing tasks when they are no
longer needed.
• Increase the compilation time.
• Use valuable system resources by any active singletons or spring beans.
• Weigh down the project and keep it from moving forward quickly leading to missed dead line.
• Add more costs to the project budget.
(Mehra, 2021).
References
Broadhead, R. (2019, May 17). The boat anchor anti-pattern. Retrieved May 26, 2022, from
https://develpreneur.com/the-boat-anchor-anti-pattern/
ColorOfCode. (2020, March 09). Anti-Patterns. Retrieved May 25, 2022, from
https://color-of-code.de/patterns/anti-patterns
Gilliland, C. (n.d.). Boat anchor anti pattern. SWEN 656 – 9040 Advanced Software Design &
Implementation.
Jones, M. (2018). Boat Anchor - The daily software Anti-Pattern. Retrieved May 24, 2022, from
https://exceptionnotfound.net/boat-anchor-the-daily-software-anti-pattern/
Mehra, L. (2021). Software design patterns for java developers | Chapter 14 - Beyond design patterns |
Anti-patterns. Retrieved May 27, 2022, from
https://library-books24x7-com.ezproxy.umgc.edu/assetviewer.aspx?
bookid=158351&chunkid=199463621¬eMenuToggle=0&hitSectionMenuToggle=0&leftMenuState=1
NYSIA. (2005, December 6). Recognizing and understanding anti patterns in java application
development. Retrieved May 23, 2022, from https://redlich.net/pdf/presentations/nysia-jug/anti-
patterns.pdf
Zablocki, J. J. (2014, Mars 29). Anti-Design pattern boat anchor [video]. Retrieved May 20, 2022, from
https://www.youtube.com/watch?v=3Id6Q0qH1XU