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
 
Technical writingmadeeasier
Technical writingmadeeasierTechnical writingmadeeasier
Technical writingmadeeasierthangnn23
 
18 technical writing made easier
18 technical writing made easier18 technical writing made easier
18 technical writing made easierJOEY S.
 
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
 
Technical writingmadeeasier
Technical writingmadeeasierTechnical writingmadeeasier
Technical writingmadeeasier
 
18 technical writing made easier
18 technical writing made easier18 technical writing made easier
18 technical writing made easier
 
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

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piececharlottematthew16
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024The Digital Insurer
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfSeasiaInfotech2
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 

Recently uploaded (20)

My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Story boards and shot lists for my a level piece
Story boards and shot lists for my a level pieceStory boards and shot lists for my a level piece
Story boards and shot lists for my a level piece
 
My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024My INSURER PTE LTD - Insurtech Innovation Award 2024
My INSURER PTE LTD - Insurtech Innovation Award 2024
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
The Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdfThe Future of Software Development - Devin AI Innovative Approach.pdf
The Future of Software Development - Devin AI Innovative Approach.pdf
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 

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