SlideShare a Scribd company logo
An Introduction To Software
Development Using Python
Spring Semester, 2015
Class #23:
Implementation
So What’s The Goal?
• The goal of any software development effort is to deliver
working software.
• “Implementation” happens when we transform a detailed
design into a valid program.
• This has to do with more than just writing code:
– Tested
– Debugged
– Compiled
– Built into a complete executable product
Image Credit: www.fotosearch.com
What Makes A Good
Implementation?
• Readability – can be easily read an understood by other programmers
• Maintainability – code can be easily modified and maintained
• Performance – the code should run as fast as possible
• Traceability – all code needs to be able to be traced back to a user story
• Correctness – the code needs to do what it is supposed to do
• Completeness – all system requirements must be met
Note that each of these requires a trade off. Performance optimization may
decrease the code’s readability and maintainability…
Image Credit: www.dreamstime.com
Programming Style &
Coding Guidelines
• Pretty much every software organization will have its own
coding guidelines.
• Guidelines cover such topics as naming, indentation, and
commenting styles. Many development tools can be
programmed to implement these styles.
• Most of these are not very important – it’s just a matter of
getting used to a given style. The goal is to be consistent in
order to help others later on avoid confusion when debugging
or maintaining the code.
Image Credit: www.dreamstime.com
Programming Style &
Coding Guidelines
• Guidelines should cover error messages. You want your error
messages to be clear to users but to also contain information
that programmers can use while debugging to find out where
the error message came from.
• Banning parts of a language that have been found to cause
lots of problems is also common (e.g. multiple inheritance).
Depreciated language features are also banned. Code must
compile with no warnings.
• Your goals for maintaining a good coding style are to be
consistent and to try to highlight the meaning of your code.
Image Credit: www.clipartpanda.com
Coding Style Recommendations
• Naming: one of the most important issues in
improving readability and maintainability.
– Bad names will require additional comments and may
mislead the reader
– Good names == good understanding
– Use long names for global variables and short names for
local variables
– Consistency is king: use the same word for a given concept
(“patient” not “customer”)
– Multicultural / multi-language teams may have special
challenges
Image Credit: www.clipartpanda.com
Coding Style Recommendations
• Separating Words & Capitalization: since
spaces can’t be used to separate words that
make up a variable name, different
programming languages have different
conventions
– C: lowercase with underscores: patient_name
– Java: no separation with capitalization:
patientName
Image Credit: www.clipartpanda.com
Coding Style Recommendations
• Indentation & Spacing: adding horizontal space
before a line in order to better reflect the structure
of the code
– Indentation affects both readability and maintainability
– A common style should be defined and all programmers
should follow it.
– The most important issue is consistency
– Most languages have a defacto indentation style that is
defined in the primary language reference
Image Credit: www.clipartpanda.com
Coding Style Recommendations
• Function Size: studies have shown that larger
functions are more error prone than smaller
functions
– Being able to look at an entire function at one
time helps with readability and maintainability
– Limit the size of a function to around 50 lines of
code
– This helps a function fit onto a single page
Image Credit: www.clipartbest.com
Coding Style Recommendations
• Unique Language Features: Different
languages support different features which
can be misused and need special precautions.
– Example: GOTO and multiple inheritance
– In Python, exceptions handling using TRY
EXCEPTION and FINALLY might be one such
situation.
Image Credit: www.clipartbest.com
Comments
• Comments are important
• Comments can help or hurt program readability and
maintainability.
• Two main problem with comments:
– They may distract from the code and make a section more difficult to
read
– They may be wrong
• Comments may become outdated as the code changes.
• Comments may be wrong from the start because they are
never executed/tested.
Image Credit: www.clipartpanda.com
6 Different Types Of Comments
• Repeat of the code – done by new programmers and should be avoided.
These comments waste effort and distract the user
(e.g. “increment index by 1”)
• Explanation of the code – explain what complex code does in human
language. Code that is this complex should probably be rewritten.
• Marker in the code – markers in the code indicate incomplete items,
opportunities for improvement, etc. Must be removed before production.
• Summary of the code – Comments that summarize what the code does
are helpful, but they need to be kept up-to-date
• Description of the code intent – most valuable. They describe what the
code should do, not what it does.
• External references – link code to external entities Image Credit: www.liveattherock.com
Comments Are A Trade-Off
• We need to recognize the trade-off that comments represent.
• Comments can help to clarify code and relate it to other
sources.
• They also represent some level of duplication of the code.
• It takes time to both create them and then to maintain them.
• Comment errors can be very hard to both find and correct.
Image Credit: www.fotosearch.com
Comment Dangers!
• Comments can be used to justify bad coding practices
• Programmers may be tempted to create code that is too
complicated or too hard to maintain and then add comments
to it instead of rewriting it to better coding standards.
• An alternative: code that is so well written that it documents
itself (“self documenting code”).
• Good goal, but comments still have a place in capturing the
programmer’s intent.
Image Credit: www.clipartof.com
Debugging
• Debugging is all about locating and fixing
errors in the code.
• Generally errors are found by testing, but they
can also be reported by users or code
inspections.
• Debugging is a highly iterative process.
Image Credit: www.clker.com
4 Phases In The Debugging Process
• Reproduction: Be able to reproduce the error
in a given configuration. Find out the
conditions that lead to the error by
constructing a minimal test case. Don’t care
about the code.
• May find some cases where code works
correctly.
• Always try to write simpler tests that still fail.
Image Credit: www.clker.com
4 Phases In The Debugging Process
• Localization: Finding the sections of the code
that lead to the error.
• Generally, this is the hardest part to do.
• If the reproduction phase shows a very simple
test case, then this may easier to do.
Image Credit: driverlayer.com
4 Phases In The Debugging Process
• Correction: Changing the code to fix the error.
• If you truly understand what is causing the
error, you have a good chance of being able to
fix it.
• Common mistake – trying to fix the problem
when you don’t know what it is or where it is.
– Leads to random changes
– Results in more errors
Image Credit: www.iconseeker.com
4 Phases In The Debugging Process
• Verification: Making sure that the error is
fixed.
• Make sure that no new errors were introduced
into the code.
• All too often the fix does not fix the problem,
but does cause other problems.
Image Credit: tech-kid.com
Two Types Of Errors In Programs
• Syntax Errors
– Found by the complier
– Compiler tells you what their source is
• Logic Errors
– Harder to find
– Need to understand what the code is both trying
to do and is actually doing
Image Credit: www.clker.com
Debugging Tools
• Source code comparators – show you what changed
• Extended checkers – find errors with syntax, logic, or
style
• Interactive debuggers – let you step through code
and inspect variables
• Specialty Libraries – provide extra safeguards to
detect and prevent errors
• Profiler Tools - describe pre and post conditions
Image Credit: www.clipartsfree.net
Assertions &
Defensive Programming
• Precondition – something that your code
needs in order to create correct results
• Postcondition – a condition that should hold
true after executing your code
• Assertions - statements that check a condition
and product an error if the condition is not
met (e.g. a checking account balance)
Image Credit: www.easyvectors.com
Performance Optimization
• Performance for any program is important, but…
• Optimizing for performance almost always affects code maintainability
and readability for the worse.
• Real-time systems are the exception – they are all about performance.
• Programmers often make the mistake of worrying about performance too
early in the development cycle.
– Get the code to work first and make it easy to maintain
– If the performance is unsatisfactory, then you can optimize performance – most times
this won’t be an issue.
– Most code is only executed a few times and does not impact performance
– Only a few pieces of code will have to be optimized for performance
Image Credit: www.istockphoto.com
How To Optimize Performance
• Start with a profiler tool
– Runs the program and calculates how much time is spent in each part.
– Helps you to find bottlenecks and to determine what code needs to be
optimized
• Now review and optimize only those modules that will have
an impact on performance
• After making changes, run the profiler again to determine
impact and to ensure changes actually boosted performance.
Image Credit: www.dreamstime.com
The Cost Of Optimization
• A cost / benefit analysis should be done before
performing any performance optimization.
• A programmer’s time is more expensive than
computer time – it may be cheaper to just buy faster
hardware.
• You need to weigh the increase in performance
against the decrease in maintainability and the
possibility of introducing errors.
Image Credit: www.clipartpanda.com
Refactoring
• Just like a novel can be made better by rewriting parts, so to
can your code be made better by refactoring parts of it.
• Refactoring refers to improving your code style without
altering its behavior.
• Refactoring is one of the most powerful techniques for
producing good code.
• Reasons to refactor:
– Duplicated code
– Excessively large or long functions
– Etc.
Image Credit: publicdomainvectors.org
What Do You Do When You
Refactor?
• Turn a code fragment in to a standalone function
with its own name and calls to it.
• Replace the body of a function with a new algorithm
that is clearer and which returns the same results.
• Move an algorithm from one function to another
where it makes more sense
• Divide a function into two functions.
Image Credit: publicdomainvectors.org
What We Covered Today
1. Programming style &
coding guidelines
2. Comments
3. Debugging
4. Optimization
5. Refactoring
Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/
What We’ll Be Covering Next Time
1. Software Support and
Maintenance
Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/
Ad

