SlideShare una empresa de Scribd logo
1 de 30
Writing Code For Others
          amol.pujari@gslab.com




                              http://www.codinghorror.com/blog/
Why
Writing Code For Others




                    http://www.makinggoodsoftware.com/
why do we write code?

•to get it executed by a machine
•the machine understands 0s and 1s only
•then why do we use high level languages like c,
java, or ruby
•did the machine request us to use c or ruby?




                                         http://sourcemaking.com/
we use high level languages so
humans can understand code by
           reading it



          http://www.makinggoodsoftware.com/2009/07/07/5-top-non-technical-mistakes-made-by-
how do others find reading your code?

•do they find it helpful in understanding your
program
  –the optimizations you’ve done
  –your naming conventions, your coding style
  –how long they should take to do it
  –more importantly, would they like looking at your
  code
  –would they love the way you code
•or do they simply find it quite boring

                 http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-
you can help others to quickly
read your code and understand it




                     http://www.joelonsoftware.com/articles/Wrong.html
characteristics of good code

•easy to read
•easy to use
•clean, simple, straight forward
•easy to make any changes
•self explanatory
•short methods, clear names
•consistent coding standards



                     http://www.thoughtclusters.com/2010/09/characteristics-of-great-programmers/
writing necessary comments




         http://www.makinggoodsoftware.com/2009/09/01/programmers-top-10-sentences/
writing necessary comments

•let’s define “necessary” comments




                                     http://en.wikipedia.org/wiki/Code_smell
writing necessary comments




•should not tell us how code works
•but why code works
•convert your comments into variable names or
function names, constants


                      http://en.wikipedia.org/wiki/Anti-pattern#Programming_anti-patterns
follow same indentations

•different people love different editors
•tab is treated differently by different editors
•define tab = 2 or 4 spaces
•good if entire team follows same definition of
tab




                   http://www.makinggoodsoftware.com/2011/05/23/top-7-programmers-bad-habits/
more than indentations




     http://www.makinggoodsoftware.com/2010/05/27/10-things-they-never-teach-in-college-
more than indentations




       http://www.makinggoodsoftware.com/2010/03/13/my-ten-development-principles/
write working pseudo code

•write a program
•given a number
•print “divisible by 3” if it is divisible by 3
•print “divisible by 5 if it is divisible by 5
•print “divisible by 15” if it is divisible by 15




                          http://www.codinghorror.com/blog/2009/05/pseudocode-or-code.html
write working pseudo code

•write a program
•given a number
•print “divisible by 3” if it is divisible by 3
•print “divisible by 5 if it is divisible by 5
•print “divisible by 15” if it is divisible by 15




                          http://www.codinghorror.com/blog/2009/05/pseudocode-or-code.html
write working pseudo code

•you might have simply optimized
•reducing one divide operation
write working pseudo code

•write a program
•given a number
•print “divisible by 3” if it is divisible by 3
•print “divisible by 5 if it is divisible by 5
-a change request
print “divisible by 15” if it is divisible by 15
print “divisible by 17” if it is divisible by 17



                    http://stackoverflow.com/questions/84556/whats-your-favorite-programmer-cartoon
write working pseudo code

•If pseudo code would have been followed
•without optimizations
nested if-else




                 http://tinyletter.com/codereading
nested if-else

•avoid nested if-else chain
•use switch or multiple returns
•same follows for iterators while, for




                      http://inter-sections.net/2007/11/13/how-to-recognise-a-good-programmer
god class

•a file or class or a module
•knows too much or does too much
•contains more than 1000 or 5000 loc
•class with a large number of attributes,
operations, or both
•uses heavy encapsulation




                   http://www.dehora.net/journal/2005/06/writing_code_for_others_that_use_it.html
long methods

•would you like to read and understand a
function which is of 300 lines or say 1000 lines
•or would you like to understand functions with
10 lines, 20, say 30 lines at the most




                       http://www.dmst.aueb.gr/dds/pubs/jrnl/2003-ACMQ-CR/html/article.html
one function one responsibility




        http://www.skorks.com/2010/05/why-i-love-reading-other-peoples-code-and-you-should-too/
one function one responsibility




               http://rubylearning.com/blog/2010/11/08/how-does-your-code-smell/
long parameters list




            http://www.codinghorror.com/blog/2006/05/code-smells.html
more coding horrors

