Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
https://goo.gl/dmWFIA
not a day without cute kitten...
About me
●Architect@SoftServe
●Experience in IT 10+ years
●4 years experience with SOA, MSA
●XP fan
●OCPJP
●Scrum Master
Code quality: how to
assessment your product in
a right way
How to start with any product?
Phrases you will never hear from the customer
• We need to improve our code-base
• Let’s improve test coverage
• Let’s add...
They want to get more MONEY
...Or, at least, keep current profit rate
What is true goal of almost any
customer?
50 shades of product
• Really good product :)
• Prototype
• 10+ years legacy
How to start investigate product?
Get maximum input:
• Codebase
• Documentation
• Infrastructure
• Customer input
Look at code first
Listen your feelings - is it spaghetti?
Righ cooked spaghetti Spaghetti, we could deal with Unmaintaina...
Is codebase contains modules?
Is codebase has DAO layer?
Framework? ORM?
Now, something real
Quantitative metrics
Define, what metrics do you need. Visualize it.
1 = critical
2 = warning
3 = fair/acceptable
4 = goal
Find your right toolbox
Static code analysis
DSQI, Maintainability index, performance/load
https://github.com/phpmetrics/PhpMetrics
DSQI (Design Structure Quality Index)
What is more important in YOUR case
Maintainability Index
Lines Of Code
Cyclomatic Complexity
Halstead volume
Maintainability Index
Lines Of Code
Cyclomatic Complexity
Halstead volume
Maintainability Index
Lines Of Code
Cyclomatic Complexity
Halstead volume
How to know CC is good?
up to 10 for class and 3-4 for method (The McCabe complexity)
()
Maintainability Index
Lines Of Code
Cyclomatic Complexity
Halstead volume
From my point-of-view:
difficulty of the program to write or understand, e.g. when doing code review.
Maintainability Index
But in real, it is meant only 1 thing:
How easy is to repair?
How to start calculate MI right?
Step 1: find out right tool, and check calculations
manually for something small
Step 2: define which is good/acceptable in your case
85 and more Good maintainability
65-85 Moderate maintainability. Diff...
Step 3: analyse and visualize
Think critically
Testability
Coverage first: SQALE, coverage %
...and end-to-end testing
Unit &
Compo
nent
Tested
Integration
Tested
A B
But testability, it is not only about how it is already
covered...but how easily we can cover
Code quality
Static analysis is good - but what it should say to us?
Always focus on important things only!
Documentation
High level documentation?
Documented API
Or even better: RESTful HATEOAS
Comments in code?
Extensibility
Loose Coupling vs Tight coupling
a measure of how closely connected two routines or modules.
Tight coupling: is where comp...
Dependency Injection
High cohesion vs Coincidental cohesion
Coincidental cohesion: the only relationship between the parts is that they have
be...
Ok, everything looks good, but it is not working
without 2 things...
Scalability
Polyglot persistence
Load testing
Security
Unencrypted password
Infrastructure
Any CI/CD?
Build/delivery in 1 click?
DB could be achieved from public? o_O
What else?
After all, we need...
Analyse what we’ve got
make a lot of staff
propose solution
Short TO-DO
• Make sure you have enough input
• Define key problems/needs
• Define right metrics
• Find out right tools
• ...
Special Thanks to
Q&A
https://goo.gl/dmWFIA
Used materials:
http://www.drexplain.com/isv-kaizen-blog/wp-
content/uploads/2012/05/qq.png
https://pix-media.s3.amazonaws...
Used materials(continue):
http://4.bp.blogspot.com/--
Vyl0xR1cNw/TykzJOhJ9oI/AAAAAAAAAcQ/3O8DwM7F1Zw/s640/1
27+target.png
...
Used materials(continue):
http://www.boom-ex.com/images/express-delivery.jpg
http://byaki.net/uploads/posts/2013-08/137587...
Contact me
https://ua.linkedin.com/in/igortsinko
This presentation under CC-BY 3.0 licence
http://creativecommons.org/licenses/by/3.0/
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Code quality  how to assessment your product in a right way
Upcoming SlideShare
Loading in …5
×

Code quality how to assessment your product in a right way

336 views

Published on