More Related Content

What's hot (17)

Xp Slideshow
Xp SlideshowXp Slideshow
Xp Slideshow
guest1c30ed5
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
Imran Hossain
 
Software development slides
Software development slidesSoftware development slides
Software development slides
iarthur
 
SitFRA - No Comment?
SitFRA - No Comment?SitFRA - No Comment?
SitFRA - No Comment?
Laurens van Rijn
 
Software coding & testing, software engineering
Software coding & testing, software engineeringSoftware coding & testing, software engineering
Software coding & testing, software engineering
Rupesh Vaishnav
 
xTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis ZeherovićxTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis Zeherović
Bosnia Agile
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of code
Shwe Yee
 
Cqrs and Event Sourcing Intro For Developers
Cqrs and Event Sourcing Intro For DevelopersCqrs and Event Sourcing Intro For Developers
Cqrs and Event Sourcing Intro For Developers
wojtek_s
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
Ali Raza
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
poojapainter
 
An Evaluation of Pair Programming Practice
An Evaluation of Pair Programming PracticeAn Evaluation of Pair Programming Practice
An Evaluation of Pair Programming Practice
Kranthi Lakum
 
Language-Oriented Business Applications
Language-Oriented Business ApplicationsLanguage-Oriented Business Applications
Language-Oriented Business Applications
Markus Voelter
 
Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)
Markus Voelter
 
Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !
Vinit Kumar Singh
 
