SlideShare a Scribd company logo
bertjan@openvalue.eu
Making sensible software design decisions
Bert Jan Schrijver
Generic or specific?
@bjschrijver.dev
Bert Jan Schrijver
L e t ’ s m e e t
@bjschrijver.dev
@bjschrijver.dev
Levels of
generic vs specific
Tools to help decide
Flexibility in software
Definitions
When & why to go
generic
Bonus: sharing code in
an organisation
Conclusion
Outline
W h a t ‘ s n e x t ?
The cost of generic
What is software design?
Design vs architecture
• Tailor made for use in a single place
• Tailored to a specific problem or scenario
• May not be easily adaptable to other
situations
Specific solution (or design)
• Flexible and reusable solution
• Can be applied to a wide range of
problems or scenarios
• Generified solution that can be used in
more than 1 place
• In this talk: generic = shared code
Generic solution (or design)
Background source: https://filmquarterly.org/2012/07/02/i-robot-what-do-robots-dream-of/
• Breaking a system or problem into
smaller parts that are easier to
understand
• Example: Google search
Hierarchical decomposition
Background source: DALL·E
Hierarchical decomposition
Source: https://c4model.com
• Kind and degree of interdependence
between building blocks of software
• Measure of how closely connected two
components are
• Usually contrasted with cohesion
(low coupling -> high cohesion)
Coupling
Background source: DALL·E
• Inheritance
• Messages or events
• Temporal
• Data types
• Data
• Code / API (binary or source)
Types of coupling
Background source: DALL·E
Be careful with coupling!
Generic solution = coupling!
The risk of DRY
Duplicated code doesn’t hurt
until you need to change it.
• Should we be prepared for future
changes?
• Design should be structured to
accommodate change
• Risk management: risk of wrong decision
“Future proof” design
Background source: DALL·E
17
About flexibility in software…
“Highly specific code is often preferable
to sophisticated configuration”
- Stefan Tilkov
When are we going to talk
about generic vs specific?
Background source: https://7216-presscdn-0-76-pagely.netdna-ssl.com/wp-content/uploads/2011/12/confused-man-single-good-men.jpg
• Code / class level
• Manually written vs generated code
• Library level
• Data level (or data structure level)
• (Micro)service level
• Organisation level
Generic vs specific: levels
Background source: DALL·E
Generic or specific?
• When you make something generic, you’re
making an abstraction
• An abstraction generalizes over the problem
and solution space by finding common
behaviour and hiding implementation details
Abstractions
Background source: Héctor J. Rivas on Unsplash
• Do we really need this now? (YAGNI)
• The 5 W’s
• Time/effort for generic vs specific
• Myth of “first time right”
• Complexity and scope
• The rule of three
• Future needs and evolution
Tools to help decide
• When reusing code, copy it once, and only
abstract the third time
• Avoid writing the wrong abstraction
• It’s easier to make a good abstraction from
duplicated code than to refactor the wrong
abstraction
• "Three strikes and you refactor"
The rule of three
Background source: https://learntalk.org/en/blog/where-did-the-saying-third-times-the-charm-come-from
• First case: Just build it, don’t genericise at all.
Solve the problem in front of you (YAGNI)
• Second case: Duplicate the original, redesign and
extract common behaviour while you change
• Third case: examine lessons from first two
passes, design a generic solution that will make it
easy to add your third case
The rule of three
Background source: https://learntalk.org/en/blog/where-did-the-saying-third-times-the-charm-come-from
• Concept from Domain Driven Design
• Tool to help decide for generic vs specific
• But more about building something yourself or not
• Subdomains (from perspective of custom software
development):
• Core domain
• Supporting subdomain
• Generic subdomain
Strategic design
Background source: GR Stocks on Unsplash
• Organisations design systems that mirror
their own communication structure
• Don’t force a solution that goes against
the organisation structure
• Be careful to go generic when teams don’t
want to work together
Conway’s law
Background source: DALL·E
Conway’s law in action
Background source: DALL·E
• Going generic may save time in the long run,
but at which price?
• Another rule of three: building reusable
components is 3x as difficult as single use
• The price you pay is coupling
• Both on code level and people/team level
(communication & planning overhead)
The cost of a generic solution
Background source: DALL·E
What if you get it wrong?
Photo: Dave Lehl
• What are the costs of abstractions?
Abstractions
Background source: Héctor J. Rivas on Unsplash
• There are no zero cost abstractions
• Efficiency gains of a generic solution are
typically clear, but how about:
• Onboarding new people
• Readability
• Coupling
The cost of abstractions
Background source: Héctor J. Rivas on Unsplash
• Writing bad abstractions
• Writing unnecessary reusable code
• Introducing unnecessary coupling
• Maintaining bad abstractions
• Hard to see
• Hard to understand
• Hard to extend
The cost of abstractions
Background source: Héctor J. Rivas on Unsplash
When & why to go generic
• ”We’ve always done it like this”
• “We don’t want to depend on libraries”
• “We need to be future proof”
• Because the product owner wants it
• Because the architect wants it
Bad reasons to go generic
• Rule of three checks out
• You’re pretty sure you’re going to need it
almost everywhere
• A library that lots of teams will use
• Complex logic or skills that only a couple of
people have
• Gains are bigger than cost
Valid reasons to go generic
• Think back about the layers in hierarchical
decomposition of a system
• Code vs component vs service
• Are the considerations for generic vs specific the
same on every level?
• Risk when getting it wrong is higher when the level
is higher
• Don’t confuse generification with standardisation!
Generic vs specific in different scopes
Background source: Fernando Gomez on Unsplash
Why specific is often faster
Code golf
41
Advent of code
Generic or Specific? Making sensible software design decisions
Generic or Specific? Making sensible software design decisions
Generic or Specific? Making sensible software design decisions
Generic or Specific? Making sensible software design decisions
Exception handling
Generic or Specific? Making sensible software design decisions
Website code re-use
50
51
Generic solutions on organisation level
• Sharing code efficiently at scale is hard
• Sharing code at scale means:
• Multiple modules that share code
• Multiple team members
• High rate of change
• Little to no loss of individual productivity
Sharing code within an organisation
Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
• Challenges:
• Refactoring
• Versioning
• Reviewing
• Builds and codebase size
Sharing code within an organisation
Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
• Monorepo: 1 large repository for a group of
projects (possible all projects)
• Good: easy to make changes across projects
• Bad: dependencies & build times
Monorepositories
Background source: DALL·E
• Discovery: what code / libraries exist?
• Distribution: binary or source dependency?
• Import: well defined API’s or chaos?
• Versioning, upgrades and lifecycle
management
• Who maintains it?
• Possible approach: inner source culture
Considerations on sharing code in an org
Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b, background source: Klara Kulikova on Unsplash
Summary
• Consider:
• YAGNI / Rule of three / 5 W’s
• Cost of generic
• Scope / level
• Conway’s law
• Organisation impact
Generic or specific?
Generic or specific?
It depends.
A program that works perfectly but is
impossible to change will become
useless.
A program that does not work but is easy
to change will become and remain useful
continuously.
Source: Clean Architecture, Robert C. Martin
Write. simple. code.
Source: https://images.unsplash.com/photo-1515611926865-4fcb1c2ce28d?ixlib=rb-4.0.3&dl=kelly-sikkema-kxtB2TFBF2g-unsplash.jpg&q=80&fm=jpg&crop=entropy&cs=tinysrgb
Source: https://cdn2.vox-cdn.com/thumbor/J9OqPYS7FgI9fjGhnF7AFh8foVY=/148x0:1768x1080/1280x854/cdn0.vox-cdn.com/uploads/chorus_image/image/46147742/cute-success-kid-1920x1080.0.0.jpg
THAT’S IT.
NOW GO KICK SOME ASS!
Questions?
@bjschrijver.dev
Thanks for your time.
Please rate this session by scanning the QR code!
All pictures belong
to their respective
authors
@bjschrijver.dev