Code quality how to assessment your product in a right way

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Code quality how to assessment your product in a right way

  1. 1. https://goo.gl/dmWFIA
  2. 2. not a day without cute kitten...
  3. 3. About me
  4. 4. ●Architect@SoftServe ●Experience in IT 10+ years ●4 years experience with SOA, MSA ●XP fan ●OCPJP ●Scrum Master
  5. 5. Code quality: how to assessment your product in a right way
  6. 6. How to start with any product?
  7. 7. Phrases you will never hear from the customer • We need to improve our code-base • Let’s improve test coverage • Let’s add CasandraDB instead of current SQL solution for user activity log • We want to refactor our current Monolith app to support new microservices written on GO • Let’s discuss how to change our solution X to ServiceLocatorFactoryBeen • ...
  8. 8. They want to get more MONEY ...Or, at least, keep current profit rate
  9. 9. What is true goal of almost any customer?
  10. 10. 50 shades of product • Really good product :) • Prototype • 10+ years legacy
  11. 11. How to start investigate product? Get maximum input: • Codebase • Documentation • Infrastructure • Customer input
  12. 12. Look at code first Listen your feelings - is it spaghetti? Righ cooked spaghetti Spaghetti, we could deal with Unmaintainable spaghetti
  13. 13. Is codebase contains modules?
  14. 14. Is codebase has DAO layer?
  15. 15. Framework? ORM?
  16. 16. Now, something real
  17. 17. Quantitative metrics
  18. 18. Define, what metrics do you need. Visualize it. 1 = critical 2 = warning 3 = fair/acceptable 4 = goal
  19. 19. Find your right toolbox
  20. 20. Static code analysis
  21. 21. DSQI, Maintainability index, performance/load https://github.com/phpmetrics/PhpMetrics
  22. 22. DSQI (Design Structure Quality Index)
  23. 23. What is more important in YOUR case
  24. 24. Maintainability Index Lines Of Code Cyclomatic Complexity Halstead volume
  25. 25. Maintainability Index Lines Of Code Cyclomatic Complexity Halstead volume
  26. 26. Maintainability Index Lines Of Code Cyclomatic Complexity Halstead volume
  27. 27. How to know CC is good? up to 10 for class and 3-4 for method (The McCabe complexity) ()
  28. 28. Maintainability Index Lines Of Code Cyclomatic Complexity Halstead volume
  29. 29. From my point-of-view: difficulty of the program to write or understand, e.g. when doing code review.
  30. 30. Maintainability Index
  31. 31. But in real, it is meant only 1 thing: How easy is to repair?
  32. 32. How to start calculate MI right?
  33. 33. Step 1: find out right tool, and check calculations manually for something small
  34. 34. Step 2: define which is good/acceptable in your case 85 and more Good maintainability 65-85 Moderate maintainability. Difficult to maintain < 65 Bad pieces of code. Should be rewritten
  35. 35. Step 3: analyse and visualize
  36. 36. Think critically
  37. 37. Testability
  38. 38. Coverage first: SQALE, coverage %
  39. 39. ...and end-to-end testing Unit & Compo nent Tested Integration Tested A B
  40. 40. But testability, it is not only about how it is already covered...but how easily we can cover
  41. 41. Code quality
  42. 42. Static analysis is good - but what it should say to us? Always focus on important things only!
  43. 43. Documentation
  44. 44. High level documentation?
  45. 45. Documented API
  46. 46. Or even better: RESTful HATEOAS
  47. 47. Comments in code?
  48. 48. Extensibility
  49. 49. Loose Coupling vs Tight coupling a measure of how closely connected two routines or modules. Tight coupling: is where components are so tied to one another, that you cannot possibly change the one without changing the other
  50. 50. Dependency Injection
  51. 51. High cohesion vs Coincidental cohesion Coincidental cohesion: the only relationship between the parts is that they have been grouped together
  52. 52. Ok, everything looks good, but it is not working without 2 things...
  53. 53. Scalability
  54. 54. Polyglot persistence
  55. 55. Load testing
  56. 56. Security
  57. 57. Unencrypted password
  58. 58. Infrastructure
  59. 59. Any CI/CD?
  60. 60. Build/delivery in 1 click?
  61. 61. DB could be achieved from public? o_O
  62. 62. What else?
  63. 63. After all, we need... Analyse what we’ve got make a lot of staff propose solution
  64. 64. Short TO-DO • Make sure you have enough input • Define key problems/needs • Define right metrics • Find out right tools • Be smart, calm, polite
  65. 65. Special Thanks to
  66. 66. Q&A
  67. 67. https://goo.gl/dmWFIA
  68. 68. Used materials: http://www.drexplain.com/isv-kaizen-blog/wp- content/uploads/2012/05/qq.png https://pix-media.s3.amazonaws.com/blog/778/walter-white- money.jpg http://vignette3.wikia.nocookie.net/mkwikia/images/f/fe/Sub- Zero_Fatality_MK2.png/revision/latest?cb=20110926135214 http://xpinjection.com/wp- content/themes/xpinjection/images/logo.svg https://www.daysoftheyear.com/wp-content/images/spaghetti-day1- e1441440370672-808x380.jpg http://damndelicious.net/wp- content/uploads/2016/01/IMG_2450edit.jpg http://www.1001eda.com/wp- content/uploads/2012/11/412_09_11_2012_96.jpg http://i.huffpost.com/gen/779791/thumbs/o-50-SHADES-OF- CHICKEN-570.jpg?12 http://ericksonmediation.com/wp- content/uploads/2012/05/advanced-mediation-training-modules- 300x300.jpg http://beerplace.com.ua/wp-content/uploads/DAO_SunInBev.jpg https://proselyte.net/wp-content/uploads/2016/01/spring-by- pivotal.png http://www.uk- ssb.org/research_cruises/documentation/images/documentation.jpg http://westsideinternalmed.com/wp- content/uploads/2015/02/Toolbox.jpg http://www.i- programmer.info/images/stories/Core/Cplusplus/staticcodequiz/logo .gif https://hsto.org/files/c5b/7ac/7f5/c5b7ac7f51bf4974b062acd41afb5a ad.png http://www.way2automation.com/Jmeter%20Training/images/jm.jpg http://twotribes.com/images/sized/images/uploads/berichten/373x24 62-373x246.png http://groups.engin.umd.umich.edu/CIS/tinytools/cis375/f00/dsqi/mai n.html http://previews.123rf.com/images/thomaspajot/thomaspajot1202/tho maspajot120200008/12494605-Thumb-good-Stock-Vector-good- compliance-quality.jpg http://www.projectcodemeter.com/cost_estimation/help/GL_halstead .htm http://www.aroostooktechnologies.com/images/computer-repair.png http://images.slideplayer.com/26/8646557/slides/slide_29.jpg http://www.projectboatzen.com/wp-content/uploads/2014/02/wrong-
  69. 69. Used materials(continue): http://4.bp.blogspot.com/-- Vyl0xR1cNw/TykzJOhJ9oI/AAAAAAAAAcQ/3O8DwM7F1Zw/s640/1 27+target.png https://watirmelon.files.wordpress.com/2012/01/idealautomatedtesti ngpyramid.png https://upload.wikimedia.org/wikipedia/commons/5/5c/Sonarqube- nemo-dashboard.png http://s3.media.squarespace.com/production/2129687/19317774/.a/ 6a00d8341d3df553ef017ee884a3f6970d-pi http://image.slidesharecdn.com/wadlsupport-130707121619- phpapp01-160302125053/95/wadl-support-for-ultraesb-3- 638.jpg?cb=1456923127 http://spring.io/guides/gs/rest-hateoas/ http://catalog- chess.ru/image/cache/data/1%20%D0%93%D0%BE%D0%BB%D0 %BE%D0%B2%D0%BE%D0%BB%D0%BE%D0%BC%D0%BA%D 0%B8/%D0%94%D0%B6%D0%B5%D0%BD%D0%B3%D0%B0%2 0Classik%20Hasbro%20(6)-2500x2000.jpg http://image.slidesharecdn.com/dislideshare-141115153159- conversion-gate02/95/i-gotta-dependency-on-dependency-injection- 5-638.jpg?cb=1416065711 https://thebojansblog.files.wordpress.com/2015/04/your-email- http://dwiardiirawan.com/wp-content/uploads/2016/05/what-is- dependency-injection-1024x768.jpg http://cdn4.thr.com/sites/default/files/imagecache/scale_crop_768_4 33/2013/07/despicable_me_2_6.jpg http://www.pc-freak.net/images/horizontal-vs-vertical-scaling- vertical-and-horizontal-scaling-explained-diagram.png http://martinfowler.com/bliki/images/polyglotPersistence/polyglot.pn g http://www.omer.dawelbeit.info/images/3d2c6e01d7e1_132A1/JMet er-Response-Times-vs-Threads_3.jpg http://l7.alamy.com/zooms/13d69c3eea0e45028fb4c0c494e89d27/s outh-africa-red-door-without-walls-red-tree-blue-sky-bt9g1x.jpg http://www.informationsecuritybuzz.com/wp- content/uploads/SQL_Injection.jpg http://c8.alamy.com/comp/A0X1K9/sticky-notes-fill-computer- monitor-and-office-wall-A0X1K9.jpg http://www.ashurst.com/financeinsights/wp- content/uploads/2015/08/Asian-Infrastructure-Investment-Bank.jpg http://cdn.tvc.ru/pictures/o/185/269.jpg http://2.bp.blogspot.com/- m1NBpmlfyhs/VjIxGp0kYnI/AAAAAAAARa8/ZI-Hg- LkF5M/s1600/teamcity3.png
  70. 70. Used materials(continue): http://www.boom-ex.com/images/express-delivery.jpg http://byaki.net/uploads/posts/2013-08/1375878948_comp_03.jpg http://3.bp.blogspot.com/- c1GOlKhXM7g/UjE6VuBVQEI/AAAAAAAABJw/_PI5e3MIo- w/s1600/HEADER6.png https://lh3.ggpht.com/j6aNgkpGRXp9PEinADFoSkyfup46- 6Rb83bS41lfQC_Tc2qg96zQ_aqZcyiaV3M-Ai4=w300 http://excelworks.ru/wp-content/uploads/2015/02/excel.png https://media.licdn.com/mpr/mpr/p/3/005/07a/044/04f5231.jpg https://cdn.searchenginejournal.com/wp- content/uploads/2015/02/shutterstock_185332604.jpg https://pbs.twimg.com/profile_images/1220953169/twitter.png
  71. 71. Contact me https://ua.linkedin.com/in/igortsinko
  72. 72. This presentation under CC-BY 3.0 licence http://creativecommons.org/licenses/by/3.0/

×