Slide 1

Slide 1 text

AngularArchitects.io | @ManfredSteyer Your Architecture as a Crime Scene: Improvements with Forensic Analysis

Slide 2

Slide 2 text

Which One is More Complex? [Adam Tornhill: Your Code as a Crime Scene, 2nd edition, 2024]

Slide 3

Slide 3 text

Same „Cyclomatic Complexity“ [Adam Tornhill: Your Code as a Crime Scene, 2nd edition, 2024]

Slide 4

Slide 4 text

[https://www.se.cs.uni-saarland.de/publications/docs/PAP+21.pdf]

Slide 5

Slide 5 text

Can we Support Architecture and Code Reviews with Code Metrics?

Slide 6

Slide 6 text

First Reaction … NO!

Slide 7

Slide 7 text

Goodhart‘s Law: „When a measure becomes a target, it ceases to be a good measure.“ -- Charles A. E. Goodhart

Slide 8

Slide 8 text

What‘s Important for Architects? Minimal Dependencies Vertical 1 Vertical 2 Vertical 3 Feature UI Data Feature UI Data Feature UI Data

Slide 9

Slide 9 text

What‘s Important for Architects? Low Coupling Vertical 1 Vertical 2 Vertical 3 Conway‘s Law High Cohesion High Cohesion High Cohesion Single Responsibility? Most Changes: Within ONE Verical Reduce Cognitive Load!

Slide 10

Slide 10 text

Code Churn Code that changes often: Indicator for Issues

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

Forensic Analysis Source Code History History History Forensic Analysis „Hidden“ Patterns e.g., Git History

Slide 13

Slide 13 text

Agenda • Tools for Forensic Analysis • Limitations of Forensic Analysis • DEMO • Lab • Discussion: Your Findings

Slide 14

Slide 14 text

About me… Manfred Steyer, ANGULARarchitects.io (Remote) Angular Workshops and Consulting Google Developer Expert for Angular Blog, Books, Articles, and Talks about Angular Manfred Steyer

Slide 15

Slide 15 text

Tools

Slide 16

Slide 16 text

Code Scene • By Adam Tornhill • Free for Open Source Projects • Lots of analysis methods • Awesome visualization • Several Programming Languages • Code & Architecture Level • https://codescene.com/

Slide 17

Slide 17 text

Detective • Our take on Forensic Analysis • Open Source • Limited to a few methods • Architecture Level • Primarily TypeScript • Focus: Help for Reviews • Appetizer for CodeScene!

Slide 18

Slide 18 text

Limitations

Slide 19

Slide 19 text

Awesome, but not a replacement for … Code Review Best Practices Architectural Goals Consequences/ Trade-offs Advise Joint Walkthrough Developer Interviews More general: Stakeholder Interviews

Slide 20

Slide 20 text

However, a tempting addition … Code Review Best Practices Architectural Goals Consequences/ Trade-offs Advise Joint Walkthrough Developer Interviews More general: Stakeholder Interviews (Forensic) Analysis Better Questions

Slide 21

Slide 21 text

DEMO

Slide 22

Slide 22 text

Try it out Now in Your Project! npm i @softarc/detective –D npx detective https://github.com/manfredsteyer/standalone-example-cli.git Run this in your own code base (prefered) or clone this example project:

Slide 23

Slide 23 text

Contact and Downloads [web] ANGULARarchitects.io [twitter] ManfredSteyer d Slides & Examples Remote and In-House http://softwarearchitekt.at/workshops