More Related Content

PDF
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
Generic or Specific? Making Sensible Software Design Decisions
Bert Jan Schrijver
 
PDF
JUG CH December 2022 - Generic or specific?
Bert Jan Schrijver
 
PPT
Agile software development
Hemangi Talele
 
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
Generic or specific? Making sensible software design decisions
Bert Jan Schrijver
 
Generic or Specific? Making Sensible Software Design Decisions
Bert Jan Schrijver
 
JUG CH December 2022 - Generic or specific?
Bert Jan Schrijver
 
Agile software development
Hemangi Talele
 

Similar to Generic or Specific? Making sensible software design decisions (20)

PPT
Agile Software Development.ppt
abdulwehab2
 
PPTX
Software Design
Ahmed Misbah
 
PPTX
Online TechTalk  "Patterns in Embedded SW Design"
GlobalLogic Ukraine
 
PDF
Agents for SW development - Berkeley LLM AI Agents MOOC
VincentLui15
 
PPT
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
KEY
Zend Di in ZF 2.0
Ralph Schindler
 
PDF
Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013
Neo4j
 
PDF
Excavating the knowledge of our ancestors
Uwe Friedrichsen
 
PPTX
It's XP Stupid (2019)
Mike Harris
 
PDF
Agile Software Development
Ahmet Bulut
 
