SlideShare una empresa de Scribd logo
1 de 53
Descargar para leer sin conexión
bertjan@openvalue.eu
Making sensible software design decisions
Bert Jan Schrijver
@bjschrijver
Generic or specific?
Bert Jan Schrijver
L e t ’ s m e e t
@bjschrijver
Levels of
generic vs specific
Tools to help decide
Flexibility in software
Definitions
When & why to go
generic
Sharing code in
an organization
Conclusion
Outline
W h a t ‘ s n e x t ?
The cost of generic
@bjschrijver
What is software design?
• 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)
• More flexible and reusable solution
• Solution can be applied to a wide range of
problems or scenarios
• Generified solution that can be used in
more than 1 place
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
• 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
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
• Library level
• Data level
• (Micro)service level
• Organisation level
Generic vs specific: levels
Background source: DALL·E
Generic or specific?
• Do we really need this now? (YAGNI)
• Time/effort for generic vs specific
• Myth of “first time right”
• Complexity and scope
• Future needs and evolution
• The rule of three
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 the lessons from the 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
• Pass 1: YAGNI / rule of three: as simple and specific as
possible
• Pass 2: based on solution domain knowledge:
is a generic solution less work?
• Pass 3: based on problem domain knowledge:
is the easiest solution actually correct?
• Pass 4: looking at customer behaviour or other non
technical considerations, does this change your decision?
Design heuristics
Background source: DALL·E
• Concept from Domain Driven Design
• Tool to help decide for generic vs specific
• But more about building yourself or not
• Subdomains:
• Core domain
• Supporting subdomain
• Generic subdomain
Strategic design
Background source: GR Stocks on Unsplash
• Organizations 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
• 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 overhead)
The cost of a generic solution
Background source: DALL·E
What if you get it wrong?
Photo: Dave Lehl
• 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 standardization!
Generic vs specific in different scopes
Background source: Fernando Gomez on Unsplash
Why specific is often faster
Code golf
Advent of code
Generic solutions on organization 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 organization
Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
• Challenges:
• Refactoring
• Versioning
• Reviewing
• Builds and codebase size - monorepo?
Sharing code within an organization
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
• Cost of generic
• Scope / level
• Conway’s law
• Organization
Generic or specific?
Generic or specific?
It depends.
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
Thanks for your time.
Got feedback? Tweet it!
All pictures belong
to their respective
authors
@bjschrijver

Más contenido relacionado

La actualidad más candente

La actualidad más candente (20)

Application Security Verification Standard Project
Application Security Verification Standard ProjectApplication Security Verification Standard Project
Application Security Verification Standard Project
 
Let's build Developer Portal with Backstage
Let's build Developer Portal with BackstageLet's build Developer Portal with Backstage
Let's build Developer Portal with Backstage
 
Secure Code Review 101
Secure Code Review 101Secure Code Review 101
Secure Code Review 101
 
DevSecOps and the CI/CD Pipeline
 DevSecOps and the CI/CD Pipeline DevSecOps and the CI/CD Pipeline
DevSecOps and the CI/CD Pipeline
 
Generic or Specific? Making Sensible Software Design Decisions
Generic or Specific? Making Sensible Software Design DecisionsGeneric or Specific? Making Sensible Software Design Decisions
Generic or Specific? Making Sensible Software Design Decisions
 
Shifting Security Left - The Innovation of DevSecOps - ValleyTechCon
Shifting Security Left - The Innovation of DevSecOps - ValleyTechConShifting Security Left - The Innovation of DevSecOps - ValleyTechCon
Shifting Security Left - The Innovation of DevSecOps - ValleyTechCon
 
Security in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps EngineersSecurity in CI/CD Pipelines: Tips for DevOps Engineers
Security in CI/CD Pipelines: Tips for DevOps Engineers
 
Technical Debt
Technical DebtTechnical Debt
Technical Debt
 
Exploiting XPC in AntiVirus
Exploiting XPC in AntiVirusExploiting XPC in AntiVirus
Exploiting XPC in AntiVirus
 
Jenkins vs GitLab CI
Jenkins vs GitLab CIJenkins vs GitLab CI
Jenkins vs GitLab CI
 
2019 DevSecOps Reference Architectures
2019 DevSecOps Reference Architectures2019 DevSecOps Reference Architectures
2019 DevSecOps Reference Architectures
 
OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)OWASP Top 10 2021 Presentation (Jul 2022)
OWASP Top 10 2021 Presentation (Jul 2022)
 
Get Smart About Technical Debt
Get Smart About Technical DebtGet Smart About Technical Debt
Get Smart About Technical Debt
 
