Smell your Code! @ IET-KFUPM PATW

992 views

Published on

This is the presentation I gave at the IET-KFUPM Present Around The World competition (http://iet.ikfupm.com/patw2011/), for which I was the second runner-up. It is based on an earlier presentation I gave at Free Dimension, the company I work for part-time.

Published in: Technology, Health & Medicine
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
992
On SlideShare
0
From Embeds
0
Number of Embeds
6
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Smell your Code! @ IET-KFUPM PATW

  1. 1. Smell your Code! Yaser Sulaiman 1
  2. 2. 2
  3. 3. Our road map 3
  4. 4. Who? What? Why? How? 4
  5. 5. If you can take away only 1 lesson… 5
  6. 6. Don’t Repeat Yourself! 6
  7. 7. This rule is so important… 7
  8. 8. I must break it! 8
  9. 9. Don’t Repeat Yourself! 9
  10. 10. Who? What? Why? How? 10
  11. 11. “Who are you?” 11
  12. 12. A scientist, not an engineer(I probably should doing this @ ACM, not IET) 12
  13. 13. 13
  14. 14. 14
  15. 15. 15
  16. 16. 16
  17. 17. 17
  18. 18. 18
  19. 19. 19
  20. 20. 20
  21. 21. logo stolen from Kyle Usbeck 21
  22. 22. logo by Yukihiro Matsumoto 22
  23. 23. “You talkin’ to me?” 23
  24. 24. Are you a software developer? 24
  25. 25. If not, do you write code? 25
  26. 26. If not, would you be remotelyinterested in writing cleaner code and making your life easier? 26
  27. 27. If not, you’re free to zone out 27
  28. 28. “Why should I listen to you?” 28
  29. 29. I won’t give you the “I’m apassionate software developer” BS 29
  30. 30. I’ve a terminal illness 30
  31. 31. Make that 2 terminal illnesses 31
  32. 32. Perfectionism & OCD 32
  33. 33. photo by X.u.k.i 33
  34. 34. Who? What? Why? How? 34
  35. 35. “Code smells?! Can I smell my code?!” 35
  36. 36. photo by lanceball 36
  37. 37. Yes you can, but not with your nose 37
  38. 38. Code smells are warning signs 38
  39. 39. photo by pj_in_oz 39
  40. 40. They’re surface indications of deeper problems 40
  41. 41. photo by BenChenowethWork 41
  42. 42. They’re surface indications of deeper problems 42
  43. 43. A code smell ⇏ a problem 43
  44. 44. Who? What? Why? How? 44
  45. 45. The bigger picture 45
  46. 46. Software QualityCode Quality Code Smells not to scale 46
  47. 47. Writing HQ code should be the priority 47
  48. 48. readHQ code = easy to understand change 48
  49. 49. In the short term, HQ code may cost more 49
  50. 50. photo by theresaanna 50
  51. 51. Easier to change ≈ less costly 51
  52. 52. In the long run, HQ code costs less 52
  53. 53. One path to cleaner code goes through code smells 53
  54. 54. Who? What? Why? How? 54
  55. 55. There’re many code smells 55
  56. 56. The following smells are just a small subset 56
  57. 57. They’re the ones that drives me crazy the most 57
  58. 58. Code Smell #1 58
  59. 59. DupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated code 59
  60. 60. The nastiest code smell 60
  61. 61. DupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated codeDupIicated code DupIicated code 61
  62. 62. Code Smell #2 62
  63. 63. functions.With(just, way,too, many, parameters, and, then, even, some, more) 63
  64. 64. How many is too many? 64
  65. 65. Steve McConnell: >7±2 65
  66. 66. Robert C. “Uncle Bob” Martin: >3 66
  67. 67. Code Smell #3 67
  68. 68. Not following a codingconvention/standard/style consistently 68
  69. 69. stolen from EmacsWiki 69
  70. 70. Not following a codingconvention/standard/style consistently 70
  71. 71. The specifics doesn’t really matter; what matters most is consistency 71
  72. 72. Code Smell #4 72
  73. 73. // code.CommentOut(); 73
  74. 74. Don’t get me wrong 74
  75. 75. When you’re experimenting,comment code to your hearts content 75
  76. 76. Just remember to clean up after yourself 76
  77. 77. And don’t commit commented-out code 77
  78. 78. “Commented-out code is anabomination.”—Uncle Bob photo used with permission of Uncle Bob 78
  79. 79. Commented-out code makes Uncle Bob angry 79
  80. 80. It makes me angry 80
  81. 81. photo by tomazstolfa 81
  82. 82. Code Smell #5 82
  83. 83. redundant// This is a comment 83
  84. 84. Commentsshould focus on Who? What? Why? How? 84
  85. 85. Who? What? Why? How? 85
  86. 86. I may have come off as an a$$ 86
  87. 87. My code smells as bad as everyone else’s.. sometimes even worse 87
  88. 88. But I’m aware of my smells 88
  89. 89. I try my best to prevent them 89
  90. 90. I don’t ignore them; I deal with them 90
  91. 91. I smell my code 91
  92. 92. You should smell your code too 92
  93. 93. When you code, take note of your nose It should be open, not close For an open nose leads to an open mindAnd that’s the best rhyme I was able to find 93
  94. 94. If you want to sniff more… 94
  95. 95. more than just code smells 95
  96. 96. …</presentation> <questions>… 96

×