•uncommunicative name - naming functions and
variables
•magic numbers, hardcoded values
•data clumps
•feature Envy
•middle man …and more




                        http://www.codinghorror.com/blog/2006/05/code-smells.html
characteristics of a good code

•easy to read
•easy to understand
•easy to make any changes
•clean, simple
•looks straight forward
•self explanatory
•short methods, clear names



                              http://www.perlmonks.org/?node_id=592616
characteristics of good code

•easy to read
•easy to use
•clean, simple, straight forward
•easy to make any changes
•self explanatory
•short methods, clear names
•consistent coding standards



                     http://www.thoughtclusters.com/2010/09/characteristics-of-great-programmers/
characteristics of a good coder

•likes to read code written by well known
programmers
•likes to do code review of junior or senior
colleagues
•participates in pair programming
•learns new things weekly w.r.t. coding
•does not make unnecessary complex
optimizations
•does not refractor working code again and
again
                                     http://sourcemaking.com/refactoring
enjoy coding




               http://www.artima.com/intv/ruby.html

Más contenido relacionado

La actualidad más candente

Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for EngineersBrian LeRoux
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptAxway Appcelerator
 
Future of the Web with Conversational Interface
Future of the Web with Conversational InterfaceFuture of the Web with Conversational Interface
Future of the Web with Conversational InterfaceTomomi Imura
 
Dnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesDnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesashishpd
 
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7Elisha Tan
 
Brad frost: Atomic design (Webdagene 2014)
Brad frost: Atomic design (Webdagene 2014)Brad frost: Atomic design (Webdagene 2014)
Brad frost: Atomic design (Webdagene 2014)webdagene
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlJoomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlPhilip Locke
 
CatalystX::SimpleLogin
CatalystX::SimpleLoginCatalystX::SimpleLogin
CatalystX::SimpleLoginTomas Doran
 
Breaking up with Microsoft Word
Breaking up with Microsoft WordBreaking up with Microsoft Word
Breaking up with Microsoft Wordcdelk
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoWeng Wei
 
Microservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and DockerMicroservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and DockerDhilipsiva DS
 
[DEV5106] chatbots best practices and design patterns
[DEV5106] chatbots best practices and design patterns[DEV5106] chatbots best practices and design patterns
[DEV5106] chatbots best practices and design patternsRuben Rodriguez
 
Write Better JavaScript
Write Better JavaScriptWrite Better JavaScript
Write Better JavaScriptKevin Whinnery
 
Developing Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, ExplainedDeveloping Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, ExplainedMitch Pirtle
 

La actualidad más candente (15)

Phonegap for Engineers
Phonegap for EngineersPhonegap for Engineers
Phonegap for Engineers
 
Kevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScriptKevin Whinnery: Write Better JavaScript
Kevin Whinnery: Write Better JavaScript
 
Future of the Web with Conversational Interface
Future of the Web with Conversational InterfaceFuture of the Web with Conversational Interface
Future of the Web with Conversational Interface
 
Dnn connect dnnmobi-slides
Dnn connect dnnmobi-slidesDnn connect dnnmobi-slides
Dnn connect dnnmobi-slides
 
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
hey I founded a tech startup...OH SHIT I CAN'T CODE. #barcampsg7
 
Brad frost: Atomic design (Webdagene 2014)
Brad frost: Atomic design (Webdagene 2014)Brad frost: Atomic design (Webdagene 2014)
Brad frost: Atomic design (Webdagene 2014)
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlJoomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
 
CatalystX::SimpleLogin
CatalystX::SimpleLoginCatalystX::SimpleLogin
CatalystX::SimpleLogin
 
Breaking up with Microsoft Word
Breaking up with Microsoft WordBreaking up with Microsoft Word
Breaking up with Microsoft Word
 
Migrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to GoMigrate PHP E-Commerce Site to Go
Migrate PHP E-Commerce Site to Go
 
Microservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and DockerMicroservices with Swagger, Flask and Docker
Microservices with Swagger, Flask and Docker
 
[DEV5106] chatbots best practices and design patterns
[DEV5106] chatbots best practices and design patterns[DEV5106] chatbots best practices and design patterns
[DEV5106] chatbots best practices and design patterns
 
Write Better JavaScript
Write Better JavaScriptWrite Better JavaScript
Write Better JavaScript
 
Developing Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, ExplainedDeveloping Joomla! 1.5 Extensions, Explained
Developing Joomla! 1.5 Extensions, Explained
 