Code Inspection
Code InspectionCode Inspection
Code Inspection
Fáber D. Giraldo
 
Test-driven development with Node.js
Test-driven development with Node.jsTest-driven development with Node.js
Test-driven development with Node.js
Mirko Kiefer
 
Professionalism and Industry Expectations related to IT industry
Professionalism and Industry Expectations related to IT industry  Professionalism and Industry Expectations related to IT industry
Professionalism and Industry Expectations related to IT industry
Tharindu Weerasinghe
 
Compiler vs interpreter
Compiler vs interpreterCompiler vs interpreter
Compiler vs interpreter
Imran Hossain
 
Software development slides
Software development slidesSoftware development slides
Software development slides
iarthur
 
Software coding & testing, software engineering
Software coding & testing, software engineeringSoftware coding & testing, software engineering
Software coding & testing, software engineering
Rupesh Vaishnav
 
xTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis ZeherovićxTreme Programming by Sejo Ćesić and Enis Zeherović
xTreme Programming by Sejo Ćesić and Enis Zeherović
Bosnia Agile
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of code
Shwe Yee
 
Cqrs and Event Sourcing Intro For Developers
Cqrs and Event Sourcing Intro For DevelopersCqrs and Event Sourcing Intro For Developers
Cqrs and Event Sourcing Intro For Developers
wojtek_s
 
Software programming and development
Software programming and developmentSoftware programming and development
Software programming and development
Ali Raza
 
Introduction to compiler interpreter
Introduction to compiler interpreterIntroduction to compiler interpreter
Introduction to compiler interpreter
poojapainter
 
