SlideShare a Scribd company logo
A Philosophy of
Software Design
Diego Pacheco
Just read it...
As time goes by...
It's all about Complexity
Complexity is related to Structure which makes complex to Understand and Modify.
It's all about Complexity
Symptoms of Complexity
❏ Change Amplification
❏ Change require change in many different places
❏ Cognitive Load
❏ Sometimes more lines of code is better -- because is simple to
understand.
❏ Unknown Unknowns
❏ Not obvious places need to be modified for a change
Working code is not enough
Deep Modules (opposite from clean-code “small”)
Deep Modules & Simple Interfaces
❏ Modules should be Deep
❏ Classes are modules
❏ Classes should be Deep
❏ Classitis: Disease when you have too many classes.
❏ FAT Classes hide information
❏ When Interface is similar to impl means it's shallow
Pull Complexity Downwards
“It's more important to a
module to have a simple
interface than a simple
implementation”.
Obscurity
❏ A Great Source of Complexity
❏ Obscure code is:
❏ Hard to Understand
❏ Creates more Bugs
❏ Generic|Event-Drive makes code Obscure
❏ Solution to Obscurity
❏ Always write obvious code
❏ Obvious Code Means:
❏ Read Quickly without much thought
❏ Easy to guess what code does
❏ Guess Should be Write
❏ Precise and meaningful
Code Review is the n#1
tool to fight Obscurity
Information Hiding and Leakage
❏ Information Hiding
❏ Encapsulate pieces of knowledge
❏ Information Package
❏ Knowledge in multiples places/classes
❏ Red Flag - Overexposure
❏ Red Flag - Temporal decomposition - execution order is reflected on code
structure. Operations that happen in different times are in different classes
(results in Leakage).
❏ Too Many Classes
❏ Divide the code in too many shallow classes (Leakage)
Different Layers Different Abstractions
❏ Red Flag: Pass-Through Method
❏ Does nothing but pass args to other method.
❏ Decorators Sucks
❏ Don't add much value
❏ Easier to change the original implementation
❏ Creates shallow modules
Better together or Better apart
❏ Bring Together:
❏ IF Information is shared
❏ IF will simplify the interface
❏ To eliminate duplication
❏ Separate
❏ General Purpose (1 generic code)
❏ Specific Purpose
❏ Red Flag: Repetition (same/similar code over-and-over means you have wrong
abstraction)
❏ Red Flag: Special-General Mixture (Leakage)
Each method should do one thing and do it completely
Red Flag: Conjoined Methods (Need other methods to understand 1 method).
Define Errors out of Existence
❏ Exceptions add complexity and one of the worst sources of complexity
❏ Exception handling code is more difficult to write than normal code.
❏ A piece of code might found exceptions in different ways:
❏ Caller may provide bad arguments or configuration
❏ Invoked method may not be able to complete the request
❏ In distributed systems network packets may be lost or delayed or peers
communicate in unexpected ways
❏ The code may detect bugs or internal inconsistencies or situations that are
not prepared to handle.
Define Errors out of Existence
❏ Exception handling code creates more opportunities for Exceptions to happen.
❏ Language support for exception is verbose
❏ Too Many Exceptions
❏ Classes with lots of exceptions have complex interfaces
❏ Reduce the number of places that exception should be handled
❏ Best way to reduce bugs is to make code simpler
Writing Comments
❏ Writing comments correct will improve the design
❏ IF Users need to read method code to use it, there is no abstraction
❏ Comments that get out of date become misleading
❏ Comments should describe things that are not obvious on the code
❏ Best Practices:
❏ Pick Conventions
❏ Don't repeat the code
❏ Higher level comments enhance intuition
❏ Delayed comments are bad comments
❏ Use Comments as Design Tool
Naming
❏ Bad Names cause Bugs
❏ Create an image (name should create a image on mind of the
reader about the nature of the thing being named).
❏ Names should be precise
❏ Use Names consistently
❏ Different Opinion Go Style Guide.
❏ Short
❏ Single character
❏ Long names obscure what code does
Closing thoughts
❏ Getters / Setters are shallow ~ Avoid as much as possible
❏ Agile could easily lead to tactical programing
❏ TDD Focus on getting specific features working rather than have a better design.
❏ General Risk of Design Patterns == Over Application
❏ More Design Patterns does not make the design better
Design Principles & Red Flags
A Philosophy of
Software Design
Diego Pacheco

