Upload
kosala-nuwan-perera
View
117
Download
3
Tags:
Embed Size (px)
DESCRIPTION
A computer program is the most complicated thing on earth, second to a woman's brain. They get outdated more often than women fashion. Maybe it breaks down. Maybe a better program is created to replace it - happens all the time. It is wise to keep an eye on the costs, the technical debt, the cost of change, and the respond to change. It is not easy to teach good practices but it is not hard to teach bad programming practices. Writing quality code is now more than just following simple set of guidelines. There are more principles, and ethics, and discipline in it. When you are matured with these principles and patterns it will become difficult for you to think without those.
Citation preview
Code Quality@kosalanuwan
get some paper, put it in a typewriter,type FADE IN ... and keep typing
- Peter Falk told to Paul Reiser
A computer program is the most complicated thing on
earth, second to a woman's brain
- Marvin Silva
PRE DEMO: What it looks like
Maybe it breaks down. Maybe a better program is
createdto replace it - happens all the
time- The Oracle told to Neo
Why do you have to care? - Understandability- Readability- Changeability- Extensibility- Maintainability
The costs: - Respond to change- Cost of change- Technical debt
How do you write bad code? - Rigid- Fragile- Immobility- Design debt : Technical debt by taking shortcuts?
- Environment debt : Technical debt by not running build, test, and other tasks
- Needless complexity- Needless repetition- Opacity
I know it when I see it!- KP told to The Wife
My gut says it’s clean, so I believe it
- KP
When you are matured with these principles and patterns it will become difficult for you to think without those
- KP
Where to begin?
- Good IDE- Static analysis tools- Builds- Test automation tools- Source control- Continuous integration
DEMO: Code Analysis
How to practice? - Code kata- Pair programming- Design/Code reviews- Peer reviews
Other things that go with it? - KISS- Boy scout rule- Root cause analysis- Following standard conventions- Class design principles
What can you do TODAY? - Naming conventions- Methods- Design principles- Dependency injection- Encapsulate conditionals- Polymorphism to If/Else or
Switch/Case- Exception over return codes
DEMO: Standard naming conventions
DEMO: Methods
DEMO: Query from command
DEMO: DRY up yourself
DEMO: Dependency injection by hand
DEMO: Encapsulate various things
DEMO: Polymorphics
DEMO: Replacing errors and exceptions
Do you swear to write software, the whole software and nothing but well-crafted
softwareso help you God!
- The Software Craftsmanship Oath
Happy Coding @kosalanuwan
http://kosalanuwan.tumblr.com/
Code Kata: - Reverse my array- Fizz Buzz
New requirements: - Optimize, don’t use any other
arrays