ArticleslgStudy

computer science

Design smell

Design smell is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Design smell rather than just read about it. In short: In computer programming, a design smell is a structure in a design that indicates a violation of fundamental design principles, and which can negatively impact the project's quality. The origin of the term can be traced to the term "code smell" which was featured in the book Refactoring: Improving the Design of Existing Code by Martin Fowler.

Key takeaways

  • Design smell belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Design smell to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Design smell from memory before moving on to harder problems.

Reference excerpt

In computer programming, a design smell is a structure in a design that indicates a violation of fundamental design principles, and which can negatively impact the project's quality. The origin of the term can be traced to the term "code smell" which was featured in the book Refactoring: Improving the Design of Existing Code by Martin Fowler.

Details Different authors have defined the word "smell" in different ways:

N. Moha et al.: "Code and design smells are poor solutions to recurring implementation and design problems." R. C. Martin: "Design smells are the odors of rotting software." Fowler: "Smells are certain structures in the code that suggest (sometimes they scream for) the possibility of refactoring." Design smells indicate the accumulated design debt (one of the prominent dimensions of technical debt). Bugs or unimplemented features are not accounted as design smells. Design smells arise from the poor design decisions that make the design fragile and difficult to maintain. It is a good practice to identify design smells in a software system and apply appropriate refactoring to eliminate it to avoid accumulation of technical debt. The context (characterized by various factors such as the problem at hand, design eco-system, and platform) plays an important role to decide whether a certain structure or decision should be considered as a design smell. Generally, it is appropriate to live with design smells due to constraints imposed by the context. Nevertheless, design smells should be tracked and managed as technical debt because they degrade the overall system quality over time.

Common design smells Missing abstraction when clumps of data or encoded strings are used instead of creating an abstraction. Also known as "primitive obsession" and "data clumps". Multifaceted abstraction when an abstraction has multiple responsibilities assigned to it. Also known as "conceptualization abuse". Duplicate abstraction when two or more abstractions have identical names or implementation or both. Also known as "alternative classes with different interfaces" and "duplicate design artifacts". Deficient encapsulation when the declared accessibility of one or more members of an abstraction is more permissive than actually required. Unexploited encapsulation when client code uses explicit type checks (using chained if-else or switch statements that check for the type of the object) instead of exploiting the variation in types already encapsulated within a hierarchy. Broken modularization when data and/or methods that ideally should have been localized into a single abstraction are separated and spread across multiple abstractions. Insufficient modularization when an abstraction exists that has not been completely decomposed, and a further decomposition could reduce its size, implementation complexity, or both. Circular dependency. Cyclically dependent modularization when two or more abstractions depend on each other directly or indirectly (creating a tight coupling between the abstractions). Also known as "cyclic dependencies". Cyclic hierarchy when a supertype in a hierarchy depends on any of its subtypes. Also known as "inheritance/reference cycles". Unfactored hierarchy when there is unnecessary duplication among types in a hierarchy. Broken hierarchy when a supertype and its subtype conceptually do not share an “IS-A” relationship resulting in broken substitutability. Also known as "inappropriate use of inheritance" and "misapplying IS A".

See also Anti-pattern Software rot

References

Worked examples

Example 1 — a first encounter with Design smell

Start with the simplest possible case. Write down what Design smell claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Design smell before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Design smell ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Design smell

In research
Design smell appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Design smell in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Design smell is common in secondary-school and first-year university syllabi. It links to neighbouring topics Computer programming folklore, Odor, Software engineering folklore, so understanding it makes those chapters shorter.
In everyday life
Look for Design smell outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Design smell” →

How to study Design smell in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Design smell means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Design smell out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Design smell in simple terms?

In computer programming, a design smell is a structure in a design that indicates a violation of fundamental design principles, and which can negatively impact the project's quality. The origin of the term can be traced to the term "code smell" which was featured in the book Refactoring: Improving…

Why does Design smell matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Design smell?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Design smell.

Tags

  • Computer programming folklore
  • Odor
  • Software engineering folklore

Keep exploring