Code design

Code Design: Back to Basic
Hosein Ghahramanzadeh
Abstractions: What is a chair?
Abstractions: Is this a chair?
Abstractions: Is this a chair?
Abstractions: Is this a chair?
Abstractions: Or is this a chair?
Abstractions: What is a car?
Abstraction: Is this a car?
Abstraction: Or is this a car?
Abstraction: What we do all the time!
• Abstraction is to figure out what changes and what doesn’t over the
set of all concrete instances
• To identify one thing with a name, is to abstract it
• Is to identify what is invariant and ignore the rest
• Invariants are what we make public in our code, they will not change
Abstraction: Dictionary!
• A dictionary provides definition
for words
• A definition for a word is the list
of that concept’s invariants
Abstraction: Name things properly
• A proper name conveys a proper definition that is often commonly
shared and thoughtfully developed overtime
• A proper definition provides a proper list of invariants
• This is why we need to properly name our entities in software
Software Architecture: What is it?
• Architecture is the proper abstraction of a problem
• Proper is easy to implement in the programming language, efficient,
and infallible (there often is more criteria to meet)
• Infallible is often what is factually correct.
Software Architecture: What makes it
difficult?
• Often trade-offs are necessary as not all might be achievable at the
same time
• Architect optimizes over these variables
• These could be differently weighted depending on the problem
• Often efficiency disallows factually correct abstraction of problems
Software Architecture: What makes a good
programming language?
• A good language allows better optimization over these variables
• In problems with less emphasis on efficiency, higher level languages
may prove more effective as they allow more factually correct
abstractions
Software Architecture: How it fails!
• Of the aforementioned criteria, efficiency can be optimized later on in
implementation
• Easy to implement is often a non-issue, however in the lack of skilled
human resources, it is
• Factual correctness often is the cause for large scale refactoring, or
code rewrites due to architecture failure
Software Architecture: When does it fail?
• Architecture often fails when new features arrive
• Failure in ease of implementation is detectable while implementing
• Failure in efficiency is detectable right after implementation with
performance tests
• Factual correctness of the abstractions fails when unexpected cases
arrive, often with new features
• This is often because your abstractions contradicts with parts of itself
• Reality never contradicts with itself, implement as much of the
factually know reality as possible
Software Architecture: How not to fail!
• Be consistent with the real world, as much as possible
• Don’t assume things on yourself, your assumption could result in
wrong invariants
• Know your language well
• Know your intent well
• Implement your intent
Programing language: The friend
• A language is a means of communicating meanings
• A programmer is just as much of a writer as a writer is
• A writer transfers his intents well, only relying on his good grasp of
the language
• A piece of code is a writing that has two separate audience,
computers and humans (well a sort of them, programmers!)
• A good grasp of the language is necessary for proper implementation
of intent
• The language use in teams are often culturally effected, teach and
learn the culture to avoid drastic code rewrites
Programing language: The enemy
• A programming language can lean towards either computers, or
humans too disproportionately
• Can hurt the computer by degrading the performance, a computer
performs more efficiently if the intent is well understood
• Can hurt the programmer by making development, and maintenance
unbearable
• Bad cultures maintained well can result in painful code maintenance
• Find the bad cultures and eradicate them
Programing language: Humane
• Just as humans, a programming language is never perfect
• Often when you don’t implement your intent, you desire to
implement your intent but the language simply doesn’t allow it
• Compromise more on higher levels of abstraction rather than the
lower
• Higher levels of abstraction often effect larger areas of the code
• Lower levels often effect less amount of code
• The less amount effected by the code the easier the change, rewrite,
and refactoring tasks
Programming language: ASM, Machine
language?
• This is a language that in the spectrum leans completely towards
computers
• The best tool to convey intents to computers
• Not really a good one for humans, is it
• Also not all computers talk the same
Programming language: C++, My beloved so
far
• Tries to maintain a good trade off between humans and computers
• Falls short sometimes in communication with humans
• Template meta-programming certainly worked well with computers,
not so well with humans
• Unique pointers seemingly do well with humans, but in some cases
that inlining isn’t available they seem to fall short to convey intent to
computers
• The committee responds to these by figuring out the most prevalent
cause of unease in communications and remedies them by new
features, e.g. constexpr
Code: The case of the chair
Code: No chair can grow legs? Chair races
don’t combine?
Code: No weird legs! Bigotry makes life easier
for our developers!
Code: Only four legged chairs allowed, we
love our CPU cycles!
Questions?
1 de 28