Developer Efficiency
Developer EfficiencyDeveloper Efficiency
Developer Efficiency
 

Destacado

Designers and-geeks 2012-presentation_0.2
Designers and-geeks 2012-presentation_0.2Designers and-geeks 2012-presentation_0.2
Designers and-geeks 2012-presentation_0.2Mike Kuniavsky
 
Leveraging technology tools and social media at pmi india
Leveraging technology tools and social media at pmi indiaLeveraging technology tools and social media at pmi india
Leveraging technology tools and social media at pmi indiaSyed Nazir Razik ACP, CSM, PMP
 
Effective Strategies using Social Media at PMI Chapters #pmilim
Effective Strategies using Social Media at PMI Chapters #pmilimEffective Strategies using Social Media at PMI Chapters #pmilim
Effective Strategies using Social Media at PMI Chapters #pmilimSyed Nazir Razik ACP, CSM, PMP
 
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...Syed Nazir Razik ACP, CSM, PMP
 
How I learned to stop worrying and love the cloud
How I learned to stop worrying and love the cloudHow I learned to stop worrying and love the cloud
How I learned to stop worrying and love the cloudShlomo Swidler
 
Keskustakirjaston osallistuva budjetointi - työpajamenetelmä
Keskustakirjaston osallistuva budjetointi - työpajamenetelmäKeskustakirjaston osallistuva budjetointi - työpajamenetelmä
Keskustakirjaston osallistuva budjetointi - työpajamenetelmäavantoinsight
 
Open Data and the Academy: An Evaluation of CKAN for Research Data Management
Open Data and the Academy: An Evaluation of CKAN for Research Data ManagementOpen Data and the Academy: An Evaluation of CKAN for Research Data Management
Open Data and the Academy: An Evaluation of CKAN for Research Data ManagementJoss Winn
 
RESS - Responsive Web Design + Serverside components
RESS - Responsive Web Design + Serverside componentsRESS - Responsive Web Design + Serverside components
RESS - Responsive Web Design + Serverside componentsAnders Andersen
 
10 Signs You Have a Culture of Inquiry - #CultureCode
10 Signs You Have a Culture of Inquiry - #CultureCode10 Signs You Have a Culture of Inquiry - #CultureCode
10 Signs You Have a Culture of Inquiry - #CultureCodeWarren Berger
 
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside Them
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside ThemEinstein Fusion: 10 Celebrities Who Have a Little Einstein Inside Them
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside ThemWarren Berger
 

Destacado (11)

Designers and-geeks 2012-presentation_0.2
Designers and-geeks 2012-presentation_0.2Designers and-geeks 2012-presentation_0.2
Designers and-geeks 2012-presentation_0.2
 
Leveraging technology tools and social media at pmi india
Leveraging technology tools and social media at pmi indiaLeveraging technology tools and social media at pmi india
Leveraging technology tools and social media at pmi india
 
Effective Strategies using Social Media at PMI Chapters #pmilim
Effective Strategies using Social Media at PMI Chapters #pmilimEffective Strategies using Social Media at PMI Chapters #pmilim
Effective Strategies using Social Media at PMI Chapters #pmilim
 
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...
RAINFED 2015 : Presentation on Precision Farming on small paddy fields with U...
 
How I learned to stop worrying and love the cloud
How I learned to stop worrying and love the cloudHow I learned to stop worrying and love the cloud
How I learned to stop worrying and love the cloud
 
Keskustakirjaston osallistuva budjetointi - työpajamenetelmä
Keskustakirjaston osallistuva budjetointi - työpajamenetelmäKeskustakirjaston osallistuva budjetointi - työpajamenetelmä
Keskustakirjaston osallistuva budjetointi - työpajamenetelmä
 
Open Data and the Academy: An Evaluation of CKAN for Research Data Management
Open Data and the Academy: An Evaluation of CKAN for Research Data ManagementOpen Data and the Academy: An Evaluation of CKAN for Research Data Management
Open Data and the Academy: An Evaluation of CKAN for Research Data Management
 
RESS - Responsive Web Design + Serverside components
RESS - Responsive Web Design + Serverside componentsRESS - Responsive Web Design + Serverside components
RESS - Responsive Web Design + Serverside components
 
Oregon Economic and Revenue Forecast, March 2017
Oregon Economic and Revenue Forecast, March 2017Oregon Economic and Revenue Forecast, March 2017
Oregon Economic and Revenue Forecast, March 2017
 
