Clean Code @Agileworks Romania 2013 05 23


Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Clean Code @Agileworks Romania 2013 05 23

  1. 1. Clean Code
  2. 2. Clean Code Adi Boboacă @adibolb Alex Bolboacă @alexboly
  3. 3. Clean Code
  4. 4. Clean Code Code is more often read than written
  5. 5. Clean Code – Environment Build Requires One Step Build time is manageable Tests Execution Requires One Step Always Use Source Control Have Continuous Integration
  6. 6. Code Smell Sniffable Easy to spot Does not always indicate a problem
  7. 7. Code Smell A code smell is a hint that shows you might have a problem in your system. '
  8. 8. Coding Smells - Design Misplaced Responsibility Code at Wrong abstraction Level Fields Define Temp Variables Hidden Temporal Coupling Over-engineering Usage of Singleton / Statics / new Interface Has Too Many Methods
  9. 9. Clean Code - Design Be Precise Don't Be Arbitrary Keep Configuration at High Levels Prefer Polymorphism Over conditionals Prefer Composition Over Inheritance S.O.L.I.D.
  10. 10. Coding Smells – Naming There Are Several Naming Standards More Names Mean The Same Concept Someone Needs To Explain You The Code
  11. 11. Clean Code – Naming Use Standards For The Language Names Use Domain Language Names Describe The Intention Names Do Not Use Hungarian Notation Names Do Not Contain Encodings
  12. 12. Coding Smells - Methods Method Has More Than 3 Indents Method Uses Getters From Other Classes There Are Static Method Methods & Ctors Have More Than 3 Args Arguments Have out Or ref
  13. 13. Clean Code - Methods Have Only One Responsibility Use Only Internal State (No Feature Envy) Avoid Static Have Maximum Two Arguments Do Not Pass Reference As Arguments
  14. 14. Coding Smells - Variables You see a, i, bla, etc. As Variables You see string, int, float, In Classes There Are Static Variables In Classes Use Integers for Currency
  15. 15. Clean Code - Variables Use Explanatory Variables Always Encapsulate Primitives Avoid Statics Use Appropriate Types
  16. 16. Clean Code - General Boy Scout Rule Keep It Simple, Stupid (KISS) Delete Commented Code Delete Unused Code Minimize Duplication
  17. 17. Clean Code Extend your mentoring & training capacity Accelerate learning through communities of practice Grow your functional leaders and top talents @alexboly @adibolb
  18. 18. Clean Code Q&A, Beer & More...