More Related Content

What's hot

Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
Victor Rentea
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
kim.mens
 
Clean Code
Clean CodeClean Code
Clean Code
Hendrik Ebel
 
Clean code
Clean codeClean code
Clean code
NadiiaVlasenko
 
Clean Code
Clean CodeClean Code
Clean Code
Victor Rentea
 
Clean Code I - Best Practices
Clean Code I - Best PracticesClean Code I - Best Practices
Clean Code I - Best Practices
Theo Jungeblut
 
Conditions In C# C-Sharp
Conditions In C# C-SharpConditions In C# C-Sharp
Conditions In C# C-Sharp
Abid Kohistani
 
Solid principles
Solid principlesSolid principles
Solid principles
Dmitry Kandalov
 
Clean code
Clean codeClean code
Clean code
Mahmoud Zizo
 
Clean code
Clean codeClean code
Clean code
ifnu bima
 
Clean Code
Clean CodeClean Code
Clean Code
Dmytro Turskyi
 
Coding standard and coding guideline
Coding standard and coding guidelineCoding standard and coding guideline
Coding standard and coding guideline
Dhananjaysinh Jhala
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
Bo-Yi Wu
 
Clean code
Clean codeClean code
Clean code
Knoldus Inc.
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
Emertxe Information Technologies Pvt Ltd
 
Clean code
Clean codeClean code
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
Geeks Anonymes
 
C language
C languageC language
C language
Priya698357
 
Clean Code 閱讀心得
Clean Code 閱讀心得Clean Code 閱讀心得
Clean Code 閱讀心得
Jz Chang
 

What's hot (20)

Clean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a MonolithClean Pragmatic Architecture - Avoiding a Monolith
Clean Pragmatic Architecture - Avoiding a Monolith
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Clean Code
Clean CodeClean Code
Clean Code
 
Clean code
Clean codeClean code
Clean code
 
Clean Code
Clean CodeClean Code
Clean Code
 
Clean Code I - Best Practices
Clean Code I - Best PracticesClean Code I - Best Practices
Clean Code I - Best Practices
 
Conditions In C# C-Sharp
Conditions In C# C-SharpConditions In C# C-Sharp
Conditions In C# C-Sharp
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Clean code
Clean codeClean code
Clean code
 
Clean code
Clean codeClean code
Clean code
 
Chapter17 of clean code
Chapter17 of clean codeChapter17 of clean code
Chapter17 of clean code
 
Clean Code
Clean CodeClean Code
Clean Code
 
Coding standard and coding guideline
Coding standard and coding guidelineCoding standard and coding guideline
Coding standard and coding guideline
 
Write microservice in golang
Write microservice in golangWrite microservice in golang
Write microservice in golang
 
Clean code
Clean codeClean code
Clean code
 
Linux Internals - Part III
Linux Internals - Part IIILinux Internals - Part III
Linux Internals - Part III
 
Clean code
Clean codeClean code
Clean code
 
Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)Modern c++ (C++ 11/14)
Modern c++ (C++ 11/14)
 
C language
C languageC language
C language
 
Clean Code 閱讀心得
Clean Code 閱讀心得Clean Code 閱讀心得
Clean Code 閱讀心得
 

Similar to A philosophy of software design

Software Design Notes
Software Design NotesSoftware Design Notes
Software Design Notes
Diego Pacheco
 
Clean code
Clean code Clean code
Clean code
Achintya Kumar
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
David Robert Camargo de Campos
 
Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!
Diego Pacheco
 
How to code
How to codeHow to code
How to code
Shishir Sharma
 
Writing Readable Code
Writing Readable CodeWriting Readable Code
Writing Readable Code
eddiehaber
 
Style & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & StructureStyle & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & Structure
Nick Pruehs
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential SkillsJohn Choi
 
The Death of Microservices
The Death of MicroservicesThe Death of Microservices
The Death of Microservices
Diego Pacheco
 
Crafty communications - Dealing with the pesky people parts of communications
Crafty communications - Dealing with the pesky people parts of communicationsCrafty communications - Dealing with the pesky people parts of communications
Crafty communications - Dealing with the pesky people parts of communications
Asher Glynn
 