An Evaluation of Pair Programming Practice
An Evaluation of Pair Programming PracticeAn Evaluation of Pair Programming Practice
An Evaluation of Pair Programming Practice
Kranthi Lakum
 
Language-Oriented Business Applications
Language-Oriented Business ApplicationsLanguage-Oriented Business Applications
Language-Oriented Business Applications
Markus Voelter
 
Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)Generic Tools - Specific Languages (PhD Defense Slides)
Generic Tools - Specific Languages (PhD Defense Slides)
Markus Voelter
 
Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !Extreme programming - a quick and agile overview !
Extreme programming - a quick and agile overview !
Vinit Kumar Singh
 
Test-driven development with Node.js
Test-driven development with Node.jsTest-driven development with Node.js
Test-driven development with Node.js
Mirko Kiefer
 
Professionalism and Industry Expectations related to IT industry
Professionalism and Industry Expectations related to IT industry  Professionalism and Industry Expectations related to IT industry
Professionalism and Industry Expectations related to IT industry
Tharindu Weerasinghe
 

Viewers also liked (16)

An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
An Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List AlgorithmsAn Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List Algorithms
Blue Elephant Consulting
 
An Introduction To Python - Dictionaries
An Introduction To Python - DictionariesAn Introduction To Python - Dictionaries
An Introduction To Python - Dictionaries
Blue Elephant Consulting
 
An Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple AlternativesAn Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple Alternatives
Blue Elephant Consulting
 
An Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm ReviewAn Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm Review
Blue Elephant Consulting
 
An Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and MaintenanceAn Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and Maintenance
Blue Elephant Consulting
 
An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1An Introduction To Python - Lists, Part 1
An Introduction To Python - Lists, Part 1
Blue Elephant Consulting
 
An Introduction To Python - FOR Loop
An Introduction To Python - FOR LoopAn Introduction To Python - FOR Loop
An Introduction To Python - FOR Loop
Blue Elephant Consulting
 
An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2An Introduction To Python - Lists, Part 2
An Introduction To Python - Lists, Part 2
Blue Elephant Consulting
 
An Introduction To Python - WHILE Loop
An Introduction To  Python - WHILE LoopAn Introduction To  Python - WHILE Loop
An Introduction To Python - WHILE Loop
Blue Elephant Consulting
 
An Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed DesignAn Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed Design
Blue Elephant Consulting
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
Blue Elephant Consulting
 
An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2
Blue Elephant Consulting
 
An Introduction To Python - Graphics
An Introduction To Python - GraphicsAn Introduction To Python - Graphics
An Introduction To Python - Graphics
Blue Elephant Consulting
 
An Introduction To Python - Files, Part 1
An Introduction To Python - Files, Part 1An Introduction To Python - Files, Part 1
An Introduction To Python - Files, Part 1
Blue Elephant Consulting
 
An Introduction To Python - Working With Data
An Introduction To Python - Working With DataAn Introduction To Python - Working With Data
An Introduction To Python - Working With Data
Blue Elephant Consulting
 
An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()An Introduction To Python - Python, Print()
An Introduction To Python - Python, Print()
Blue Elephant Consulting
 
An Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List AlgorithmsAn Introduction To Python - Tables, List Algorithms
An Introduction To Python - Tables, List Algorithms
Blue Elephant Consulting
 
An Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple AlternativesAn Introduction To Python - Nested Branches, Multiple Alternatives
An Introduction To Python - Nested Branches, Multiple Alternatives
Blue Elephant Consulting
 
An Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm ReviewAn Introduction To Python - Python Midterm Review
An Introduction To Python - Python Midterm Review
Blue Elephant Consulting
 
An Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and MaintenanceAn Introduction To Software Development - Software Support and Maintenance
An Introduction To Software Development - Software Support and Maintenance
Blue Elephant Consulting
 
An Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed DesignAn Introduction To Software Development - Architecture & Detailed Design
An Introduction To Software Development - Architecture & Detailed Design
Blue Elephant Consulting
 
An Introduction To Python - Variables, Math
An Introduction To Python - Variables, MathAn Introduction To Python - Variables, Math
An Introduction To Python - Variables, Math
Blue Elephant Consulting
 
