SlideShare a Scribd company logo
1 of 10
Download to read offline
Writing good code
Purpose 1: Software development is a group effort
1. Lots of people are involved
2. Code is revisited very often
3. Cost of maintenance
Purpose 2: Code has to last long
Codebase is discarded when
1. It is not understood
2. It is not robust
3. It is not extensible
4. It is not efficient
What writing good code has got to do with sitting in
conference room?
1. To make you sensible to the topic
2. To set you on right path
So lets get started with the session!
Be sensible
1. Readability: clarity over cleverness
2. Consistency
3. Cyclomatic complexity
4. Responsible while changing code
Be robust
1. Least astonishment
a. No side effects
b. Re factor
2. Use correct data types
a. Makes code more maintainable
b. re-factoring is easy
3. Scope variables carefully
a. Don't spoil global name space
b. Don't reuse convenient variables/constants
Be Pragmatic
1. See the big picture
a. composition/cohesion – Design by contract
2. Understand the platform
a. memory model: String builder, boxing/unboxing
b. memory leaks
c. thread safety
Points to ponder
1. Error – To catch or not to catch
2. Exception model - http://c2.com/cgi/wiki?
UseExceptionsInsteadOfErrorValues
3. overloading - don't overload it
4. Out of band info
5. Boy scout principle
6. Don't re-invent, evolve
Suggested reading
1. Art of Unix programming - http://www.faqs.org/docs/artu/
2. Unmaintainable code - http://mindprod.com/jgloss/unmain.html
3. http://c2.com/cgi/fullSearch?search=
4. Pragmatic programmer
5. 97 things every programmer should know
6. Clean code

More Related Content

Similar to Good code

A programmer's guide to write code like a pro [Infographic]
A programmer's guide to write code like a pro [Infographic]A programmer's guide to write code like a pro [Infographic]
A programmer's guide to write code like a pro [Infographic]AXON-Soft
 
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...DevDay.org
 
Git_Practices - Guidelines.pdf
Git_Practices - Guidelines.pdfGit_Practices - Guidelines.pdf
Git_Practices - Guidelines.pdfharshit259398
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentMitosis Technology
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++smumbahelp
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of codeShwe Yee
 
18 technical writing made easier
18 technical writing made easier18 technical writing made easier
18 technical writing made easierJOEY S.
 
Technical writingmadeeasier
Technical writingmadeeasierTechnical writingmadeeasier
Technical writingmadeeasierthangnn23
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdfOprim Solutions
 
Domain Driven Design Thoughts Mat Holroyd
Domain Driven Design Thoughts   Mat HolroydDomain Driven Design Thoughts   Mat Holroyd
Domain Driven Design Thoughts Mat Holroydmelbournepatterns
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Codemtoppa
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreDan Poltawski
 
Software Design Notes
Software Design NotesSoftware Design Notes
Software Design NotesDiego Pacheco
 
Composition: Kaleidoscope Project Notes
Composition: Kaleidoscope Project NotesComposition: Kaleidoscope Project Notes
Composition: Kaleidoscope Project NotesSusan Hines
 
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd Daryl O'Hare
 
Top technical mistakes that programers do
Top technical mistakes that programers doTop technical mistakes that programers do
Top technical mistakes that programers doNalaka Gamage
 

Similar to Good code (20)

Is Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic GascIs Python still production ready ? Ludovic Gasc
Is Python still production ready ? Ludovic Gasc
 
A programmer's guide to write code like a pro [Infographic]
A programmer's guide to write code like a pro [Infographic]A programmer's guide to write code like a pro [Infographic]
A programmer's guide to write code like a pro [Infographic]
 
Pull request review
Pull request reviewPull request review
Pull request review
 
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
 
Git_Practices - Guidelines.pdf
Git_Practices - Guidelines.pdfGit_Practices - Guidelines.pdf
Git_Practices - Guidelines.pdf
 
How to do code review and use analysis tool in software development
How to do code review and use analysis tool in software developmentHow to do code review and use analysis tool in software development
How to do code review and use analysis tool in software development
 
Mca2030 object oriented programming – c++
Mca2030  object oriented programming – c++Mca2030  object oriented programming – c++
Mca2030 object oriented programming – c++
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of code
 
18 technical writing made easier
18 technical writing made easier18 technical writing made easier
18 technical writing made easier
 
Technical writingmadeeasier
Technical writingmadeeasierTechnical writingmadeeasier
Technical writingmadeeasier
 
9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf9 Tips to write efficient and scalable code.pdf
9 Tips to write efficient and scalable code.pdf
 
Domain Driven Design Thoughts Mat Holroyd
Domain Driven Design Thoughts   Mat HolroydDomain Driven Design Thoughts   Mat Holroyd
Domain Driven Design Thoughts Mat Holroyd
 
Traits of a Good Engineer
Traits of a Good EngineerTraits of a Good Engineer
Traits of a Good Engineer
 