Recomendados

Clean code por
Clean codeClean code
Clean codeAgniGonalves
60 vistas7 diapositivas
Lecture 25 por
Lecture 25Lecture 25
Lecture 25Skillspire LLC
69 vistas12 diapositivas
Lecture 24 por
Lecture 24Lecture 24
Lecture 24Skillspire LLC
72 vistas30 diapositivas
Lecture 31 por
Lecture 31Lecture 31
Lecture 31Skillspire LLC
80 vistas6 diapositivas
عرض أ فاطمة الظاعن por
عرض أ فاطمة الظاعنعرض أ فاطمة الظاعن
عرض أ فاطمة الظاعنTechnodisability Conference
179 vistas22 diapositivas
Captioning Best Practices for Engagement por
Captioning Best Practices for EngagementCaptioning Best Practices for Engagement
Captioning Best Practices for Engagement3Play Media
5.9K vistas54 diapositivas

Más contenido relacionado

La actualidad más candente

Behavior Driven Development por
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven DevelopmentTomCooley
434 vistas13 diapositivas
Programming assignment help by myassignmenthelp por
Programming assignment help by myassignmenthelpProgramming assignment help by myassignmenthelp
Programming assignment help by myassignmenthelpwww.myassignmenthelp.net
691 vistas16 diapositivas
Technical interview mc govern por
Technical interview   mc governTechnical interview   mc govern
Technical interview mc governCopper CLE
139 vistas8 diapositivas
1. reason why study spl por
1. reason why study spl1. reason why study spl
1. reason why study splZambales National High School
172 vistas18 diapositivas
Agile Software Development por
Agile Software DevelopmentAgile Software Development
Agile Software DevelopmentAhmet Bulut
387 vistas38 diapositivas
Software development fundamentals por
Software development fundamentalsSoftware development fundamentals
Software development fundamentalsAlfred Jett Grandeza
495 vistas41 diapositivas

La actualidad más candente(20)

Behavior Driven Development por TomCooley
Behavior Driven DevelopmentBehavior Driven Development
Behavior Driven Development
TomCooley434 vistas
Technical interview mc govern por Copper CLE
Technical interview   mc governTechnical interview   mc govern
Technical interview mc govern
Copper CLE 139 vistas
Agile Software Development por Ahmet Bulut
Agile Software DevelopmentAgile Software Development
Agile Software Development
Ahmet Bulut387 vistas
How does intellisense work? por Adam Friedman
How does intellisense work?How does intellisense work?
How does intellisense work?
Adam Friedman144 vistas
The Next Phase Android Bangla KeyBoard por Kaidul Islam
The Next Phase Android Bangla KeyBoardThe Next Phase Android Bangla KeyBoard
The Next Phase Android Bangla KeyBoard
Kaidul Islam5.4K vistas
Designing a press and swipe type single layered bangla soft keyboard for andr... por Kaidul Islam
Designing a press and swipe type single layered bangla soft keyboard for andr...Designing a press and swipe type single layered bangla soft keyboard for andr...
Designing a press and swipe type single layered bangla soft keyboard for andr...
Kaidul Islam2.8K vistas
How to hire a hacker por RTigger
How to hire a hackerHow to hire a hacker
How to hire a hacker
RTigger1.6K vistas
Speech recognition por fluffyemily
Speech recognitionSpeech recognition
Speech recognition
fluffyemily1.1K vistas
Quick Start to Captioning por 3Play Media
Quick Start to Captioning Quick Start to Captioning
Quick Start to Captioning
3Play Media885 vistas
High Level Languages (Imperative, Object Orientated, Declarative) por Project Student
High Level Languages (Imperative, Object Orientated, Declarative)High Level Languages (Imperative, Object Orientated, Declarative)
High Level Languages (Imperative, Object Orientated, Declarative)
Project Student5K vistas
MT and Translator's Tools por Jim O'Regan
MT and Translator's ToolsMT and Translator's Tools
MT and Translator's Tools
Jim O'Regan1.7K vistas
Dancing for a product release por Laurent Cerveau
Dancing for a product releaseDancing for a product release
Dancing for a product release
Laurent Cerveau7.2K vistas
" PROGRAMMING LANGUAGE " with MOHSIN por MOHSIN BANGI
" PROGRAMMING LANGUAGE " with MOHSIN" PROGRAMMING LANGUAGE " with MOHSIN
" PROGRAMMING LANGUAGE " with MOHSIN
MOHSIN BANGI74 vistas