PPTX
Clean code presentation
Bhavin Gandhi
 
PDF
Why You're A Bad PHP Programmer
KLabCyscorpions-TechBlog
 
PPTX
Code Smells
Mrinal Bhattacaharya
 
PDF
Design Patterns from 10K feet
Naresha K
 
PDF
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
Edge AI and Vision Alliance
 
PDF
It's XP, Stupid
Mike Harris
 
PPTX
Design Patterns - General Introduction
Asma CHERIF
 
PPTX
Software design principles
Md.Mojibul Hoque
 
PPTX
Cleaning Code - Tools and Techniques for Large Legacy Projects
Mike Long
 
PDF
Module 2 design patterns-2
Ankit Dubey
 
Agile Software Development.ppt
abdulwehab2
 
Software Design
Ahmed Misbah
 
Online TechTalk  "Patterns in Embedded SW Design"
GlobalLogic Ukraine
 
Agents for SW development - Berkeley LLM AI Agents MOOC
VincentLui15
 
6 Design Pattern.ppt design pattern in softeare engineering
MuhammadAbubakar114879
 
Zend Di in ZF 2.0
Ralph Schindler
 
Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013
Neo4j
 
Excavating the knowledge of our ancestors
Uwe Friedrichsen
 
It's XP Stupid (2019)
Mike Harris
 
Agile Software Development
Ahmet Bulut
 
Clean code presentation
Bhavin Gandhi
 
Why You're A Bad PHP Programmer
KLabCyscorpions-TechBlog
 
Design Patterns from 10K feet
Naresha K
 
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
Edge AI and Vision Alliance
 
It's XP, Stupid
Mike Harris
 
Design Patterns - General Introduction
Asma CHERIF
 
Software design principles
Md.Mojibul Hoque
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Mike Long
 
Module 2 design patterns-2
Ankit Dubey
 
Ad

Recently uploaded (20)

PDF
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
PDF
Comprehensive Salesforce Implementation Services.pdf
VALiNTRY360
 
PPTX
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
OnestopDA
 
DOCX
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
PPTX
Audio Editing and it's techniques in computer graphics.pptx
fosterbayirinia3
 
PPTX
Save Business Costs with CRM Software for Insurance Agents
Insurance Tech Services
 
PDF
A REACT POMODORO TIMER WEB APPLICATION.pdf
Michael624841
 
PDF
Rise With SAP partner in Mumbai.........
pts464036
 
PDF
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
PPT
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
AKSHAYA255427
 
PPT
Overview of Oracle Receivables Process.ppt
nbvreddy229
 
PDF
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
devilbrown689
 
PDF
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
PDF
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
PDF
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
PPTX
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
PPTX
10 Hidden App Development Costs That Can Sink Your Startup.pptx
Lunar Web Solution
 
PDF
Exploring AI Agents in Process Industries
amoreira6
 
PPTX
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
PPTX
AZ900_SLA_Pricing_2025_LondonIT (1).pptx
chumairabdullahph
 
Micromaid: A simple Mermaid-like chart generator for Pharo
ESUG
 
Comprehensive Salesforce Implementation Services.pdf
VALiNTRY360
 
Hire Expert Blazor Developers | Scalable Solutions by OnestopDA
OnestopDA
 
The Five Best AI Cover Tools in 2025.docx
aivoicelabofficial
 
Audio Editing and it's techniques in computer graphics.pptx
fosterbayirinia3
 
Save Business Costs with CRM Software for Insurance Agents
Insurance Tech Services
 
