Analyzing and                 Improving CA 2E/Plex                 Code Quality                 John Rhodes               ...
Code Quality in CA Plex/2E•   Discussion on the forums•   Strong interest on very large code bases•   Not so much on CA 2E...
Genesis of the idea                    •   CA Repository                        project                        •   Code co...
Warning - work in progressCopyright 201x                                 4
Why is “code                 quality” important?Copyright 201x
Basic Premise                 •   There is a cost to                     “own” a line of code                     •   60-8...
The Problem                  Code comprehension of complex systems                   Impossible to manually analyze       ...
Overall Solution                                           Automated fact extraction                 Management           ...
2E Analysis                          Extract Source                    Facts       Derive Analysis Value                  ...
Plex AnalysisSource                 Stella   Extract    Derive Analysis Value                 Tools     Facts             ...
What do you get?Copyright 201x
Complexity MetricsMeasure of MaintainabilityCalculated in many IDE’sCyclomatic / Halstead /Maintainability IndexVisual Stu...
Cyclomatic Complexity Metrics if( c1() )                         The cyclomatic complexity of the f1();                   ...
Complexity Metrics      http://en.wikipedia.org/wiki/Cyclomatic_complexity  Enerjy analyzed classes of open-source Java ap...
Clone Detection and Removal•   Programmer productivity: Copy/paste/edit          •     (everybody does it)          •     ...
Case Study: Salion (CRM)                                       • Java Application: Core + 6 Customer variants             ...
Initial                 ResultsCopyright 201x
2E Analysis                 •   Metrics Possible                 •   Internal Functions /                     SCM Correlat...
2E AnalysisCopyright 201x                          19
Plex Analysis                 •   Metrics                     Demonstrable                 •   Internal Functions         ...
Plex Analysis - CintasSource Code Comment Blank Cyclomatic    Halstead                                                    ...
Plex AnalysisCopyright 201x                                 22
Demo of processCopyright 201x
Interested?•   Trial / Alpha version of CA Plex tool•   Databorough Trial Version•   Thread on CA Forum•   Ideas?         ...
Upcoming SlideShare
Loading in …5
×

Analyzing and Improving CA 2E and CA Plex Code Quality

2,138 views

Published on