Extracts from "Clean Code"
Extracts from "Clean Code"Extracts from "Clean Code"
Extracts from "Clean Code"
VlatkaPavii
 
Extracts from "Clean Code"
Extracts from "Clean Code"Extracts from "Clean Code"
Extracts from "Clean Code"
VlatkaPavii
 
DRY or die
DRY or dieDRY or die
DRY or die
Eyal Kenig
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
khushbu thakker
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languageselliando dias
 
Code Smells - Refactoring
Code Smells - RefactoringCode Smells - Refactoring
Code Smells - Refactoring
Shobi P P
 
Code Smells
Code SmellsCode Smells
Code Smell and Refactoring
Code Smell and RefactoringCode Smell and Refactoring
Code Smell and Refactoring
kimsrung lov
 
Code Quality
Code QualityCode Quality
Code Quality
Stephen Rodgers
 

Similar to A philosophy of software design (20)

Software Design Notes
Software Design NotesSoftware Design Notes
Software Design Notes
 
Clean code
Clean code Clean code
Clean code
 
An introduction to programming in Go
An introduction to programming in GoAn introduction to programming in Go
An introduction to programming in Go
 
Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!Naming Things Book : Simple Book Review!
Naming Things Book : Simple Book Review!
 
How to code
How to codeHow to code
How to code
 
Writing Readable Code
Writing Readable CodeWriting Readable Code
Writing Readable Code
 
Style & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & StructureStyle & Design Principles 01 - Code Style & Structure
Style & Design Principles 01 - Code Style & Structure
 
Why You're A Bad PHP Programmer
Why You're A Bad PHP ProgrammerWhy You're A Bad PHP Programmer
Why You're A Bad PHP Programmer
 
Software Development Essential Skills
Software Development Essential SkillsSoftware Development Essential Skills
Software Development Essential Skills
 
The Death of Microservices
The Death of MicroservicesThe Death of Microservices
The Death of Microservices
 
Crafty communications - Dealing with the pesky people parts of communications
Crafty communications - Dealing with the pesky people parts of communicationsCrafty communications - Dealing with the pesky people parts of communications
Crafty communications - Dealing with the pesky people parts of communications
 
Extracts from "Clean Code"
Extracts from "Clean Code"Extracts from "Clean Code"
Extracts from "Clean Code"
 
Extracts from "Clean Code"
Extracts from "Clean Code"Extracts from "Clean Code"
Extracts from "Clean Code"
 
DRY or die
DRY or dieDRY or die
DRY or die
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
 
Domain Specific Languages
Domain Specific LanguagesDomain Specific Languages
Domain Specific Languages
 
Code Smells - Refactoring
Code Smells - RefactoringCode Smells - Refactoring
Code Smells - Refactoring
 
Code Smells
Code SmellsCode Smells
Code Smells
 
Code Smell and Refactoring
Code Smell and RefactoringCode Smell and Refactoring
Code Smell and Refactoring
 
Code Quality
Code QualityCode Quality
Code Quality
 

More from Diego Pacheco

Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdf
Diego Pacheco
 
Thoughts about Shape Up
Thoughts about Shape UpThoughts about Shape Up
Thoughts about Shape Up
Diego Pacheco
 
Holacracy
HolacracyHolacracy
Holacracy
Diego Pacheco
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
Diego Pacheco
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep Dive
Diego Pacheco
 
Sec 101
Sec 101Sec 101
Sec 101
Diego Pacheco
 
Reflections on SCM
Reflections on SCMReflections on SCM
Reflections on SCM
Diego Pacheco
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! III
Diego Pacheco
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not Subjective
Diego Pacheco
 
Architecture & Engineering : Doing the non-obvious!
Architecture & Engineering :  Doing the non-obvious!Architecture & Engineering :  Doing the non-obvious!
Architecture & Engineering : Doing the non-obvious!
Diego Pacheco
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II
Diego Pacheco
 
Testing in production
Testing in productionTesting in production
Testing in production
Diego Pacheco
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about work
Diego Pacheco
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!
Diego Pacheco
 
AI and the Future
AI and the FutureAI and the Future
AI and the Future
Diego Pacheco
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependencies
Diego Pacheco
 
Dealing with dependencies in tests
Dealing  with dependencies in testsDealing  with dependencies in tests
Dealing with dependencies in tests
Diego Pacheco
 
