SlideShare a Scribd company logo
2
Most read
5
Most read
13
Most read
PRINCIPLES
OF

GOOD
PROGRAMMING
Presentation By
Angelin
@ardentlearner
DRY

DON’T REPEAT YOURSELF
I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself
I will not repeat myself
REPETITION IS THE ROOT OF ALL SOFTWARE EVIL

As soon as you start repeating yourself (e.g. a long expression, a
series of statements, same concept) create a new abstraction.
@ardentlearner

1
ABSTRACT
Each significant piece of functionality in a program should be
implemented in just one place in the source code.
Main Problem

1st layer abstraction

2nd layer abstraction

3rd layer abstraction
@ardentlearner

2
KISS
Always remember to…

KISS
KEEP

IT

SIMPLE

STUPID

Simplicity (and avoiding complexity) should always be a key goal.
Simple code takes less time to write, has fewer bugs and is easier
to modify.

@ardentlearner

3
YAGNI
Avoid Creating a YAGNI
(You aren’t going to need it)

You should try not to add
functionality until you need it.
Pain

“Hey,
we could …”

YAGNI

The simplest
thing that could
possibly work

No Pain
@ardentlearner

4
SIMPLE

IT’S THE
THINGS
THAT MAKE A
Do the simplest thing that could possibly work.
A good question to ask one’s self when programming is,
“What is the simplest thing that could possibly work?”
This helps keep us on the path towards simplicity in the design.
@ardentlearner

5
DON’T MAKE ME THINK

The code should be easily read and understood with a
minimum of effort required.

If code requires too much thinking from an observer to
understand, then it can probably stand to be simplified.
@ardentlearner

6
OPEN / CLOSED
OPEN

MODIFICATION

FOR
EXTENSION
CLOSED

Software entities (classes, modules, functions, etc.) should be
open for extension,
but
closed for modification.
In other words, do not write classes that people can modify.
Write classes that people can extend.
@ardentlearner

7
MAINTAINABLE
Write Code for the Maintainer
Almost any code that is worth
writing is worth maintaining in
the future.

WRITE YOUR

AS IF THE PERSON
MAINTAINING IT
IS A
HOMICIDAL
MANIAC

WHO KNOWS
WHERE YOU LIVE
@ardentlearner

8
LEAST ASTONISHMENT

Code should surprise the reader as little as possible.
This means following standard coding conventions and
the code should do what the comments and name suggest and any
potentially surprising side effects should be avoided as much as
possible.
@ardentlearner

9
SINGLE RESPONSIBILITY

A component of code (e.g. class or function) should perform a
single well defined task.
@ardentlearner

10
MINIMIZE COUPLING

“All modules should be independent as far as possible”
Improves maintainability
@ardentlearner

11
MAXIMIZE COHESION

“Things that belong together should be kept together”
Makes code easier to understand, debug and test.
@ardentlearner

12
THE LAW OF DEMETER
Talk only to your closest friends

THE LAW OF DEMETER
is also known as
Principle of Least Knowledge
@ardentlearner

13
AVOID PREMATURE OPTIMIZATION

Don’t even think about optimization unless your code is working
but slower than you want. Only then should you start thinking
about optimizing and only with the aid of empirical data.
"We should forget about small efficiencies, say about 97% of the time:
Premature Optimization is the root of all evil" - Donald Knuth.
@ardentlearner

14
REUSE CODE

Reusing code
improves code reliability
and
decreases development time.
@ardentlearner

15
SEPARATION OF CONCERNS

Different areas of functionality should be managed by
distinct and minimally overlapping modules of code.
@ardentlearner

16
EMBRACE CHANGE

@ardentlearner

17
HAPPY
PROGRAMMING !

@ardentlearner

More Related Content

PPTX
Doubly Linked List
PPTX
Email investigation
PPTX
Denial of Service Attack
PPTX
Php Framework
PPTX
Types of attacks
PPTX
XXE - XML External Entity Attack
PPTX
Introduction to ajax
PPTX
Basics of Denial of Service Attacks
Doubly Linked List
Email investigation
Denial of Service Attack
Php Framework
Types of attacks
XXE - XML External Entity Attack
Introduction to ajax
Basics of Denial of Service Attacks

What's hot (20)

