sniff solid principle violation using code metrics
TRANSCRIPT
By Freddy Munandar Homework of Agile Principles, Patterns and Practices (by Uncle Bob)
Code metrics essentially allows us to view, at a high level, data about our code.
By reviewing this data, we can make qualitative decisions about areas that could be of concern and require additional examination
We often refer to this as looking for code smells http://en.wikipedia.org/wiki/Code_smell (Refactoring Context)
Maintainability Index If score between 0 – 9 it could be indicate S.O.L.I.D violation
Cyclomatic Complexity If score more than 30 on member level or more than 80 on type
level it could be indicate OCP violation or SRP violation Class Coupling
If score more than 25 it could be indicate OCP violation, LSP violation, ISP violation, or DIP violation
Depth of Inheritance If score more than 4 it could be indicate OCP violation or LSP
violation Lines of Code
If code line is zero than better to cleanup the code If code more than 20 lines it could be indicate SRP violation
Open Web Application Project on Visual Studio.
“After we examine the violation so we need to Refactoring the code.”
http://sourcemaking.com/refactoring https://codemetricsviewer.wordpress.com/2011/
06/26/how-to-interpret-received-results/ http://blogs.msdn.com/b/zainnab/archive/2011/0
5/10/code-metrics-calculating-metrics.aspx http://en.wikipedia.org/wiki/Software_metric http://en.wikipedia.org/wiki/Cyclomatic_comple
xity http://www.codeproject.com/Articles/442514/To
ol-Code-Metrics-Viewer-extension-for-Visual-Stud
http://en.wikipedia.org/wiki/Code_refactoring