Similar a Code design

Agile software development por
Agile software developmentAgile software development
Agile software developmentHemangi Talele
368 vistas42 diapositivas
PCEP Module 1.pptx por
PCEP Module 1.pptxPCEP Module 1.pptx
PCEP Module 1.pptxzakariaHujale
14 vistas37 diapositivas
Agile Software Development.ppt por
Agile Software Development.pptAgile Software Development.ppt
Agile Software Development.pptabdulwehab2
4 vistas42 diapositivas
CPP01 - Introduction to C++ por
CPP01 - Introduction to C++CPP01 - Introduction to C++
CPP01 - Introduction to C++Michael Heron
282 vistas23 diapositivas
How to Implement Domain Driven Design in Real Life SDLC por
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLCAbdul Karim
3.3K vistas70 diapositivas
Computer programming por
Computer programmingComputer programming
Computer programmingSujay Raj
592 vistas23 diapositivas

Similar a Code design(20)

Agile Software Development.ppt por abdulwehab2
Agile Software Development.pptAgile Software Development.ppt
Agile Software Development.ppt
abdulwehab24 vistas
CPP01 - Introduction to C++ por Michael Heron
CPP01 - Introduction to C++CPP01 - Introduction to C++
CPP01 - Introduction to C++
Michael Heron282 vistas
How to Implement Domain Driven Design in Real Life SDLC por Abdul Karim
How to Implement Domain Driven Design  in Real Life SDLCHow to Implement Domain Driven Design  in Real Life SDLC
How to Implement Domain Driven Design in Real Life SDLC
Abdul Karim3.3K vistas
Computer programming por Sujay Raj
Computer programmingComputer programming
Computer programming
Sujay Raj592 vistas
Programming Languages #devcon2013 por Iván Montes
Programming Languages #devcon2013Programming Languages #devcon2013
Programming Languages #devcon2013
Iván Montes1.2K vistas
NLP.ppt por kakeko3
NLP.pptNLP.ppt
NLP.ppt
kakeko35 vistas
Types Of Coding Languages: A Complete Guide To Master Programming por calltutors
Types Of Coding Languages: A Complete Guide To Master ProgrammingTypes Of Coding Languages: A Complete Guide To Master Programming
Types Of Coding Languages: A Complete Guide To Master Programming
calltutors99 vistas
What Is Coding And Why Should You Learn It? por Syed Hassan Raza
What Is Coding And Why Should You Learn It?What Is Coding And Why Should You Learn It?
What Is Coding And Why Should You Learn It?
Syed Hassan Raza355 vistas

Último

MariaDB stored procedures and why they should be improved por
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improvedFederico Razzoli
8 vistas32 diapositivas
Citi TechTalk Session 2: Kafka Deep Dive por
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Diveconfluent
17 vistas60 diapositivas
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... por
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...Deltares
6 vistas15 diapositivas
Copilot Prompting Toolkit_All Resources.pdf por
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdfRiccardo Zamana
6 vistas4 diapositivas
Roadmap y Novedades de producto por
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de productoNeo4j
50 vistas33 diapositivas
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... por
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...HCLSoftware
6 vistas2 diapositivas

Último(20)