DOCX
15 practical grep command examples in linux
PDF
Discrete Logarithm Problem over Prime Fields, Non-canonical Lifts and Logarit...
PPTX
Database security
PPTX
Sql injection attack
PPTX
Ip spoofing ppt
PPTX
E mail forensics
PPTX
Lecture 22 What inside the Router.pptx
PDF
Introduction to Windows Dictionary Attacks
PPTX
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
PPTX
CBSE class X Computer Applications ch 1 INTERNET
PPTX
Web Server And Database Server
PDF
Lecture26 cc-security1
PDF
Practical Malware Analysis: Ch 9: OllyDbg
PPTX
Network Security Architecture
PPTX
PPTX
Burp suite
PPTX
Priority Queue in Data Structure
PPT
Linked lists
PPT
Darkweb
15 practical grep command examples in linux
Discrete Logarithm Problem over Prime Fields, Non-canonical Lifts and Logarit...
Database security
Sql injection attack
Ip spoofing ppt
E mail forensics
Lecture 22 What inside the Router.pptx
Introduction to Windows Dictionary Attacks
Data structure,abstraction,abstract data type,static and dynamic,time and spa...
CBSE class X Computer Applications ch 1 INTERNET
Web Server And Database Server
Lecture26 cc-security1
Practical Malware Analysis: Ch 9: OllyDbg
Network Security Architecture
Burp suite
Priority Queue in Data Structure
Linked lists
Darkweb
Ad

Similar to The principles of good programming (20)

PDF
Developer++ through patterns, architecture, and products
PDF
Patterns, Code Smells, and The Pragmattic Programmer
PPTX
11 rules for programmer should live by
PPTX
30% faster coder on-boarding when you have a code cookbook
PPTX
Software Development Essential Skills
PPT
Pragmatic 1
PDF
Coding principles
PDF
Guidelines to clean coding
PPTX
Writing code for others
PDF
10 Programming Principles Every Software Developer Should Know.pdf
PDF
Clean Code
PPTX
Programming style guildelines
PDF
YAGNI Principle and Clean Code
PDF
Oleksandr Valetskyy - Pragmatic programmer. Theory and practice
PPTX
Good Qualities of a developer
PDF
Clean code
PPTX
Clean Code - Writing code for human
PDF
Good programming
PPTX
C# coding standards, good programming principles & refactoring
PDF
Good Practices of Programming | Jayasurya A
Developer++ through patterns, architecture, and products
Patterns, Code Smells, and The Pragmattic Programmer
11 rules for programmer should live by
30% faster coder on-boarding when you have a code cookbook
Software Development Essential Skills
Pragmatic 1
Coding principles
Guidelines to clean coding
Writing code for others
10 Programming Principles Every Software Developer Should Know.pdf
Clean Code
Programming style guildelines
YAGNI Principle and Clean Code
Oleksandr Valetskyy - Pragmatic programmer. Theory and practice
Good Qualities of a developer
Clean code
Clean Code - Writing code for human
Good programming
C# coding standards, good programming principles & refactoring
Good Practices of Programming | Jayasurya A
Ad

More from Angelin R (17)

PPTX
Comparison of Java Web Application Frameworks
DOCX
[DOC] Java - Code Analysis using SonarQube
PDF
Java Source Code Analysis using SonarQube
PDF
Exception handling & logging in Java - Best Practices (Updated)
PDF
A Slice of Me
PDF
Team Leader - 30 Essential Traits
PDF
Action Script
PDF
Agile SCRUM Methodology
PDF
Exception handling and logging best practices
PPT
Tamil Christian Worship Songs
PDF
Flex MXML Programming
PDF
Introduction to Adobe Flex
PDF
Software Development Life Cycle (SDLC)
PDF
Restful Web Services
PDF
Effective Team Work Model
PDF
Team Building Activities
PDF
XStream
Comparison of Java Web Application Frameworks
[DOC] Java - Code Analysis using SonarQube
Java Source Code Analysis using SonarQube
Exception handling & logging in Java - Best Practices (Updated)
A Slice of Me
Team Leader - 30 Essential Traits
Action Script
Agile SCRUM Methodology
Exception handling and logging best practices
Tamil Christian Worship Songs
Flex MXML Programming
Introduction to Adobe Flex
Software Development Life Cycle (SDLC)
Restful Web Services
Effective Team Work Model
Team Building Activities
XStream

Recently uploaded (20)

PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Machine Learning_overview_presentation.pptx
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PDF
Machine learning based COVID-19 study performance prediction
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Cloud computing and distributed systems.
PPT
Teaching material agriculture food technology
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PPTX
A Presentation on Artificial Intelligence
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Electronic commerce courselecture one. Pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
MIND Revenue Release Quarter 2 2025 Press Release
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Machine Learning_overview_presentation.pptx
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Machine learning based COVID-19 study performance prediction
20250228 LYD VKU AI Blended-Learning.pptx
Cloud computing and distributed systems.
Teaching material agriculture food technology
MYSQL Presentation for SQL database connectivity
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
A Presentation on Artificial Intelligence
NewMind AI Weekly Chronicles - August'25-Week II
sap open course for s4hana steps from ECC to s4
Electronic commerce courselecture one. Pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
Digital-Transformation-Roadmap-for-Companies.pptx
MIND Revenue Release Quarter 2 2025 Press Release

The principles of good programming

  • 2. DRY DON’T REPEAT YOURSELF I will not repeat myself I will not repeat myself I will not repeat myself I will not repeat myself I will not repeat myself I will not repeat myself REPETITION IS THE ROOT OF ALL SOFTWARE EVIL As soon as you start repeating yourself (e.g. a long expression, a series of statements, same concept) create a new abstraction. @ardentlearner 1
  • 3. ABSTRACT Each significant piece of functionality in a program should be implemented in just one place in the source code. Main Problem 1st layer abstraction 2nd layer abstraction 3rd layer abstraction @ardentlearner 2
  • 4. KISS Always remember to… KISS KEEP IT SIMPLE STUPID Simplicity (and avoiding complexity) should always be a key goal. Simple code takes less time to write, has fewer bugs and is easier to modify. @ardentlearner 3
  • 5. YAGNI Avoid Creating a YAGNI (You aren’t going to need it) You should try not to add functionality until you need it. Pain “Hey, we could …” YAGNI The simplest thing that could possibly work No Pain @ardentlearner 4
  • 6. SIMPLE IT’S THE THINGS THAT MAKE A Do the simplest thing that could possibly work. A good question to ask one’s self when programming is, “What is the simplest thing that could possibly work?” This helps keep us on the path towards simplicity in the design. @ardentlearner 5
  • 7. DON’T MAKE ME THINK The code should be easily read and understood with a minimum of effort required. If code requires too much thinking from an observer to understand, then it can probably stand to be simplified. @ardentlearner 6
  • 8. OPEN / CLOSED OPEN MODIFICATION FOR EXTENSION CLOSED Software entities (classes, modules, functions, etc.) should be open for extension, but closed for modification. In other words, do not write classes that people can modify. Write classes that people can extend. @ardentlearner 7
  • 9. MAINTAINABLE Write Code for the Maintainer Almost any code that is worth writing is worth maintaining in the future. WRITE YOUR AS IF THE PERSON MAINTAINING IT IS A HOMICIDAL MANIAC WHO KNOWS WHERE YOU LIVE @ardentlearner 8
  • 10. LEAST ASTONISHMENT Code should surprise the reader as little as possible. This means following standard coding conventions and the code should do what the comments and name suggest and any potentially surprising side effects should be avoided as much as possible. @ardentlearner 9
  • 11. SINGLE RESPONSIBILITY A component of code (e.g. class or function) should perform a single well defined task. @ardentlearner 10
  • 12. MINIMIZE COUPLING “All modules should be independent as far as possible” Improves maintainability @ardentlearner 11
  • 13. MAXIMIZE COHESION “Things that belong together should be kept together” Makes code easier to understand, debug and test. @ardentlearner 12
  • 14. THE LAW OF DEMETER Talk only to your closest friends THE LAW OF DEMETER is also known as Principle of Least Knowledge @ardentlearner 13
  • 15. AVOID PREMATURE OPTIMIZATION Don’t even think about optimization unless your code is working but slower than you want. Only then should you start thinking about optimizing and only with the aid of empirical data. "We should forget about small efficiencies, say about 97% of the time: Premature Optimization is the root of all evil" - Donald Knuth. @ardentlearner 14
  • 16. REUSE CODE Reusing code improves code reliability and decreases development time. @ardentlearner 15
  • 17. SEPARATION OF CONCERNS Different areas of functionality should be managed by distinct and minimally overlapping modules of code. @ardentlearner 16