Upload
tushar-sharma
View
1.304
Download
10
Embed Size (px)
DESCRIPTION
Technical Debt is a major concern today for huge and long-life maintenance projects. You can address technical debt in your project by identifying smells in your project and refactoring them. We have classified and cataloged 25 commonly-occurring design smells according to the design principles they violate.
Citation preview
Abstraction
Missing AbstractionThis smell arises when clumps of data or
encoded strings are used instead of creatinga class or an interface.
Imperative AbstractionThis smell arises when an operation is
turned into a class.
Incomplete AbstractionThis smell arises when an abstraction doesnot support complementary or interrelated
methods completely.
Multifaceted AbstractionThis smell arises when an abstraction has
more than one responsibility assigned to it.
Unnecessary AbstractionThis smell occurs when an abstraction whichis actually not needed (and thus could havebeen avoided) gets introduced in a software
design.
Unutilized AbstractionThis smell arises when an abstraction is left
unused (either not directly used or notreachable).
Duplicate AbstractionThis smell arises when two or more
abstractions have the identical name oridentical implementation or both.
EncapsulationDeficient Encapsulation
This smell occurs when the declaredaccessibility of one or more members of anabstraction is more permissive than actually
required.
Leaky EncapsulationThis smell arises when an abstraction “exposes”
or “leaks” implementation details through itspublic interface.
Missing EncapsulationThis smell occurs when the encapsulation of
implementation variations in a type or hierarchyis missing.
Unexploited EncapsulationThis smell arises when client code uses explicit
type checks(using chained if-else or switchstatements) instead of exploiting the variation
in types already encapsulated within ahierarchy.
Modularization
Hierarchy
Missing Hierarchy Deep HierarchyModularization
Broken ModularizationThis smell arises when data and/or methodsthat ideally should have been localized into asingle abstraction are separated and spread
across multiple abstractions.
Insufficient ModularizationThis smell arises when an abstraction exists that
has not been completely decomposed and afurther decomposition could reduce its size,
implementation complexity, or both.
Cyclically- dependentModularization
This smell arises when two or more abstractionsdepend on each other directly or indirectly
(creating a tight coupling between theabstractions).
Hub-like ModularizationThis smell arises when an abstraction has
dependencies (both incoming and outgoing)with large number of other abstractions.
Missing HierarchyThis smell arises when a code segment uses
conditional logic (typically in conjunction with“tagged types”) to explicitly manage variation in
behavior where a hierarchy could have beencreated and used to encapsulate those
variations.
Unnecessary HierarchyThis smell arises when the whole inheritance
hierarchy is unnecessary, indicating thatinheritance has been applied needlessly for the
particular design context.
Unfactored HierarchyThis smell arises when there is unnecessaryduplication among types in the hierarchy.
Wide HierarchyThis smell arises when an inheritance hierarchy
is “too” wide indicating that intermediateabstractions may be missing.
Speculative HierarchyThis smell arises when one or more types in a
hierarchy are provided speculatively (i.e. basedon imagined needs rather than real
requirements).
Deep HierarchyThis smell arises when an inheritance hierarchy
is "excessively" deep.
Rebellious HierarchyThis smell arises when a subtype rejects the
methods provided by its supertype(s).
Broken HierarchyThis smell arises when a supertype and its
subtype conceptually do not share an “IS-A”relationship resulting in broken substitutability.
Multipath HierarchyThis smell arises when a subtype inherits bothdirectly as well as indirectly from a supertype
leading to unnecessary inheritance paths in thehierarchy.
Cyclic HierarchyThis smell arises when a supertype in a
hierarchy depends on any of its subtypes.
Authors: Girish Suryanarayana, GaneshSamarthyam, Tushar Sharma
Publisher: Morgan Kaufmann
Publication date: Nov 2014