Code Quality

543 views
313 views

Published on

Code Quality presentation going through different practices that improves code quality on a project

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
543
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
7
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Code Quality

  1. 1. Code Quality François Camus
  2. 2. Why?  Maintenance is what is most expensive in software life time  Once in production it is harder to apply fixes  Need to ensure best code quality as we don't know what changes will need to be made in the future and who will be making those changes  Better to spend a bit more time now to make it readable and understandable by anyone, than struggle later with the risk of wasting a lot more time, or even having to re- write
  3. 3. Clean Code Bible
  4. 4. Some Clean Code Principles  Boy Scout rule  "Leave the campground cleaner than you found it."  DRY: Don't Repeat Yourself  To avoid code duplication  Dependency Injection pattern...  SRP: Single Responsibility Principles  "Functions should do one thing. They should do it well. They should do it only." - Robert C. Martin  Other interesting principles (SOLID...)  http://butunclebob.com/ArticleS.UncleBob.PrinciplesOfOod
  5. 5. Famous Quotes  "Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live" - Rick Osborne  "Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler  "When you feel the need to write a comment, first try to refactor the code so that any comment becomes superfluous" - Martin Fowler  Clean Code Quotes by Robert C. Martin  "Later equals never."  "The only way to make the deadline -- the only way to go fast -- is to keep the code as clean as possible at all times."  "Clean code always looks like it was written by someone who cares."  Some more: http://alvinalexander.com/programming/clean-code-quotes-robert- c-martin
  6. 6. Pair Programming  Two developers on same computer  Driver: Writes the code  Navigator: Reviews what’s being typed  Need to switch roles often  Can be useful when designing complex part of a system or when fixing bugs  Advantages  Better code quality (constant reviewing)  Less code (constant refactoring)  Better communication within the team (knowledge transfer)  Anger Management  Developers need diplomacy, humility and open-mindness  Not easy to accept criticism  Time Management  Podomoro Technique (switch every 20 minutes with 5 minutes break in between)  Avoid long sessions as it's quite tiring  Possible trigger: “Hey mate I need another pair of eyes.”
  7. 7. Code Review  Better before commit to avoid crappy commits  Review process  Demo new functionality  Show all unit tests pass  Go through all modified, added, deleted files  Need small and regular commits to avoid long sessions  Reviewer should be able to quickly spot complex parts of the code that needs refactoring to ease future maintenance  Can also ask to test in certain conditions  Reviewer only provides suggestions
  8. 8. Unit Testing/TDD  To ease software changes and avoid invisible breaking changes  Better flexibility, reusability  Better robustness  Safety net  Developers not scared of making changes  TDD vs Change and Pray Development  Based on Dependency Injection pattern
  9. 9. Things to improve  Build server to run unit tests (C# and javascript)  Better practice of pair programming and code review  Involve QA team  Choose coding standard common to all teams  Microsoft coding standards for C# (online)  Measuring software quality punctually via build server  Number of bugs, test coverage, code duplication...  Do some brown bag sessions  Concentrating on specific subject to educate developers  For example, watching Uncle Bob’s videos on clean code
  10. 10. Things to improve  Build server to run unit tests (C# and javascript)  Better practice of pair programming and code review  Involve QA team  Choose coding standard common to all teams  Microsoft coding standards for C# (online)  Measuring software quality punctually via build server  Number of bugs, test coverage, code duplication...  Do some brown bag sessions  Concentrating on specific subject to educate developers  For example, watching Uncle Bob’s videos on clean code

×