An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2An Introduction To Python - Functions, Part 2
An Introduction To Python - Functions, Part 2
Blue Elephant Consulting
 
An Introduction To Python - Working With Data
An Introduction To Python - Working With DataAn Introduction To Python - Working With Data
An Introduction To Python - Working With Data
Blue Elephant Consulting
 
Ad

Similar to An Introduction To Software Development - Implementation (20)

An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
Blue Elephant Consulting
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
Shafiul Azam Chowdhury
 
Topic production code
Topic production codeTopic production code
Topic production code
Kavi Kumar
 
Expert Code Review best practices
Expert Code Review best practicesExpert Code Review best practices
Expert Code Review best practices
jeetendra mandal
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
bsadd
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
André Pitombeira
 
Unit iv
Unit ivUnit iv
Unit iv
Sangeetha Rangarajan
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
Ahmet Bulut
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
PostSharp Technologies
 
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It IsAmanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Rehgan Avon
 
Software Chapter 5 software testing.pptx
Software Chapter 5 software testing.pptxSoftware Chapter 5 software testing.pptx
Software Chapter 5 software testing.pptx
JeelChheta
 
Coding
CodingCoding
Coding
Vishal Singh
 
Unit_5 and Unit 6.pptx
Unit_5 and Unit 6.pptxUnit_5 and Unit 6.pptx
Unit_5 and Unit 6.pptx
taxegap762
 
Code Review
Code ReviewCode Review
Code Review
Ravi Raj
 
Java Code Quality Tools
Java Code Quality ToolsJava Code Quality Tools
Java Code Quality Tools
Сергей Гоменюк
 
Twelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btechTwelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btech
IIITA
 
Coding - SDLC Model
Coding - SDLC ModelCoding - SDLC Model
Coding - SDLC Model
Amity University | FMS - DU | IMT | Stratford University | KKMI International Institute | AIMA | DTU
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
ikram_ahamed
 
Python: Object-oriented Testing
Python: Object-oriented TestingPython: Object-oriented Testing
Python: Object-oriented Testing
Damian T. Gordon
 
Programming Development LifeCycle11.pptx
Programming Development LifeCycle11.pptxProgramming Development LifeCycle11.pptx
Programming Development LifeCycle11.pptx
hassanbokhari14
 
An Introduction To Software Development - Final Review
An Introduction To Software Development - Final ReviewAn Introduction To Software Development - Final Review
An Introduction To Software Development - Final Review
Blue Elephant Consulting
 
Introducing systems analysis, design & development Concepts
Introducing systems analysis, design & development ConceptsIntroducing systems analysis, design & development Concepts
Introducing systems analysis, design & development Concepts
Shafiul Azam Chowdhury
 
Topic production code
Topic production codeTopic production code
Topic production code
Kavi Kumar
 
Expert Code Review best practices
Expert Code Review best practicesExpert Code Review best practices
Expert Code Review best practices
jeetendra mandal
 
Introducing Systems Analysis Design Development
Introducing Systems Analysis Design DevelopmentIntroducing Systems Analysis Design Development
Introducing Systems Analysis Design Development
bsadd
 
Best Practices in Software Development
Best Practices in Software DevelopmentBest Practices in Software Development
Best Practices in Software Development
André Pitombeira
 
Agile Software Development
Agile Software DevelopmentAgile Software Development
Agile Software Development
Ahmet Bulut
 
10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming10 Reasons You MUST Consider Pattern-Aware Programming
10 Reasons You MUST Consider Pattern-Aware Programming
PostSharp Technologies
 
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It IsAmanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Amanda Cinnamon - Treat Your Code Like the Valuable Software It Is
Rehgan Avon
 
Software Chapter 5 software testing.pptx
Software Chapter 5 software testing.pptxSoftware Chapter 5 software testing.pptx
Software Chapter 5 software testing.pptx
JeelChheta
 
Unit_5 and Unit 6.pptx
Unit_5 and Unit 6.pptxUnit_5 and Unit 6.pptx
Unit_5 and Unit 6.pptx
taxegap762
 