WordCamp US: Clean Code
WordCamp US: Clean CodeWordCamp US: Clean Code
WordCamp US: Clean Code
 
How to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle coreHow to guarantee your change is integrated to Moodle core
How to guarantee your change is integrated to Moodle core
 
Software Design Notes
Software Design NotesSoftware Design Notes
Software Design Notes
 
Composition: Kaleidoscope Project Notes
Composition: Kaleidoscope Project NotesComposition: Kaleidoscope Project Notes
Composition: Kaleidoscope Project Notes
 
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd
Kaleidoscope Project Open Education Presentation, Salt Lake City, UT OpenEd
 
Principles that Guide Practice
Principles that Guide PracticePrinciples that Guide Practice
Principles that Guide Practice
 
Top technical mistakes that programers do
Top technical mistakes that programers doTop technical mistakes that programers do
Top technical mistakes that programers do
 

More from Om Vikram Thapa

More from Om Vikram Thapa (20)

Next Set of Leaders Series
Next Set of Leaders SeriesNext Set of Leaders Series
Next Set of Leaders Series
 
Integration Testing at go-mmt
Integration Testing at go-mmtIntegration Testing at go-mmt
Integration Testing at go-mmt
 
Understanding payments
Understanding paymentsUnderstanding payments
Understanding payments
 
System Alerting & Monitoring
System Alerting & MonitoringSystem Alerting & Monitoring
System Alerting & Monitoring
 
Serverless computing
Serverless computingServerless computing
Serverless computing
 
Sumologic Community
Sumologic CommunitySumologic Community
Sumologic Community
 
Postman Integration Testing
Postman Integration TestingPostman Integration Testing
Postman Integration Testing
 
Scalibility
ScalibilityScalibility
Scalibility
 
5 Dysfunctions of a team
5 Dysfunctions of a team5 Dysfunctions of a team
5 Dysfunctions of a team
 
AWS Must Know
AWS Must KnowAWS Must Know
AWS Must Know
 
Continuous Feedback
Continuous FeedbackContinuous Feedback
Continuous Feedback
 
Sql views, stored procedure, functions
Sql views, stored procedure, functionsSql views, stored procedure, functions
Sql views, stored procedure, functions
 
Confluence + jira together
Confluence + jira togetherConfluence + jira together
Confluence + jira together
 
Understanding WhatFix
Understanding WhatFixUnderstanding WhatFix
Understanding WhatFix
 
Tech Recruitment Process
Tech Recruitment Process Tech Recruitment Process
Tech Recruitment Process
 
Jira Workshop
Jira WorkshopJira Workshop
Jira Workshop
 
Security@ecommerce
Security@ecommerceSecurity@ecommerce
Security@ecommerce
 
Understanding iis part2
Understanding iis part2Understanding iis part2
Understanding iis part2
 
Understanding iis part1
Understanding iis part1Understanding iis part1
Understanding iis part1
 
Web application
Web applicationWeb application
Web application
 

Recently uploaded

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Allon Mureinik
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
🐬 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
 
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
 
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 Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
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
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
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
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)Injustice - Developers Among Us (SciFiDevCon 2024)
Injustice - Developers Among Us (SciFiDevCon 2024)
 
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
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
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
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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...
 
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 Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Good code

  • 2. Purpose 1: Software development is a group effort 1. Lots of people are involved 2. Code is revisited very often 3. Cost of maintenance
  • 3. Purpose 2: Code has to last long Codebase is discarded when 1. It is not understood 2. It is not robust 3. It is not extensible 4. It is not efficient
  • 4. What writing good code has got to do with sitting in conference room? 1. To make you sensible to the topic 2. To set you on right path
  • 5. So lets get started with the session!
  • 6. Be sensible 1. Readability: clarity over cleverness 2. Consistency 3. Cyclomatic complexity 4. Responsible while changing code
  • 7. Be robust 1. Least astonishment a. No side effects b. Re factor 2. Use correct data types a. Makes code more maintainable b. re-factoring is easy 3. Scope variables carefully a. Don't spoil global name space b. Don't reuse convenient variables/constants
  • 8. Be Pragmatic 1. See the big picture a. composition/cohesion – Design by contract 2. Understand the platform a. memory model: String builder, boxing/unboxing b. memory leaks c. thread safety
  • 9. Points to ponder 1. Error – To catch or not to catch 2. Exception model - http://c2.com/cgi/wiki? UseExceptionsInsteadOfErrorValues 3. overloading - don't overload it 4. Out of band info 5. Boy scout principle 6. Don't re-invent, evolve
  • 10. Suggested reading 1. Art of Unix programming - http://www.faqs.org/docs/artu/ 2. Unmaintainable code - http://mindprod.com/jgloss/unmain.html 3. http://c2.com/cgi/fullSearch?search= 4. Pragmatic programmer 5. 97 things every programmer should know 6. Clean code