A REACT POMODORO TIMER WEB APPLICATION.pdf
Michael624841
 
Rise With SAP partner in Mumbai.........
pts464036
 
What to consider before purchasing Microsoft 365 Business Premium_PDF.pdf
Q-Advise
 
FALLSEM2025-26_ISWE304L_TH_VL2025260102786_2025-07-10_Reference-Material-II.ppt
AKSHAYA255427
 
Overview of Oracle Receivables Process.ppt
nbvreddy229
 
Why Should Businesses Extract Cuisine Types Data from Multiple U.S. Food Apps...
devilbrown689
 
Community & News Update Q2 Meet Up 2025
VictoriaMetrics
 
ShowUs: Pharo Stream Deck (ESUG 2025, Gdansk)
ESUG
 
Solar Panel Installation Guide – Step By Step Process 2025.pdf
CRMLeaf
 
Visualising Data with Scatterplots in IBM SPSS Statistics.pptx
Version 1 Analytics
 
10 Hidden App Development Costs That Can Sink Your Startup.pptx
Lunar Web Solution
 
Exploring AI Agents in Process Industries
amoreira6
 
Presentation of Computer CLASS 2 .pptx
darshilchaudhary558
 
AZ900_SLA_Pricing_2025_LondonIT (1).pptx
chumairabdullahph
 
Ad