Code Review
Code ReviewCode Review
Code Review
Ravi Raj
 
Twelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btechTwelve practices of XP_Se lect5 btech
Twelve practices of XP_Se lect5 btech
IIITA
 
Indy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-muleIndy meetup#7 effective unit-testing-mule
Indy meetup#7 effective unit-testing-mule
ikram_ahamed
 
Python: Object-oriented Testing
Python: Object-oriented TestingPython: Object-oriented Testing
Python: Object-oriented Testing
Damian T. Gordon
 
Programming Development LifeCycle11.pptx
Programming Development LifeCycle11.pptxProgramming Development LifeCycle11.pptx
Programming Development LifeCycle11.pptx
hassanbokhari14
 
Ad

Recently uploaded (20)

One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 5-3-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 5-3-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
Political History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptxPolitical History of Pala dynasty Pala Rulers NEP.pptx
Political History of Pala dynasty Pala Rulers NEP.pptx
Arya Mahila P. G. College, Banaras Hindu University, Varanasi, India.
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
One Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learningOne Hot encoding a revolution in Machine learning
One Hot encoding a revolution in Machine learning
momer9505
 
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar RabbiPresentation on Tourism Product Development By Md Shaifullar Rabbi
Presentation on Tourism Product Development By Md Shaifullar Rabbi
Md Shaifullar Rabbi
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
Quality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdfQuality Contril Analysis of Containers.pdf
Quality Contril Analysis of Containers.pdf
Dr. Bindiya Chauhan
 
Social Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy StudentsSocial Problem-Unemployment .pptx notes for Physiotherapy Students
Social Problem-Unemployment .pptx notes for Physiotherapy Students
DrNidhiAgarwal
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public SchoolsK12 Tableau Tuesday  - Algebra Equity and Access in Atlanta Public Schools
K12 Tableau Tuesday - Algebra Equity and Access in Atlanta Public Schools
dogden2
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
Sinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_NameSinhala_Male_Names.pdf Sinhala_Male_Name
Sinhala_Male_Names.pdf Sinhala_Male_Name
keshanf79
 
Odoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo SlidesOdoo Inventory Rules and Routes v17 - Odoo Slides
Odoo Inventory Rules and Routes v17 - Odoo Slides
Celine George
 
Geography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjectsGeography Sem II Unit 1C Correlation of Geography with other school subjects
Geography Sem II Unit 1C Correlation of Geography with other school subjects
ProfDrShaikhImran
 
apa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdfapa-style-referencing-visual-guide-2025.pdf
apa-style-referencing-visual-guide-2025.pdf
Ishika Ghosh
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam SuccessUltimate VMware 2V0-11.25 Exam Dumps for Exam Success
Ultimate VMware 2V0-11.25 Exam Dumps for Exam Success
Mark Soia
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 

