SlideShare a Scribd company logo
1 of 16
The Ministry of Truth
Rules for Good Software Design
Principles of good software design are

PRINCIPLES OF GOOD OBJECT DESIGN
War
is Peace
Treat all inputs

AS ATTACKS
A good interface

IS NOT BROKEN BY BAD INPUT
throw {
   name: ”Bad Input Error”,
   message: ”Oh noes!”
}
Freedom
 is Slavery
The more you constrain your code’s behaviour,

THE MORE FREEDOM YOU HAVE TO ACT
run();
“There is only one mode,

AND IT IS SECURE.”
Ignorance
 is Strength
Only give objects access to the

THINGS THEY NEED TO DO THEIR JOBS
To write better objects…
• Leave your object in a consistent state
  regardless of what your clients do.

• Prevent clients from accessing things they
  aren't supposed to touch.

• Only give your objects access to the
  resources they need to get the job done.
To write better programs…
• Leave your program in a consistent state
  regardless of what your clients do.

• Prevent clients from accessing things they
  aren't supposed to touch.

• Only give your programs access to the
  resources they need to get the job done.
Thanks
This lightning talk was originally by Allen Short
       and was presented at PyCon 2012

More Related Content

Similar to The Ministry of Truth Rules for Good Software Design

Empowering More People By Building Accessible Apps
Empowering More People By Building Accessible AppsEmpowering More People By Building Accessible Apps
Empowering More People By Building Accessible AppsGuy Barker
 
Large Scale Data Management
Large Scale Data ManagementLarge Scale Data Management
Large Scale Data ManagementThomas Miller
 
15 Experts on the Art of JavaScript Programming
15 Experts on the Art of JavaScript Programming15 Experts on the Art of JavaScript Programming
15 Experts on the Art of JavaScript ProgrammingFusionCharts
 
MVP to MLP - Minimum Lovable Product
MVP to MLP - Minimum Lovable ProductMVP to MLP - Minimum Lovable Product
MVP to MLP - Minimum Lovable ProductJake Levirne
 
Testing with cucumber testing framework
Testing with cucumber testing frameworkTesting with cucumber testing framework
Testing with cucumber testing frameworkAIMDek Technologies
 
Selective 97 things every programmer should know
Selective 97 things every programmer should knowSelective 97 things every programmer should know
Selective 97 things every programmer should knowMuhammad Ahsan
 
97 thingseveryprogrammershouldknow
97 thingseveryprogrammershouldknow97 thingseveryprogrammershouldknow
97 thingseveryprogrammershouldknowREHAN KHAN
 
How to cut cost of app development up to 5x!
How to cut cost of app development up to 5x!How to cut cost of app development up to 5x!
How to cut cost of app development up to 5x!Narek Gevorgyan
 
Touch Screens | The very expensive mistake
Touch Screens | The very expensive mistakeTouch Screens | The very expensive mistake
Touch Screens | The very expensive mistakeCasey Dubbs
 
You Can't Buy Security - DerbyCon 2012
You Can't Buy Security - DerbyCon 2012You Can't Buy Security - DerbyCon 2012
You Can't Buy Security - DerbyCon 2012jadedsecurity
 
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...AdaCore
 
Hacking for Beginners The Ultimate Guide For Newbie Hackers
Hacking for Beginners The Ultimate Guide For Newbie HackersHacking for Beginners The Ultimate Guide For Newbie Hackers
Hacking for Beginners The Ultimate Guide For Newbie HackersJahaSoft
 
Meaghan technology report
Meaghan technology reportMeaghan technology report
Meaghan technology reportMarq2014
 
Testing quotes neww
Testing quotes newwTesting quotes neww
Testing quotes newwSachin MK
 

Similar to The Ministry of Truth Rules for Good Software Design (18)

SMART SESSION LIVE- 11/29/2010
SMART SESSION LIVE- 11/29/2010SMART SESSION LIVE- 11/29/2010
SMART SESSION LIVE- 11/29/2010
 
Empowering More People By Building Accessible Apps
Empowering More People By Building Accessible AppsEmpowering More People By Building Accessible Apps
Empowering More People By Building Accessible Apps
 
Large Scale Data Management
Large Scale Data ManagementLarge Scale Data Management
Large Scale Data Management
 
Bug Hunting Safari
Bug Hunting SafariBug Hunting Safari
Bug Hunting Safari
 
15 Experts on the Art of JavaScript Programming
15 Experts on the Art of JavaScript Programming15 Experts on the Art of JavaScript Programming
15 Experts on the Art of JavaScript Programming
 
MVP to MLP - Minimum Lovable Product
MVP to MLP - Minimum Lovable ProductMVP to MLP - Minimum Lovable Product
MVP to MLP - Minimum Lovable Product
 
Testing with cucumber testing framework
Testing with cucumber testing frameworkTesting with cucumber testing framework
Testing with cucumber testing framework
 
You installed what Thierry Sans
You installed what  Thierry SansYou installed what  Thierry Sans
You installed what Thierry Sans
 
Getting it Built
Getting it BuiltGetting it Built
Getting it Built
 
Selective 97 things every programmer should know
Selective 97 things every programmer should knowSelective 97 things every programmer should know
Selective 97 things every programmer should know
 
97 thingseveryprogrammershouldknow
97 thingseveryprogrammershouldknow97 thingseveryprogrammershouldknow
97 thingseveryprogrammershouldknow
 
How to cut cost of app development up to 5x!
How to cut cost of app development up to 5x!How to cut cost of app development up to 5x!
How to cut cost of app development up to 5x!
 
Touch Screens | The very expensive mistake
Touch Screens | The very expensive mistakeTouch Screens | The very expensive mistake
Touch Screens | The very expensive mistake
 
You Can't Buy Security - DerbyCon 2012
You Can't Buy Security - DerbyCon 2012You Can't Buy Security - DerbyCon 2012
You Can't Buy Security - DerbyCon 2012
 
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...
HIS 2015: Roderick Chapman - Murphy Vs Satan Why programming secure systems i...
 
Hacking for Beginners The Ultimate Guide For Newbie Hackers
Hacking for Beginners The Ultimate Guide For Newbie HackersHacking for Beginners The Ultimate Guide For Newbie Hackers
Hacking for Beginners The Ultimate Guide For Newbie Hackers
 
Meaghan technology report
Meaghan technology reportMeaghan technology report
Meaghan technology report
 
Testing quotes neww
Testing quotes newwTesting quotes neww
Testing quotes neww
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 

The Ministry of Truth Rules for Good Software Design

Editor's Notes

  1. Greetings from the Ministry of Truth. We would like to take this opportunity to educate you on some principles of secure software design.
  2. object/API/web service/module/plugin/extension/featureAnything with a public interface used by other code.
  3. If your code is prepared for war, you can be at peace.
  4. Treating all inputs as attacks protects all users.
  5. We all remember little Bobby Tables…Don’t let Bobby happen to you.
  6. A good object interface doesn't let bad input break it. Raise/throw exceptions.
  7. This is how you throw an exception in JavaScript. The object literal is key.
  8. Limit what can happen via your interface. The less choice a client has in how it interacts with your program, the more success you will have in securing it.
  9. The ideal secure interface looks like this.
  10. There should be one—and preferably only one—obvious way to do it.Adding features for convenience can constrain you later on. Lean development is better development.Do you have a requirement for it now? If not, don't code it.
  11. The less your code knows about the less it can break.
  12. Principle of least authority.Regardless of security, code cannot affect objects it doesn't know about. This means less bugs.This is why global variables are bad.Isolated code is easier to debug.