MariaDB stored procedures and why they should be improved por Federico Razzoli
MariaDB stored procedures and why they should be improvedMariaDB stored procedures and why they should be improved
MariaDB stored procedures and why they should be improved
Federico Razzoli8 vistas
Citi TechTalk Session 2: Kafka Deep Dive por confluent
Citi TechTalk Session 2: Kafka Deep DiveCiti TechTalk Session 2: Kafka Deep Dive
Citi TechTalk Session 2: Kafka Deep Dive
confluent17 vistas
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -... por Deltares
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
DSD-INT 2023 Simulating a falling apron in Delft3D 4 - Engineering Practice -...
Deltares6 vistas
Copilot Prompting Toolkit_All Resources.pdf por Riccardo Zamana
Copilot Prompting Toolkit_All Resources.pdfCopilot Prompting Toolkit_All Resources.pdf
Copilot Prompting Toolkit_All Resources.pdf
Riccardo Zamana6 vistas
Roadmap y Novedades de producto por Neo4j
Roadmap y Novedades de productoRoadmap y Novedades de producto
Roadmap y Novedades de producto
Neo4j50 vistas
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut... por HCLSoftware
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
Elevate your SAP landscape's efficiency and performance with HCL Workload Aut...
HCLSoftware6 vistas
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)... por Deltares
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
DSD-INT 2023 Modelling litter in the Yarra and Maribyrnong Rivers (Australia)...
Deltares9 vistas
Navigating container technology for enhanced security by Niklas Saari por Metosin Oy
Navigating container technology for enhanced security by Niklas SaariNavigating container technology for enhanced security by Niklas Saari
Navigating container technology for enhanced security by Niklas Saari
Metosin Oy8 vistas
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon por Deltares
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - AfternoonDSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
DSD-INT 2023 - Delft3D User Days - Welcome - Day 3 - Afternoon
Deltares13 vistas
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit... por Deltares
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
DSD-INT 2023 FloodAdapt - A decision-support tool for compound flood risk mit...
Deltares13 vistas
Headless JS UG Presentation.pptx por Jack Spektor
Headless JS UG Presentation.pptxHeadless JS UG Presentation.pptx
Headless JS UG Presentation.pptx
Jack Spektor7 vistas
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko... por Deltares
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
DSD-INT 2023 Simulation of Coastal Hydrodynamics and Water Quality in Hong Ko...
Deltares11 vistas
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ... por Donato Onofri
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Unmasking the Dark Art of Vectored Exception Handling: Bypassing XDR and EDR ...
Donato Onofri711 vistas
SUGCON ANZ Presentation V2.1 Final.pptx por Jack Spektor
SUGCON ANZ Presentation V2.1 Final.pptxSUGCON ANZ Presentation V2.1 Final.pptx
SUGCON ANZ Presentation V2.1 Final.pptx
Jack Spektor22 vistas
Fleet Management Software in India por Fleetable
Fleet Management Software in India Fleet Management Software in India
Fleet Management Software in India
Fleetable11 vistas
Software evolution understanding: Automatic extraction of software identifier... por Ra'Fat Al-Msie'deen
Software evolution understanding: Automatic extraction of software identifier...Software evolution understanding: Automatic extraction of software identifier...
Software evolution understanding: Automatic extraction of software identifier...
Advanced API Mocking Techniques por Dimpy Adhikary
Advanced API Mocking TechniquesAdvanced API Mocking Techniques
Advanced API Mocking Techniques
Dimpy Adhikary19 vistas