An Introduction To Software Development - Implementation

  • 1. An Introduction To Software Development Using Python Spring Semester, 2015 Class #23: Implementation
  • 2. So What’s The Goal? • The goal of any software development effort is to deliver working software. • “Implementation” happens when we transform a detailed design into a valid program. • This has to do with more than just writing code: – Tested – Debugged – Compiled – Built into a complete executable product Image Credit: www.fotosearch.com
  • 3. What Makes A Good Implementation? • Readability – can be easily read an understood by other programmers • Maintainability – code can be easily modified and maintained • Performance – the code should run as fast as possible • Traceability – all code needs to be able to be traced back to a user story • Correctness – the code needs to do what it is supposed to do • Completeness – all system requirements must be met Note that each of these requires a trade off. Performance optimization may decrease the code’s readability and maintainability… Image Credit: www.dreamstime.com
  • 4. Programming Style & Coding Guidelines • Pretty much every software organization will have its own coding guidelines. • Guidelines cover such topics as naming, indentation, and commenting styles. Many development tools can be programmed to implement these styles. • Most of these are not very important – it’s just a matter of getting used to a given style. The goal is to be consistent in order to help others later on avoid confusion when debugging or maintaining the code. Image Credit: www.dreamstime.com
  • 5. Programming Style & Coding Guidelines • Guidelines should cover error messages. You want your error messages to be clear to users but to also contain information that programmers can use while debugging to find out where the error message came from. • Banning parts of a language that have been found to cause lots of problems is also common (e.g. multiple inheritance). Depreciated language features are also banned. Code must compile with no warnings. • Your goals for maintaining a good coding style are to be consistent and to try to highlight the meaning of your code. Image Credit: www.clipartpanda.com
  • 6. Coding Style Recommendations • Naming: one of the most important issues in improving readability and maintainability. – Bad names will require additional comments and may mislead the reader – Good names == good understanding – Use long names for global variables and short names for local variables – Consistency is king: use the same word for a given concept (“patient” not “customer”) – Multicultural / multi-language teams may have special challenges Image Credit: www.clipartpanda.com
  • 7. Coding Style Recommendations • Separating Words & Capitalization: since spaces can’t be used to separate words that make up a variable name, different programming languages have different conventions – C: lowercase with underscores: patient_name – Java: no separation with capitalization: patientName Image Credit: www.clipartpanda.com
  • 8. Coding Style Recommendations • Indentation & Spacing: adding horizontal space before a line in order to better reflect the structure of the code – Indentation affects both readability and maintainability – A common style should be defined and all programmers should follow it. – The most important issue is consistency – Most languages have a defacto indentation style that is defined in the primary language reference Image Credit: www.clipartpanda.com
  • 9. Coding Style Recommendations • Function Size: studies have shown that larger functions are more error prone than smaller functions – Being able to look at an entire function at one time helps with readability and maintainability – Limit the size of a function to around 50 lines of code – This helps a function fit onto a single page Image Credit: www.clipartbest.com
  • 10. Coding Style Recommendations • Unique Language Features: Different languages support different features which can be misused and need special precautions. – Example: GOTO and multiple inheritance – In Python, exceptions handling using TRY EXCEPTION and FINALLY might be one such situation. Image Credit: www.clipartbest.com
  • 11. Comments • Comments are important • Comments can help or hurt program readability and maintainability. • Two main problem with comments: – They may distract from the code and make a section more difficult to read – They may be wrong • Comments may become outdated as the code changes. • Comments may be wrong from the start because they are never executed/tested. Image Credit: www.clipartpanda.com
  • 12. 6 Different Types Of Comments • Repeat of the code – done by new programmers and should be avoided. These comments waste effort and distract the user (e.g. “increment index by 1”) • Explanation of the code – explain what complex code does in human language. Code that is this complex should probably be rewritten. • Marker in the code – markers in the code indicate incomplete items, opportunities for improvement, etc. Must be removed before production. • Summary of the code – Comments that summarize what the code does are helpful, but they need to be kept up-to-date • Description of the code intent – most valuable. They describe what the code should do, not what it does. • External references – link code to external entities Image Credit: www.liveattherock.com
  • 13. Comments Are A Trade-Off • We need to recognize the trade-off that comments represent. • Comments can help to clarify code and relate it to other sources. • They also represent some level of duplication of the code. • It takes time to both create them and then to maintain them. • Comment errors can be very hard to both find and correct. Image Credit: www.fotosearch.com
  • 14. Comment Dangers! • Comments can be used to justify bad coding practices • Programmers may be tempted to create code that is too complicated or too hard to maintain and then add comments to it instead of rewriting it to better coding standards. • An alternative: code that is so well written that it documents itself (“self documenting code”). • Good goal, but comments still have a place in capturing the programmer’s intent. Image Credit: www.clipartof.com
  • 15. Debugging • Debugging is all about locating and fixing errors in the code. • Generally errors are found by testing, but they can also be reported by users or code inspections. • Debugging is a highly iterative process. Image Credit: www.clker.com
  • 16. 4 Phases In The Debugging Process • Reproduction: Be able to reproduce the error in a given configuration. Find out the conditions that lead to the error by constructing a minimal test case. Don’t care about the code. • May find some cases where code works correctly. • Always try to write simpler tests that still fail. Image Credit: www.clker.com
  • 17. 4 Phases In The Debugging Process • Localization: Finding the sections of the code that lead to the error. • Generally, this is the hardest part to do. • If the reproduction phase shows a very simple test case, then this may easier to do. Image Credit: driverlayer.com
  • 18. 4 Phases In The Debugging Process • Correction: Changing the code to fix the error. • If you truly understand what is causing the error, you have a good chance of being able to fix it. • Common mistake – trying to fix the problem when you don’t know what it is or where it is. – Leads to random changes – Results in more errors Image Credit: www.iconseeker.com
  • 19. 4 Phases In The Debugging Process • Verification: Making sure that the error is fixed. • Make sure that no new errors were introduced into the code. • All too often the fix does not fix the problem, but does cause other problems. Image Credit: tech-kid.com
  • 20. Two Types Of Errors In Programs • Syntax Errors – Found by the complier – Compiler tells you what their source is • Logic Errors – Harder to find – Need to understand what the code is both trying to do and is actually doing Image Credit: www.clker.com
  • 21. Debugging Tools • Source code comparators – show you what changed • Extended checkers – find errors with syntax, logic, or style • Interactive debuggers – let you step through code and inspect variables • Specialty Libraries – provide extra safeguards to detect and prevent errors • Profiler Tools - describe pre and post conditions Image Credit: www.clipartsfree.net
  • 22. Assertions & Defensive Programming • Precondition – something that your code needs in order to create correct results • Postcondition – a condition that should hold true after executing your code • Assertions - statements that check a condition and product an error if the condition is not met (e.g. a checking account balance) Image Credit: www.easyvectors.com
  • 23. Performance Optimization • Performance for any program is important, but… • Optimizing for performance almost always affects code maintainability and readability for the worse. • Real-time systems are the exception – they are all about performance. • Programmers often make the mistake of worrying about performance too early in the development cycle. – Get the code to work first and make it easy to maintain – If the performance is unsatisfactory, then you can optimize performance – most times this won’t be an issue. – Most code is only executed a few times and does not impact performance – Only a few pieces of code will have to be optimized for performance Image Credit: www.istockphoto.com
  • 24. How To Optimize Performance • Start with a profiler tool – Runs the program and calculates how much time is spent in each part. – Helps you to find bottlenecks and to determine what code needs to be optimized • Now review and optimize only those modules that will have an impact on performance • After making changes, run the profiler again to determine impact and to ensure changes actually boosted performance. Image Credit: www.dreamstime.com
  • 25. The Cost Of Optimization • A cost / benefit analysis should be done before performing any performance optimization. • A programmer’s time is more expensive than computer time – it may be cheaper to just buy faster hardware. • You need to weigh the increase in performance against the decrease in maintainability and the possibility of introducing errors. Image Credit: www.clipartpanda.com
  • 26. Refactoring • Just like a novel can be made better by rewriting parts, so to can your code be made better by refactoring parts of it. • Refactoring refers to improving your code style without altering its behavior. • Refactoring is one of the most powerful techniques for producing good code. • Reasons to refactor: – Duplicated code – Excessively large or long functions – Etc. Image Credit: publicdomainvectors.org
  • 27. What Do You Do When You Refactor? • Turn a code fragment in to a standalone function with its own name and calls to it. • Replace the body of a function with a new algorithm that is clearer and which returns the same results. • Move an algorithm from one function to another where it makes more sense • Divide a function into two functions. Image Credit: publicdomainvectors.org
  • 28. What We Covered Today 1. Programming style & coding guidelines 2. Comments 3. Debugging 4. Optimization 5. Refactoring Image Credit: http://www.tswdj.com/blog/2011/05/17/the-grooms-checklist/
  • 29. What We’ll Be Covering Next Time 1. Software Support and Maintenance Image Credit: http://merchantblog.thefind.com/2011/01/merchant-newsletter/resolve-to-take-advantage-of-these-5-e-commerce-trends/attachment/crystal-ball-fullsize/

Editor's Notes

  • #2: New name for the class I know what this means Technical professionals are who get hired This means much more than just having a narrow vertical knowledge of some subject area. It means that you know how to produce an outcome that I value. I’m willing to pay you to do that.