Kanban 2020
Kanban 2020Kanban 2020
Kanban 2020
Diego Pacheco
 
Lean 2020
Lean 2020Lean 2020
Lean 2020
Diego Pacheco
 

More from Diego Pacheco (20)

Continuous Discovery Habits Book Review.pdf
Continuous Discovery Habits  Book Review.pdfContinuous Discovery Habits  Book Review.pdf
Continuous Discovery Habits Book Review.pdf
 
Thoughts about Shape Up
Thoughts about Shape UpThoughts about Shape Up
Thoughts about Shape Up
 
Holacracy
HolacracyHolacracy
Holacracy
 
AWS IAM
AWS IAMAWS IAM
AWS IAM
 
CDKs
CDKsCDKs
CDKs
 
Encryption Deep Dive
Encryption Deep DiveEncryption Deep Dive
Encryption Deep Dive
 
Sec 101
Sec 101Sec 101
Sec 101
 
Reflections on SCM
Reflections on SCMReflections on SCM
Reflections on SCM
 
Management: Doing the non-obvious! III
Management: Doing the non-obvious! IIIManagement: Doing the non-obvious! III
Management: Doing the non-obvious! III
 
Design is not Subjective
Design is not SubjectiveDesign is not Subjective
Design is not Subjective
 
Architecture & Engineering : Doing the non-obvious!
Architecture & Engineering :  Doing the non-obvious!Architecture & Engineering :  Doing the non-obvious!
Architecture & Engineering : Doing the non-obvious!
 
Management doing the non-obvious II
Management doing the non-obvious II Management doing the non-obvious II
Management doing the non-obvious II
 
Testing in production
Testing in productionTesting in production
Testing in production
 
Nine lies about work
Nine lies about workNine lies about work
Nine lies about work
 
Management: doing the nonobvious!
Management: doing the nonobvious!Management: doing the nonobvious!
Management: doing the nonobvious!
 
AI and the Future
AI and the FutureAI and the Future
AI and the Future
 
Dealing with dependencies
Dealing  with dependenciesDealing  with dependencies
Dealing with dependencies
 
Dealing with dependencies in tests
Dealing  with dependencies in testsDealing  with dependencies in tests
Dealing with dependencies in tests
 
Kanban 2020
Kanban 2020Kanban 2020
Kanban 2020
 
Lean 2020
Lean 2020Lean 2020
Lean 2020
 

Recently uploaded

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
Guy Korland
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
Neo4j
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
Jemma Hussein Allen
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Aggregage
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
Aftab Hussain
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
nkrafacyberclub
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems S.M.S.A.
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
Ralf Eggert
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
DianaGray10
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
DanBrown980551
 

Recently uploaded (20)

Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
GraphSummit Singapore | Enhancing Changi Airport Group's Passenger Experience...
 
The Future of Platform Engineering
The Future of Platform EngineeringThe Future of Platform Engineering
The Future of Platform Engineering
 
Generative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to ProductionGenerative AI Deep Dive: Advancing from Proof of Concept to Production
Generative AI Deep Dive: Advancing from Proof of Concept to Production
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
Removing Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software FuzzingRemoving Uninteresting Bytes in Software Fuzzing
Removing Uninteresting Bytes in Software Fuzzing
 
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptxSecstrike : Reverse Engineering & Pwnable tools for CTF.pptx
Secstrike : Reverse Engineering & Pwnable tools for CTF.pptx
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Uni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdfUni Systems Copilot event_05062024_C.Vlachos.pdf
Uni Systems Copilot event_05062024_C.Vlachos.pdf
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdfFIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
FIDO Alliance Osaka Seminar: FIDO Security Aspects.pdf
 
PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)PHP Frameworks: I want to break free (IPC Berlin 2024)
PHP Frameworks: I want to break free (IPC Berlin 2024)
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4UiPath Test Automation using UiPath Test Suite series, part 4
UiPath Test Automation using UiPath Test Suite series, part 4
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...
 