Code design

  • 1. Code Design: Back to Basic Hosein Ghahramanzadeh
  • 6. Abstractions: Or is this a chair?
  • 9. Abstraction: Or is this a car?
  • 10. Abstraction: What we do all the time! • Abstraction is to figure out what changes and what doesn’t over the set of all concrete instances • To identify one thing with a name, is to abstract it • Is to identify what is invariant and ignore the rest • Invariants are what we make public in our code, they will not change
  • 11. Abstraction: Dictionary! • A dictionary provides definition for words • A definition for a word is the list of that concept’s invariants
  • 12. Abstraction: Name things properly • A proper name conveys a proper definition that is often commonly shared and thoughtfully developed overtime • A proper definition provides a proper list of invariants • This is why we need to properly name our entities in software
  • 13. Software Architecture: What is it? • Architecture is the proper abstraction of a problem • Proper is easy to implement in the programming language, efficient, and infallible (there often is more criteria to meet) • Infallible is often what is factually correct.
  • 14. Software Architecture: What makes it difficult? • Often trade-offs are necessary as not all might be achievable at the same time • Architect optimizes over these variables • These could be differently weighted depending on the problem • Often efficiency disallows factually correct abstraction of problems
  • 15. Software Architecture: What makes a good programming language? • A good language allows better optimization over these variables • In problems with less emphasis on efficiency, higher level languages may prove more effective as they allow more factually correct abstractions
  • 16. Software Architecture: How it fails! • Of the aforementioned criteria, efficiency can be optimized later on in implementation • Easy to implement is often a non-issue, however in the lack of skilled human resources, it is • Factual correctness often is the cause for large scale refactoring, or code rewrites due to architecture failure
  • 17. Software Architecture: When does it fail? • Architecture often fails when new features arrive • Failure in ease of implementation is detectable while implementing • Failure in efficiency is detectable right after implementation with performance tests • Factual correctness of the abstractions fails when unexpected cases arrive, often with new features • This is often because your abstractions contradicts with parts of itself • Reality never contradicts with itself, implement as much of the factually know reality as possible
  • 18. Software Architecture: How not to fail! • Be consistent with the real world, as much as possible • Don’t assume things on yourself, your assumption could result in wrong invariants • Know your language well • Know your intent well • Implement your intent
  • 19. Programing language: The friend • A language is a means of communicating meanings • A programmer is just as much of a writer as a writer is • A writer transfers his intents well, only relying on his good grasp of the language • A piece of code is a writing that has two separate audience, computers and humans (well a sort of them, programmers!) • A good grasp of the language is necessary for proper implementation of intent • The language use in teams are often culturally effected, teach and learn the culture to avoid drastic code rewrites
  • 20. Programing language: The enemy • A programming language can lean towards either computers, or humans too disproportionately • Can hurt the computer by degrading the performance, a computer performs more efficiently if the intent is well understood • Can hurt the programmer by making development, and maintenance unbearable • Bad cultures maintained well can result in painful code maintenance • Find the bad cultures and eradicate them
  • 21. Programing language: Humane • Just as humans, a programming language is never perfect • Often when you don’t implement your intent, you desire to implement your intent but the language simply doesn’t allow it • Compromise more on higher levels of abstraction rather than the lower • Higher levels of abstraction often effect larger areas of the code • Lower levels often effect less amount of code • The less amount effected by the code the easier the change, rewrite, and refactoring tasks
  • 22. Programming language: ASM, Machine language? • This is a language that in the spectrum leans completely towards computers • The best tool to convey intents to computers • Not really a good one for humans, is it • Also not all computers talk the same
  • 23. Programming language: C++, My beloved so far • Tries to maintain a good trade off between humans and computers • Falls short sometimes in communication with humans • Template meta-programming certainly worked well with computers, not so well with humans • Unique pointers seemingly do well with humans, but in some cases that inlining isn’t available they seem to fall short to convey intent to computers • The committee responds to these by figuring out the most prevalent cause of unease in communications and remedies them by new features, e.g. constexpr
  • 24. Code: The case of the chair
  • 25. Code: No chair can grow legs? Chair races don’t combine?
  • 26. Code: No weird legs! Bigotry makes life easier for our developers!
  • 27. Code: Only four legged chairs allowed, we love our CPU cycles!

Notas del editor

  1. That is one beautiful chair huh! What is it we call a chair, should it always have legs? A back rest? We know what chair is don’t we? We certainly can recognize one when we see it, but what really is a chair? Can any one provide a definition?
  2. Maybe not all have four legs!
  3. Does this one have a leg? If yes what is a leg?
  4. Are those legs too?
  5. What about this one?
  6. Ok cars should be more simple! 4 wheels, some door, and there it is!
  7. Umm ok, 3 or 4 wheels!
  8. Well some wheels, but is 2 wheels ok too?
  9. All cases considered, we are infallible, let the features rain in.
  10. No thanks! But if not vector or array what then?
  11. Less templates is better for developer
  12. Cache friendly is better for efficiency