10 Signs You Have a Culture of Inquiry - #CultureCode
10 Signs You Have a Culture of Inquiry - #CultureCode10 Signs You Have a Culture of Inquiry - #CultureCode
10 Signs You Have a Culture of Inquiry - #CultureCode
 
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside Them
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside ThemEinstein Fusion: 10 Celebrities Who Have a Little Einstein Inside Them
Einstein Fusion: 10 Celebrities Who Have a Little Einstein Inside Them
 

Similar a Writing code for others

Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NETDror Helper
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationBlue Elephant Consulting
 
Writing code for people
Writing code for peopleWriting code for people
Writing code for peopleAlexey Ivanov
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium SuccessfullyDave Haeffner
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Andrei KUCHARAVY
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesInductive Automation
 
Stapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoStapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoChristian Heilmann
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsShafiul Azam Chowdhury
 
Getting Started with Coding
Getting Started with CodingGetting Started with Coding
Getting Started with CodingBohyun Kim
 
Writing Readable Code
Writing Readable CodeWriting Readable Code
Writing Readable Codeeddiehaber
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....Mike Harris
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyLeslie Doherty
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Dutyreedmaniac
 
Getting Started with Scripts #HeroConf London 2015
Getting Started with Scripts #HeroConf London 2015Getting Started with Scripts #HeroConf London 2015
Getting Started with Scripts #HeroConf London 2015Amy Bishop
 
Sahi Principles and Architecture
Sahi Principles and ArchitectureSahi Principles and Architecture
Sahi Principles and ArchitectureTyto Software
 

Similar a Writing code for others (20)

Writing clean code in C# and .NET
Writing clean code in C# and .NETWriting clean code in C# and .NET
Writing clean code in C# and .NET
 
An Introduction To Software Development - Implementation
An Introduction To Software Development - ImplementationAn Introduction To Software Development - Implementation
An Introduction To Software Development - Implementation
 
Writing code for people
Writing code for peopleWriting code for people
Writing code for people
 
How To Use Selenium Successfully
How To Use Selenium SuccessfullyHow To Use Selenium Successfully
How To Use Selenium Successfully
 
Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1Introduction to the intermediate Python - v1.1
Introduction to the intermediate Python - v1.1
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Design Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best PracticesDesign Like a Pro: Scripting Best Practices
Design Like a Pro: Scripting Best Practices
 
Stapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San FranciscoStapling and patching the web of now - ForwardJS3, San Francisco
Stapling and patching the web of now - ForwardJS3, San Francisco
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
 
Getting Started with Coding
Getting Started with CodingGetting Started with Coding
Getting Started with Coding
 
Writing Readable Code
Writing Readable CodeWriting Readable Code
Writing Readable Code
 
How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....How I Learned to Stop Worrying and Love Legacy Code.....
How I Learned to Stop Worrying and Love Legacy Code.....
 
presentation
presentationpresentation
presentation
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
Add-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his DutyAdd-On Development: EE Expects that Every Developer will do his Duty
Add-On Development: EE Expects that Every Developer will do his Duty
 
presentation
presentationpresentation
presentation
 
Miami2015
Miami2015Miami2015
Miami2015
 
Getting Started with Scripts #HeroConf London 2015
Getting Started with Scripts #HeroConf London 2015Getting Started with Scripts #HeroConf London 2015
Getting Started with Scripts #HeroConf London 2015
 
Sahi Principles and Architecture
Sahi Principles and ArchitectureSahi Principles and Architecture
Sahi Principles and Architecture
 

