Thoughts from Dan Miser RSS 2.0
 Tuesday, February 21, 2006
Someone on the newsgroups posted a linke to SourceMonitor. It is a tool that analyzes source code (Delphi, C++, C#, Java, VB, C, and HTML) and reports on various code metrics, like the number of lines of code, average statements per method, methods per class, depth of method, global routines and variables, cyclomatic complexity of a method and tons more. The charts are incredible (Kiviat graphs that are configurable with tolerance levels), and you can drill down and sort by any criteria. By doing this, you can identify methods that need to be refactored. In addition, you can View Source on the details and get buttons to take you straight to various offending code metrics (max depth, max complexity method, etc.). The detail view also shows graphs and more information about each unit. Lastly, you can take multiple snapshots so you can monitor progress of your source code's health over time.

This tool is listed as being freeware, but this is one instance where you get WAY more than you pay for.

Tuesday, February 21, 2006 1:04:00 PM (Central Standard Time, UTC-06:00)  #    Comments [3] -
Delphi
Tracked by:
http://9ng-information.info/16428265/index.html [Pingback]
http://9nf-information.info/24570610/office-hours-for-embassy-of-slovenia-in-lon... [Pingback]
http://9nb-information.info/31570609/religious-views-on-just-war.html [Pingback]
http://9nq-information.info/63465741/index.html [Pingback]
http://9nk-information.info/62297906/interner-service-dans-wuerzburg2c-allemagne... [Pingback]
http://9nn-information.info/85517097/bikram-yoga-in-denver-colorado.html [Pingback]
http://9nf-information.info/93568222/index.html [Pingback]
http://9nd-information.info/37823316/index.html [Pingback]
http://9nf-information.info/76435429/index.html [Pingback]
http://9nn-information.info/70889576/index.html [Pingback]
http://9nv-information.info/46728496/index.html [Pingback]
http://9nn-information.info/29407189/children-s-games-in-mexico.html [Pingback]
http://9nt-information.info/91360262/index.html [Pingback]
http://9nw-information.info/94879880/index.html [Pingback]
http://9qm-information.info/73977772/index.html [Pingback]
http://9oj-information.info/40010440/index.html [Pingback]
http://9op-information.info/34825414/beach-theme-wedding-cakes.html [Pingback]
http://9oc-information.info/86411768/index.html [Pingback]
http://9os-information.info/73018795/star-wars-theme-song-sheet-music.html [Pingback]
http://9qf-information.info/73042176/index.html [Pingback]
http://9of-information.info/34707082/index.html [Pingback]
http://9rf-information.info/17895022/index.html [Pingback]
http://9rq-information.info/75098371/index.html [Pingback]
http://9rq-information.info/63500330/index.html [Pingback]
http://9ru-information.info/83206279/mental-health-care-service-district-act.htm... [Pingback]
http://9sd-information.info/23913371/index.html [Pingback]
http://9sc-information.info/77505585/index.html [Pingback]
http://9uaea-le-informazioni.info/02957634/1-bet-at-home-com.html [Pingback]
http://9uafj-le-informazioni.info/66235530/index.html [Pingback]
http://9uafl-le-informazioni.info/81557160/index.html [Pingback]
http://9uafj-le-informazioni.info/40845449/mercados-de-iluminarse.html [Pingback]
http://9uafi-le-informazioni.info/46157003/index.html [Pingback]
http://9uafd-le-informazioni.info/61068644/index.html [Pingback]
http://9uaet-le-informazioni.info/47323994/index.html [Pingback]
http://9uaer-le-informazioni.info/69544226/index.html [Pingback]
http://9uaff-le-informazioni.info/42252566/arcade-town-black-knight.html [Pingback]
http://9uahk-le-informazioni.info/21149627/index.html [Pingback]
http://9uahc-le-informazioni.info/52753766/corso-inglese-cd-rom.html [Pingback]
http://9uage-le-informazioni.info/60136943/index.html [Pingback]
http://9uahg-le-informazioni.info/29203341/index.html [Pingback]
http://9uahn-le-informazioni.info/85662868/riforma-risarcimento-danni.html [Pingback]
http://9uagj-le-informazioni.info/20715644/africa-unite-sito.html [Pingback]
http://9uahh-le-informazioni.info/47808187/index.html [Pingback]
http://9uahr-le-informazioni.info/26271496/index.html [Pingback]
http://9uagp-le-informazioni.info/35372978/index.html [Pingback]
http://9uagt-le-informazioni.info/00900555/index.html [Pingback]
Wednesday, February 22, 2006 12:04:00 AM (Central Standard Time, UTC-06:00)
Dan,



So Steve T. called me into his office this morning to show me this thing. He was VERY excited when he called me in and saying things like "this is SO cool". While I certainly agree that this tool would be a useful thing to have in the toolbox, I'm still missing the big picture. What I want to know is what it is about this tool that got you and Steve so excited? How exactly can it help you build better software?



Mark
Mark Edington
Wednesday, February 22, 2006 2:55:00 AM (Central Standard Time, UTC-06:00)
I think I agree more with Mark here. I'm not sure I would use much of this data unless I just want to find long metods to refactor just to be busy refactoring or remove global variables just because they are bad. I'd prefer a static analysis tool that can find "real problems." There are several of these for C code, but no good ones for Delphi, as far as I know.



I once saw a program that would find duplicated code in a Delphi application (it allowed differences in formatting and identifiers), and I think it was a lot more useful. I don't remember the name right now, though.



For Delphi code, tools like EyeBol and Pascal Analyzer can at least give me hints that might (sometimes) be actual errors in my Delphi code.
Erik
Wednesday, February 22, 2006 9:21:00 AM (Central Standard Time, UTC-06:00)
The 2 metrics I think are most useful are complexity and statements per method (max depth is also a good one). If you have a method with a complexity of (e.g.) 190, it would be rather good to identify that method for further evaluation and refactoring. The same goes for a unit/class that has average statements per method of 350.



In short, it gives me a place to start looking based on metrics, as opposed to haphazardly encountering a method/class with bad "code smell".



My thinking is if something triggers a red flag in this analysis, then it will be a red flag in compiled code. For example, if you have a method with complexity of 190, you would need 190 unit tests to ensure complete code coverage of that method. I don't know about you, but I would sleep a lot better if I know that the code is more maintainable, more extensible, and more correct vs. relying just on QA to go through all 190 permutations in calling that method.
Comments are closed.
Navigation
Archive
<September 2010>
SunMonTueWedThuFriSat
2930311234
567891011
12131415161718
19202122232425
262728293012
3456789
About the author/Disclaimer

Disclaimer
The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.

© Copyright 2010
Dan Miser
Sign In
Statistics
Total Posts: 339
This Year: 5
This Month: 0
This Week: 0
Comments: 618
All Content © 2010, Dan Miser
DasBlog theme 'Business' created by Christoph De Baene (delarou)