A philosophy of software design

  • 1. A Philosophy of Software Design Diego Pacheco
  • 2.
  • 4. As time goes by...
  • 5. It's all about Complexity Complexity is related to Structure which makes complex to Understand and Modify.
  • 6. It's all about Complexity Symptoms of Complexity ❏ Change Amplification ❏ Change require change in many different places ❏ Cognitive Load ❏ Sometimes more lines of code is better -- because is simple to understand. ❏ Unknown Unknowns ❏ Not obvious places need to be modified for a change
  • 7. Working code is not enough
  • 8. Deep Modules (opposite from clean-code “small”)
  • 9. Deep Modules & Simple Interfaces ❏ Modules should be Deep ❏ Classes are modules ❏ Classes should be Deep ❏ Classitis: Disease when you have too many classes. ❏ FAT Classes hide information ❏ When Interface is similar to impl means it's shallow
  • 10. Pull Complexity Downwards “It's more important to a module to have a simple interface than a simple implementation”.
  • 11. Obscurity ❏ A Great Source of Complexity ❏ Obscure code is: ❏ Hard to Understand ❏ Creates more Bugs ❏ Generic|Event-Drive makes code Obscure ❏ Solution to Obscurity ❏ Always write obvious code ❏ Obvious Code Means: ❏ Read Quickly without much thought ❏ Easy to guess what code does ❏ Guess Should be Write ❏ Precise and meaningful Code Review is the n#1 tool to fight Obscurity
  • 12. Information Hiding and Leakage ❏ Information Hiding ❏ Encapsulate pieces of knowledge ❏ Information Package ❏ Knowledge in multiples places/classes ❏ Red Flag - Overexposure ❏ Red Flag - Temporal decomposition - execution order is reflected on code structure. Operations that happen in different times are in different classes (results in Leakage). ❏ Too Many Classes ❏ Divide the code in too many shallow classes (Leakage)
  • 13. Different Layers Different Abstractions ❏ Red Flag: Pass-Through Method ❏ Does nothing but pass args to other method. ❏ Decorators Sucks ❏ Don't add much value ❏ Easier to change the original implementation ❏ Creates shallow modules
  • 14. Better together or Better apart ❏ Bring Together: ❏ IF Information is shared ❏ IF will simplify the interface ❏ To eliminate duplication ❏ Separate ❏ General Purpose (1 generic code) ❏ Specific Purpose ❏ Red Flag: Repetition (same/similar code over-and-over means you have wrong abstraction) ❏ Red Flag: Special-General Mixture (Leakage)
  • 15. Each method should do one thing and do it completely Red Flag: Conjoined Methods (Need other methods to understand 1 method).
  • 16. Define Errors out of Existence ❏ Exceptions add complexity and one of the worst sources of complexity ❏ Exception handling code is more difficult to write than normal code. ❏ A piece of code might found exceptions in different ways: ❏ Caller may provide bad arguments or configuration ❏ Invoked method may not be able to complete the request ❏ In distributed systems network packets may be lost or delayed or peers communicate in unexpected ways ❏ The code may detect bugs or internal inconsistencies or situations that are not prepared to handle.
  • 17. Define Errors out of Existence ❏ Exception handling code creates more opportunities for Exceptions to happen. ❏ Language support for exception is verbose ❏ Too Many Exceptions ❏ Classes with lots of exceptions have complex interfaces ❏ Reduce the number of places that exception should be handled ❏ Best way to reduce bugs is to make code simpler
  • 18. Writing Comments ❏ Writing comments correct will improve the design ❏ IF Users need to read method code to use it, there is no abstraction ❏ Comments that get out of date become misleading ❏ Comments should describe things that are not obvious on the code ❏ Best Practices: ❏ Pick Conventions ❏ Don't repeat the code ❏ Higher level comments enhance intuition ❏ Delayed comments are bad comments ❏ Use Comments as Design Tool
  • 19. Naming ❏ Bad Names cause Bugs ❏ Create an image (name should create a image on mind of the reader about the nature of the thing being named). ❏ Names should be precise ❏ Use Names consistently ❏ Different Opinion Go Style Guide. ❏ Short ❏ Single character ❏ Long names obscure what code does
  • 20. Closing thoughts ❏ Getters / Setters are shallow ~ Avoid as much as possible ❏ Agile could easily lead to tactical programing ❏ TDD Focus on getting specific features working rather than have a better design. ❏ General Risk of Design Patterns == Over Application ❏ More Design Patterns does not make the design better
  • 21. Design Principles & Red Flags
  • 22. A Philosophy of Software Design Diego Pacheco