Writing code for others

  • 1. Writing Code For Others amol.pujari@gslab.com http://www.codinghorror.com/blog/
  • 2. Why Writing Code For Others http://www.makinggoodsoftware.com/
  • 3. why do we write code? •to get it executed by a machine •the machine understands 0s and 1s only •then why do we use high level languages like c, java, or ruby •did the machine request us to use c or ruby? http://sourcemaking.com/
  • 4. we use high level languages so humans can understand code by reading it http://www.makinggoodsoftware.com/2009/07/07/5-top-non-technical-mistakes-made-by-
  • 5. how do others find reading your code? •do they find it helpful in understanding your program –the optimizations you’ve done –your naming conventions, your coding style –how long they should take to do it –more importantly, would they like looking at your code –would they love the way you code •or do they simply find it quite boring http://stackoverflow.com/questions/1711/what-is-the-single-most-influential-book-every-
  • 6. you can help others to quickly read your code and understand it http://www.joelonsoftware.com/articles/Wrong.html
  • 7. characteristics of good code •easy to read •easy to use •clean, simple, straight forward •easy to make any changes •self explanatory •short methods, clear names •consistent coding standards http://www.thoughtclusters.com/2010/09/characteristics-of-great-programmers/
  • 8. writing necessary comments http://www.makinggoodsoftware.com/2009/09/01/programmers-top-10-sentences/
  • 9. writing necessary comments •let’s define “necessary” comments http://en.wikipedia.org/wiki/Code_smell
  • 10. writing necessary comments •should not tell us how code works •but why code works •convert your comments into variable names or function names, constants http://en.wikipedia.org/wiki/Anti-pattern#Programming_anti-patterns
  • 11. follow same indentations •different people love different editors •tab is treated differently by different editors •define tab = 2 or 4 spaces •good if entire team follows same definition of tab http://www.makinggoodsoftware.com/2011/05/23/top-7-programmers-bad-habits/
  • 12. more than indentations http://www.makinggoodsoftware.com/2010/05/27/10-things-they-never-teach-in-college-
  • 13. more than indentations http://www.makinggoodsoftware.com/2010/03/13/my-ten-development-principles/
  • 14. write working pseudo code •write a program •given a number •print “divisible by 3” if it is divisible by 3 •print “divisible by 5 if it is divisible by 5 •print “divisible by 15” if it is divisible by 15 http://www.codinghorror.com/blog/2009/05/pseudocode-or-code.html
  • 15. write working pseudo code •write a program •given a number •print “divisible by 3” if it is divisible by 3 •print “divisible by 5 if it is divisible by 5 •print “divisible by 15” if it is divisible by 15 http://www.codinghorror.com/blog/2009/05/pseudocode-or-code.html
  • 16. write working pseudo code •you might have simply optimized •reducing one divide operation
  • 17. write working pseudo code •write a program •given a number •print “divisible by 3” if it is divisible by 3 •print “divisible by 5 if it is divisible by 5 -a change request print “divisible by 15” if it is divisible by 15 print “divisible by 17” if it is divisible by 17 http://stackoverflow.com/questions/84556/whats-your-favorite-programmer-cartoon
  • 18. write working pseudo code •If pseudo code would have been followed •without optimizations
  • 19. nested if-else http://tinyletter.com/codereading
  • 20. nested if-else •avoid nested if-else chain •use switch or multiple returns •same follows for iterators while, for http://inter-sections.net/2007/11/13/how-to-recognise-a-good-programmer
  • 21. god class •a file or class or a module •knows too much or does too much •contains more than 1000 or 5000 loc •class with a large number of attributes, operations, or both •uses heavy encapsulation http://www.dehora.net/journal/2005/06/writing_code_for_others_that_use_it.html
  • 22. long methods •would you like to read and understand a function which is of 300 lines or say 1000 lines •or would you like to understand functions with 10 lines, 20, say 30 lines at the most http://www.dmst.aueb.gr/dds/pubs/jrnl/2003-ACMQ-CR/html/article.html
  • 23. one function one responsibility http://www.skorks.com/2010/05/why-i-love-reading-other-peoples-code-and-you-should-too/
  • 24. one function one responsibility http://rubylearning.com/blog/2010/11/08/how-does-your-code-smell/
  • 25. long parameters list http://www.codinghorror.com/blog/2006/05/code-smells.html
  • 26. more coding horrors •uncommunicative name - naming functions and variables •magic numbers, hardcoded values •data clumps •feature Envy •middle man …and more http://www.codinghorror.com/blog/2006/05/code-smells.html
  • 27. characteristics of a good code •easy to read •easy to understand •easy to make any changes •clean, simple •looks straight forward •self explanatory •short methods, clear names http://www.perlmonks.org/?node_id=592616
  • 28. characteristics of good code •easy to read •easy to use •clean, simple, straight forward •easy to make any changes •self explanatory •short methods, clear names •consistent coding standards http://www.thoughtclusters.com/2010/09/characteristics-of-great-programmers/
  • 29. characteristics of a good coder •likes to read code written by well known programmers •likes to do code review of junior or senior colleagues •participates in pair programming •learns new things weekly w.r.t. coding •does not make unnecessary complex optimizations •does not refractor working code again and again http://sourcemaking.com/refactoring
  • 30. enjoy coding http://www.artima.com/intv/ruby.html