Successfully reported this slideshow.
Your SlideShare is downloading. ×

Visualizing code bases

Visualizing code bases

Download to read offline

Code lines are added at high speed? Too many developers? How do you see the big picture? What processes are going on with your large code base? This presentation will show how to leverage existing code analysis tools (Gource, D3, Git and others) to make at least some sense out of millions of code lines and their history. During his consulting work, author often meets unfamiliar and at the same time large code bases that need quick analysis and input for decision making. That's where visualizations come to into play by helping mining important knowledge directly from the code statistics.

Code lines are added at high speed? Too many developers? How do you see the big picture? What processes are going on with your large code base? This presentation will show how to leverage existing code analysis tools (Gource, D3, Git and others) to make at least some sense out of millions of code lines and their history. During his consulting work, author often meets unfamiliar and at the same time large code bases that need quick analysis and input for decision making. That's where visualizations come to into play by helping mining important knowledge directly from the code statistics.

More Related Content

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Visualizing code bases

  1. 1. 01
  2. 2. About me 02
  3. 3. Andrey Adamovich Bio: Developer, coach, speaker, author Company: Aestas/IT (http://aestasit.com) • • 03
  4. 4. Contact details E­mail: andrey@aestasit.com Linkedin: http://www.linkedin.com/in/andreyadamovich Lanyrd: http://lanyrd.com/profile/andrey­adamovich GitHub: https://github.com/aadamovich SO: http://stackoverflow.com/users/162792/andrey­adamovich Twitter: @codingandrey, @aestasit • • • • • • 04
  5. 5. Let's start! 05
  6. 6. Background Find new clients Face big code bases Need quick analysis Need quick results • • • • 06
  7. 7. Code size Google: 2 billions LOC Facebook: 61 million LOC Me: from 20K to 2M LOC • • • 07
  8. 8. I hate reading... 08
  9. 9. Reading code I want this to work This just works Working is the definition of this block Work! You, stupid! The work should be here 01. 02. 03. 04. 05. 09
  10. 10. It's life, Jim, but not as we know it! 10
  11. 11. Code is data! 11
  12. 12. Well, big data 12
  13. 13. Snapshot 13
  14. 14. Temporal 14
  15. 15. First steps 15
  16. 16. Count the lines! 16
  17. 17. Size does matter Gives you an estimate (on how much reading is needed). Most of the code bases are polyglot. Ratio between languages can tell a lot. Ratio between test code, comments, blank lines is also interesting. • • • 17
  18. 18. cloc 18
  19. 19. Usage cloc ‐‐help cloc ‐‐write‐lang‐def=lang.defs 01. 02. 19
  20. 20. Usage cloc ‐‐csv       ‐‐quite       ‐‐progress‐rate=0      ‐‐ignored=files.ignored       ‐‐exclude‐dir=test,build      ‐‐read‐lang‐def=lang.defs       ‐‐out=data.csv      . 01. 02. 03. 04. 05. 06. 07. 08. 20
  21. 21. Language definitions Gradle     filter remove_matches ^s*//     filter remove_inline //.*$     filter call_regexp_common C     extension gradle     3rd_gen_scale 4.10 01. 02. 03. 04. 05. 06. 21
  22. 22. Where are the pictures? 22
  23. 23. We have stats, let's plot them!23
  24. 24. Excel? Probably not. 24
  25. 25. Pie charts are boring! 25
  26. 26. Infographics! 26
  27. 27. d3.js 27
  28. 28. d3.js Javascript library for data visualizations Tons of examples Many libraries built on top of d3.js Several books • • • • 28
  29. 29. Example 29
  30. 30. Many alternatives vis.js raphael.js sigma.js many, many, many more • • • • 30
  31. 31. Tableau Public 31
  32. 32. Tableau Public 32
  33. 33. Tableau Public 33
  34. 34. infogr.am 34
  35. 35. infogr.am 35
  36. 36. Temporal analysis 36
  37. 37. GitHub 37
  38. 38. GitHub 38
  39. 39. FishEye 39
  40. 40. Gource Software projects are displayed by Gource as an animated tree with the root directory of the project at its centre. Directories appear as branches with files as leaves. Developers can be seen working on the tree at the times they contributed to the project. “ 40
  41. 41. Launch gource gource ‐s 0.1 ‐1280x720  gource ‐‐output‐custom‐log log1.txt  gource ‐s 0.1 ‐1280x720 log1.txt 01. 02. 03. 41
  42. 42. Log format 1444125624|Luke Daley|M|/ratpack‐core/.../WiretapPublisher.java 1444125624|Luke Daley|M|/ratpack‐core/.../YieldingPublisher.java 1444306114|Stian Lindhom|M|/ratpack‐manual/.../13‐http.md 1444312172|Andrey Antukh|M|/ratpack‐core/.../WebSocketEngine.java 01. 02. 03. 04. 42
  43. 43. Demo 43
  44. 44. Metrics 44
  45. 45. SonarQube 45
  46. 46. Demo 46
  47. 47. Supported langauges I ABAP (comercial) Android C/C++ (comercial) C# COBOL (comercial) Flex • • • • • • 47
  48. 48. Supported langauges II Groovy Java JavaScript Objective­C (comercial) PHP • • • • • 48
  49. 49. Supported langauges II PL/I (comercial) PL/SQL (comercial) Python RPG (comercial) Swift (comercial) • • • • • 49
  50. 50. Supported langauges II VB.NET (comercial) Visual Basic 6 (comercial) Web (HTML, JSP/JSF) XML 50
  51. 51. Extracting data 51
  52. 52. Structure 52
  53. 53. Saikuro https://github.com/ThoughtWorksStudios/saikuro_treemap https://www.youtube.com/watch?v=iiIytERhV9o • • 53
  54. 54. Structure101 54
  55. 55. Stan4j 55
  56. 56. Graphs are everywhere! 56
  57. 57. AST 57
  58. 58. jQAssistant jQAssistant is a QA tool which allows the definition and validation of project specific rules on a structural level. It is built upon the graph database Neo4j and can easily be plugged into the build process to automate detection of constraint violations and generate reports about user defined concepts and metrics. “ 58
  59. 59. Query your code MATCH   (class:Class)‐[:DECLARES]‐>(method:Method) RETURN   class.fqn, count(method) as Methods ORDER BY   Methods DESC LIMIT 20 01. 02. 03. 04. 05. 06. 07. 59
  60. 60. neo4j 60
  61. 61. Demo 61
  62. 62. That's it! 62
  63. 63. Conclusion Extract data from your code! Visualize it! Search for new facts and knowledge! • • • 63
  64. 64. Reading material 64
  65. 65. D3 Cookbook 65
  66. 66. D3 Tips & Tricks 66
  67. 67. Metrics and models in SQE 67
  68. 68. Software metrics and metrology 68
  69. 69. Cool infographics 69
  70. 70. The infographic history of the world 70
  71. 71. Infographica 71
  72. 72. Information is beautiful 72
  73. 73. Knowledge is beautiful 73
  74. 74. Show me numbers 74
  75. 75. Links: images http://abstrusegoose.com/432 http://camarenaphoto.tumblr.com/post/112238079516/its­life­jim­but­ not­as­we­know­it­spock http://technology.ie/big­data­looks­like/ http://www.informationisbeautiful.net/visualizations/million­lines­of­ code/ http://githut.info/ http://emmanueloga.com/2013/10/07/Graphs­are­Everywhere­An­ overview­of­GraphConnect­San­Francisco­2013.html • • • • • • 75
  76. 76. Links: tools https://github.com/AlDanial/cloc http://gource.io/ http://d3js.org/ http://visjs.org/ • • • • 76
  77. 77. Links: tools http://www.sonarqube.org/ https://www.atlassian.com/pt/software/fisheye/overview http://jqassistant.org/ http://neo4j.com/ • • • • 77
  78. 78. Links: tools https://github.com/ThoughtWorksStudios/saikuro_treemap https://www.youtube.com/watch?v=iiIytERhV9o • • 78
  79. 79. Danke schön! 79
  80. 80. Thank you! 80
  81. 81. Questions? 81

×