Generic or Specific? Making sensible software design decisions

  • 1. [email protected] Making sensible software design decisions Bert Jan Schrijver Generic or specific? @bjschrijver.dev
  • 2. Bert Jan Schrijver L e t ’ s m e e t @bjschrijver.dev
  • 3. @bjschrijver.dev Levels of generic vs specific Tools to help decide Flexibility in software Definitions When & why to go generic Bonus: sharing code in an organisation Conclusion Outline W h a t ‘ s n e x t ? The cost of generic
  • 6. • Tailor made for use in a single place • Tailored to a specific problem or scenario • May not be easily adaptable to other situations Specific solution (or design)
  • 7. • Flexible and reusable solution • Can be applied to a wide range of problems or scenarios • Generified solution that can be used in more than 1 place • In this talk: generic = shared code Generic solution (or design) Background source: https://filmquarterly.org/2012/07/02/i-robot-what-do-robots-dream-of/
  • 8. • Breaking a system or problem into smaller parts that are easier to understand • Example: Google search Hierarchical decomposition Background source: DALL·E
  • 10. • Kind and degree of interdependence between building blocks of software • Measure of how closely connected two components are • Usually contrasted with cohesion (low coupling -> high cohesion) Coupling Background source: DALL·E
  • 11. • Inheritance • Messages or events • Temporal • Data types • Data • Code / API (binary or source) Types of coupling Background source: DALL·E
  • 12. Be careful with coupling!
  • 13. Generic solution = coupling!
  • 14. The risk of DRY
  • 15. Duplicated code doesn’t hurt until you need to change it.
  • 16. • Should we be prepared for future changes? • Design should be structured to accommodate change • Risk management: risk of wrong decision “Future proof” design Background source: DALL·E
  • 17. 17
  • 18. About flexibility in software…
  • 19. “Highly specific code is often preferable to sophisticated configuration” - Stefan Tilkov
  • 20. When are we going to talk about generic vs specific? Background source: https://7216-presscdn-0-76-pagely.netdna-ssl.com/wp-content/uploads/2011/12/confused-man-single-good-men.jpg
  • 21. • Code / class level • Manually written vs generated code • Library level • Data level (or data structure level) • (Micro)service level • Organisation level Generic vs specific: levels Background source: DALL·E
  • 23. • When you make something generic, you’re making an abstraction • An abstraction generalizes over the problem and solution space by finding common behaviour and hiding implementation details Abstractions Background source: Héctor J. Rivas on Unsplash
  • 24. • Do we really need this now? (YAGNI) • The 5 W’s • Time/effort for generic vs specific • Myth of “first time right” • Complexity and scope • The rule of three • Future needs and evolution Tools to help decide
  • 25. • When reusing code, copy it once, and only abstract the third time • Avoid writing the wrong abstraction • It’s easier to make a good abstraction from duplicated code than to refactor the wrong abstraction • "Three strikes and you refactor" The rule of three Background source: https://learntalk.org/en/blog/where-did-the-saying-third-times-the-charm-come-from
  • 26. • First case: Just build it, don’t genericise at all. Solve the problem in front of you (YAGNI) • Second case: Duplicate the original, redesign and extract common behaviour while you change • Third case: examine lessons from first two passes, design a generic solution that will make it easy to add your third case The rule of three Background source: https://learntalk.org/en/blog/where-did-the-saying-third-times-the-charm-come-from
  • 27. • Concept from Domain Driven Design • Tool to help decide for generic vs specific • But more about building something yourself or not • Subdomains (from perspective of custom software development): • Core domain • Supporting subdomain • Generic subdomain Strategic design Background source: GR Stocks on Unsplash
  • 28. • Organisations design systems that mirror their own communication structure • Don’t force a solution that goes against the organisation structure • Be careful to go generic when teams don’t want to work together Conway’s law Background source: DALL·E
  • 29. Conway’s law in action Background source: DALL·E
  • 30. • Going generic may save time in the long run, but at which price? • Another rule of three: building reusable components is 3x as difficult as single use • The price you pay is coupling • Both on code level and people/team level (communication & planning overhead) The cost of a generic solution Background source: DALL·E
  • 31. What if you get it wrong? Photo: Dave Lehl
  • 32. • What are the costs of abstractions? Abstractions Background source: Héctor J. Rivas on Unsplash
  • 33. • There are no zero cost abstractions • Efficiency gains of a generic solution are typically clear, but how about: • Onboarding new people • Readability • Coupling The cost of abstractions Background source: Héctor J. Rivas on Unsplash
  • 34. • Writing bad abstractions • Writing unnecessary reusable code • Introducing unnecessary coupling • Maintaining bad abstractions • Hard to see • Hard to understand • Hard to extend The cost of abstractions Background source: Héctor J. Rivas on Unsplash
  • 35. When & why to go generic
  • 36. • ”We’ve always done it like this” • “We don’t want to depend on libraries” • “We need to be future proof” • Because the product owner wants it • Because the architect wants it Bad reasons to go generic
  • 37. • Rule of three checks out • You’re pretty sure you’re going to need it almost everywhere • A library that lots of teams will use • Complex logic or skills that only a couple of people have • Gains are bigger than cost Valid reasons to go generic
  • 38. • Think back about the layers in hierarchical decomposition of a system • Code vs component vs service • Are the considerations for generic vs specific the same on every level? • Risk when getting it wrong is higher when the level is higher • Don’t confuse generification with standardisation! Generic vs specific in different scopes Background source: Fernando Gomez on Unsplash
  • 39. Why specific is often faster
  • 41. 41
  • 50. 50
  • 51. 51
  • 52. Generic solutions on organisation level
  • 53. • Sharing code efficiently at scale is hard • Sharing code at scale means: • Multiple modules that share code • Multiple team members • High rate of change • Little to no loss of individual productivity Sharing code within an organisation Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
  • 54. • Challenges: • Refactoring • Versioning • Reviewing • Builds and codebase size Sharing code within an organisation Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
  • 55. • Monorepo: 1 large repository for a group of projects (possible all projects) • Good: easy to make changes across projects • Bad: dependencies & build times Monorepositories Background source: DALL·E
  • 56. • Discovery: what code / libraries exist? • Distribution: binary or source dependency? • Import: well defined API’s or chaos? • Versioning, upgrades and lifecycle management • Who maintains it? • Possible approach: inner source culture Considerations on sharing code in an org Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b, background source: Klara Kulikova on Unsplash
  • 58. • Consider: • YAGNI / Rule of three / 5 W’s • Cost of generic • Scope / level • Conway’s law • Organisation impact Generic or specific?
  • 60. A program that works perfectly but is impossible to change will become useless. A program that does not work but is easy to change will become and remain useful continuously. Source: Clean Architecture, Robert C. Martin
  • 61. Write. simple. code. Source: https://images.unsplash.com/photo-1515611926865-4fcb1c2ce28d?ixlib=rb-4.0.3&dl=kelly-sikkema-kxtB2TFBF2g-unsplash.jpg&q=80&fm=jpg&crop=entropy&cs=tinysrgb
  • 64. Thanks for your time. Please rate this session by scanning the QR code! All pictures belong to their respective authors @bjschrijver.dev