CA 2E and CA Plex applications are very often large and
complex, encompass multiple platforms and languages, and millions of lines of code. It is often difficult to assess code quality, and even harder to make meaningful improvements. This situation results in excessive maintenance costs. In this presentation we look at the use of automated tooling to calculate complexity metrics, located dead code, detect/remove cloned code, and more. We will be using actual CA Plex and CA 2E examples in the demonstration portion.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
2,138
On SlideShare
0
From Embeds
0
Number of Embeds
627
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Analyzing and Improving CA 2E and CA Plex Code Quality

  1. 1. Analyzing and Improving CA 2E/Plex Code Quality John Rhodes Charles WiltCopyright 201x
  2. 2. Code Quality in CA Plex/2E• Discussion on the forums• Strong interest on very large code bases• Not so much on CA 2E / Plex – Why? • Lack of tools could be the primary reason. • Lack of knowledge• Presenting Ideas and some concrete progress • Interested in collaboration Copyright 201x Copyright 201x CM First 2
  3. 3. Genesis of the idea • CA Repository project • Code comprehension of 250M source code base • Metrics / Clones • Community Interest • Charles WiltCopyright 201x 3
  4. 4. Warning - work in progressCopyright 201x 4
  5. 5. Why is “code quality” important?Copyright 201x
  6. 6. Basic Premise • There is a cost to “own” a line of code • 60-80% of lifecycle cost • Complex code costs more to maintain, Duplicate code is a burden • Shortcuts have costsCopyright 201x 6
  7. 7. The Problem Code comprehension of complex systems Impossible to manually analyze large software programs:Code • How is the maintainability – especially on legacy/old code • New analysts – don’t have the Copyright 201x history with the code
  8. 8. Overall Solution Automated fact extraction Management Extract Domain Expert Facts External Analysis Expert (rules) Metadata repositoryCopyright 201x
  9. 9. 2E Analysis Extract Source Facts Derive Analysis Value Metrics Clones 2E AD X-Analysis Reports Ad-hocRPG, Cobol? Copyright 201x
  10. 10. Plex AnalysisSource Stella Extract Derive Analysis Value Tools Facts Metrics ClonesPlex AD DMS Reports Ad-hocJava, C#, C++ Copyright 201x
  11. 11. What do you get?Copyright 201x
  12. 12. Complexity MetricsMeasure of MaintainabilityCalculated in many IDE’sCyclomatic / Halstead /Maintainability IndexVisual Studio Example -> Copyright 201x
  13. 13. Cyclomatic Complexity Metrics if( c1() ) The cyclomatic complexity of the f1(); program is 3 (as the strongly else connected graph for the f2(); program contains 9 edges, 7 if( c2() nodes and 1 connected ) f3(); component) (9-7+1). else f4(); Good Score < 10-15 Copyright 201x
  14. 14. Complexity Metrics http://en.wikipedia.org/wiki/Cyclomatic_complexity Enerjy analyzed classes of open-source Java applications and divided them into two sets based on how commonly faults werefound in them. They found strong correlation between cyclomatic complexity and their faultiness, with classes with a combined complexity of 11 having a probability of being fault-prone of just 0.28, rising to 0.98 for classes with a complexity of 74.[ Copyright 201x
  15. 15. Clone Detection and Removal• Programmer productivity: Copy/paste/edit • (everybody does it) • typical program > 10% cloned code• Long term maintenance problem • bug reuse • Did I change all the copies? (“What copies?”)• Need to manage clones • locate them • revise/remove Copyright 201x
  16. 16. Case Study: Salion (CRM) • Java Application: Core + 6 Customer variants • CloneDR runs every quarter; active clone removal by development team • Total SLOC reduction over time: ~40% “Most of the drop in the source code graph (core) is due to clone detection removal.” Dale Churchett, Architect Core Code Trend Analysis Custom Code Trend 600000 120000 500000 100000 400000 80000Lines Of Code Lines Of Code 300000 60000 200000 40000 100000 20000 0 0 v1_5 v1_6 v1_7 v1_8 v1_9 v1_9r1 v1_9r2 v1_10 v1_11 v1_12 v1_12_1 v1_13 v1_14 v1_15 v1_16 TRUNK v1_5 v1_6 v1_7 v1_8 v1_9 v1_9r1 v1_9r2 v1_10 v1_11 v1_12 v1_12_1 v1_13 v1_14 v1_15 v1_16 TRUNK Release Tag Release Tag Copyright 201x
  17. 17. Initial ResultsCopyright 201x
  18. 18. 2E Analysis • Metrics Possible • Internal Functions / SCM Correlation?Copyright 201x 18
  19. 19. 2E AnalysisCopyright 201x 19
  20. 20. Plex Analysis • Metrics Demonstrable • Internal Functions and correlation to SCM? • Clones – FutureCopyright 201x 20
  21. 21. Plex Analysis - CintasSource Code Comment Blank Cyclomatic Halstead Filename Lines Lines Lines Lines Complexity Complexity C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid Divisional KPI.Divisional KPI Report.Print Divisional KPI 1884 1884 0 0 497 4595350.5 Report.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool 4618 4616 2 0 214 1.34E+07 Exports/ExportLargeProperty/Function/Function FirstAid Fire Invoice.Data.Header.Print Customer Invoice.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool 2487 2479 7 2 204 4713399.5 Exports/ExportLargeProperty/Function/Function FirstAid Invoice Header.Print attributes.Invoice Print.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid Work Order Header.Customer Service Sheets.Print 3161 3158 3 0 199 7425025 Customer Service Sheets.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid Divisional KPI.Divisional KPI Report.Pmt Divisional KPI 1173 1172 1 0 184 1837039.2 Report.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid New Business Report.TSR Sales and Commission 1430 1414 29 5 173 4855147.5 Report.Print Fire Sales and Commission.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid Customer.Data.Master.Maintenance suite.Change user 2247 2241 6 0 170 3829034.5 interface.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool Exports/ExportLargeProperty/Function/Function FirstAid Customer.Data.Delivery Information.Maintenance 2747 2732 14 1 166 8507429 suite.Change user interface.TXT C:/Documents and Settings/C1162332/My Documents/Plex/StellaTool 1318 1316 2 0 165 2103735 Exports/ExportLargeProperty/Function/Function FirstAid Fire Invoice.UI.DetailMaint.Change Service Visit Item.TXT Copyright 201x 21
  22. 22. Plex AnalysisCopyright 201x 22
  23. 23. Demo of processCopyright 201x
  24. 24. Interested?• Trial / Alpha version of CA Plex tool• Databorough Trial Version• Thread on CA Forum• Ideas? jdrhodes@cmfirsttech.com Charles.wilt@gmail.com Copyright 201x

×