[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities[DevSecOps Live] DevSecOps: Challenges and Opportunities
[DevSecOps Live] DevSecOps: Challenges and Opportunities
 
'How do you know that your product works?': Henrik Kniberg @ Colombo Agile Co...
'How do you know that your product works?': Henrik Kniberg @ Colombo Agile Co...'How do you know that your product works?': Henrik Kniberg @ Colombo Agile Co...
'How do you know that your product works?': Henrik Kniberg @ Colombo Agile Co...
 
ATT&CKING Containers in The Cloud
ATT&CKING Containers in The CloudATT&CKING Containers in The Cloud
ATT&CKING Containers in The Cloud
 
Clean architecture - Protecting the Domain
Clean architecture - Protecting the DomainClean architecture - Protecting the Domain
Clean architecture - Protecting the Domain
 
Code Review Best Practices
Code Review Best PracticesCode Review Best Practices
Code Review Best Practices
 
Slide DevSecOps Microservices
Slide DevSecOps Microservices Slide DevSecOps Microservices
Slide DevSecOps Microservices
 
DevSecOps reference architectures 2018
DevSecOps reference architectures 2018DevSecOps reference architectures 2018
DevSecOps reference architectures 2018
 

Similar a JUG CH December 2022 - Generic or specific?

Agile software development
Agile software developmentAgile software development
Agile software development
Hemangi Talele
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
Uwe Friedrichsen
 

Similar a JUG CH December 2022 - Generic or specific? (20)

Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisionsGeneric 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  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 Generic or specific? Making sensible software design decisions
Generic or specific? Making sensible software design decisions
 
Software Design
Software DesignSoftware Design
Software Design
 
Agile software development
Agile software developmentAgile software development
Agile software development
 
Agile Software Development.ppt
Agile Software Development.pptAgile Software Development.ppt
Agile Software Development.ppt
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
 
Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"Online TechTalk  "Patterns in Embedded SW Design"
Online TechTalk  "Patterns in Embedded SW Design"
 
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f..."Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
 
Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013
Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013
Neo4j Theory and Practice - Tareq Abedrabbo @ GraphConnect London 2013
 
Agile Technical Leadership
Agile Technical LeadershipAgile Technical Leadership
Agile Technical Leadership
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Clean code presentation
Clean code presentationClean code presentation
Clean code presentation
 
Excavating the knowledge of our ancestors
Excavating the knowledge of our ancestorsExcavating the knowledge of our ancestors
Excavating the knowledge of our ancestors
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Software design principles
Software design principlesSoftware design principles
Software design principles
 
The 360 Developer
The 360 DeveloperThe 360 Developer
The 360 Developer
 
Code quality
Code quality Code quality
Code quality
 
Cleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy ProjectsCleaning Code - Tools and Techniques for Large Legacy Projects
Cleaning Code - Tools and Techniques for Large Legacy Projects
 
It's XP, Stupid
It's XP, StupidIt's XP, Stupid
It's XP, Stupid
 

Último

AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
VictorSzoltysek
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
The Guide to Integrating Generative AI into Unified Continuous Testing Platfo...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456LEVEL 5   - SESSION 1 2023 (1).pptx - PDF 123456
LEVEL 5 - SESSION 1 2023 (1).pptx - PDF 123456
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
The Real-World Challenges of Medical Device Cybersecurity- Mitigating Vulnera...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 

JUG CH December 2022 - Generic or specific?

  • 1. bertjan@openvalue.eu Making sensible software design decisions Bert Jan Schrijver @bjschrijver Generic or specific?
  • 2. Bert Jan Schrijver L e t ’ s m e e t @bjschrijver
  • 3. Levels of generic vs specific Tools to help decide Flexibility in software Definitions When & why to go generic Sharing code in an organization Conclusion Outline W h a t ‘ s n e x t ? The cost of generic @bjschrijver
  • 5. • 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)
  • 6. • More flexible and reusable solution • Solution can be applied to a wide range of problems or scenarios • Generified solution that can be used in more than 1 place Generic solution (or design) Background source: https://filmquarterly.org/2012/07/02/i-robot-what-do-robots-dream-of/
  • 7. • Breaking a system or problem into smaller parts that are easier to understand • Example: Google search Hierarchical decomposition Background source: DALL·E
  • 9. • 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
  • 10. • Inheritance • Messages or events • Temporal • Data types • Data • Code / API (binary or source) Types of coupling Background source: DALL·E
  • 11. Be careful with coupling!
  • 12. Generic solution = coupling!
  • 13. The risk of DRY
  • 14. • 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
  • 15. About flexibility in software…
  • 16. “Highly specific code is often preferable to sophisticated configuration” - Stefan Tilkov
  • 17. 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
  • 18. • Code / class level • Library level • Data level • (Micro)service level • Organisation level Generic vs specific: levels Background source: DALL·E
  • 20. • Do we really need this now? (YAGNI) • Time/effort for generic vs specific • Myth of “first time right” • Complexity and scope • Future needs and evolution • The rule of three Tools to help decide
  • 21. • 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
  • 22. • 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 the lessons from the 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
  • 23. • Pass 1: YAGNI / rule of three: as simple and specific as possible • Pass 2: based on solution domain knowledge: is a generic solution less work? • Pass 3: based on problem domain knowledge: is the easiest solution actually correct? • Pass 4: looking at customer behaviour or other non technical considerations, does this change your decision? Design heuristics Background source: DALL·E
  • 24. • Concept from Domain Driven Design • Tool to help decide for generic vs specific • But more about building yourself or not • Subdomains: • Core domain • Supporting subdomain • Generic subdomain Strategic design Background source: GR Stocks on Unsplash
  • 25. • Organizations 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
  • 26. Conway’s law in action Background source: DALL·E
  • 27. • 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 overhead) The cost of a generic solution Background source: DALL·E
  • 28. What if you get it wrong? Photo: Dave Lehl
  • 29. • 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
  • 30. • 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
  • 31. When / why to go generic
  • 32. • ”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
  • 33. • 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
  • 34. • 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 standardization! Generic vs specific in different scopes Background source: Fernando Gomez on Unsplash
  • 35. Why specific is often faster
  • 38.
  • 39.
  • 40.
  • 41.
  • 42. Generic solutions on organization level
  • 43. • 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 organization Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
  • 44. • Challenges: • Refactoring • Versioning • Reviewing • Builds and codebase size - monorepo? Sharing code within an organization Source: https://medium.com/@jeffwhelpley/the-problem-with-shared-code-124a20fc3d3b
  • 45. • 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
  • 46. • 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
  • 48. • Consider: • YAGNI / Rule of three • Cost of generic • Scope / level • Conway’s law • Organization Generic or specific?
  • 50. 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
  • 53. Thanks for your time. Got feedback? Tweet it! All pictures belong to their respective authors @bjschrijver