O'Reilly logo

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Software Design X-Rays

Book Description

Are you working on a codebase where cost overruns, death marches, and heroic fights with legacy code monsters are the norm? Battle these adversaries with novel ways to identify and prioritize technical debt, based on behavioral data from how developers work with code. And that's just for starters. Because good code involves social design, as well as technical design, you can find surprising dependencies between people and code to resolve coordination bottlenecks among teams. Best of all, the techniques build on behavioral data that you already have: your version-control system. Join the fight for better code!

Use statistics and data science to uncover both problematic code and the behavioral patterns of the developers who build your software. This combination gives you insights you can't get from the code alone. Use these insights to prioritize refactoring needs, measure their effect, find implicit dependencies between different modules, and automatically create knowledge maps of your system based on actual code contributions.

In a radical, much-needed change from common practice, guide organizational decisions with objective data by measuring how well your development teams align with the software architecture. Discover a comprehensive set of practical analysis techniques based on version-control data, where each point is illustrated with a case study from a real-world codebase. Because the techniques are language neutral, you can apply them to your own code no matter what programming language you use. Guide organizational decisions with objective data by measuring how well your development teams align with the software architecture. Apply research findings from social psychology to software development, ensuring you get the tools you need to coach your organization towards better code.



If you're an experienced programmer, software architect, or technical manager, you'll get a new perspective that will change how you work with code.

What You Need:

You don't have to install anything to follow along in the book. TThe case studies in the book use well-known open source projects hosted on GitHub. You'll use CodeScene, a free software analysis tool for open source projects, for the case studies. We also discuss alternative tooling options where they exist.

Table of Contents

  1.  Acknowledgments
  2.  The World of Behavioral Code Analysis
    1. Why You Should Read This Book
    2. Who Is This Book For?
    3. How Should You Read This Book?
    4. How Do I Get Behavioral Data for My Code?
    5. Online Resources
  3. Part I. Prioritize and React to Technical Debt
    1. 1. Why Technical Debt Isn’t TechnicalWhy Technical Debt Isn’t Technical
      1. Questioning Technical Debt
      2. The Perils of Quantifying Technical Debt
      3. Mine Your Organization’s Collective Intelligence
      4. Prioritize Improvements Guided by Data
    2. 2. Identify Code with High Interest Rates
      1. Measure Interest Rates
      2. Prioritize Technical Debt with Hotspots
      3. Evaluate Hotspots with Complexity Trends
      4. Use X-Rays to Get Deep Insights into Code
      5. Escape the Technical-Debt Trap
      6. Exercises
    3. 3. Coupling in Time: A Heuristic for the Concept of SurpriseCoupling in Time: A Heuristic for the Concept of Surprise
      1. Uncover Expensive Change Patterns
      2. Detect Cochanging Files
      3. The Dirty Secret of Copy-Paste
      4. The Power of Language-Neutral Analyses
      5. Exercises
    4. 4. Pay Off Your Technical Debt
      1. Follow the Principle of Proximity
      2. Refactor Congested Code with the Splinter Pattern
      3. Build Temporary Tests as a Safety Net
      4. Turn Hotspot Methods into Brain-Friendly Chunks
      5. The Curse of a Successful System
    5. 5. The Principles of Code Age
      1. Stabilize Code by Age
      2. The Three Generations of Code
      3. Refactor Your Package Structure
      4. Scale from Files to Systems
      5. Exercises
  4. Part II. Work with Large Codebases and Organizations
    1. 6. Spot Your System’s Tipping PointSpot Your System’s Tipping Point
      1. Is Software Too Hard?
      2. Divide and Conquer with Architectural Hotspots
      3. Analyze Subsystems
      4. Fight the Normalization of Deviance
      5. Toward Team-Oriented Measures
      6. Exercises
    2. 7. Beyond Conway’s LawBeyond Conway’s Law
      1. Software Architecture Is About Making Choices
      2. Measure Coordination Needs
      3. Code Ownership and Diffusion of Responsibility
      4. Analyze Operational Team Boundaries
      5. Social Groups: The Flip Side to Conway’s Law
      6. Combine Social and Technical Information
    3. 8. Toward Modular Monoliths through the Social View of CodeToward Modular Monoliths through the Social View of Code
      1. Dodge the Silver Bullet
      2. Layered Architectures and the Cost of Consistency
      3. Monolithic Alternatives: Use Case and Feature-Centric
      4. Discover Bounded Contexts Through Change Patterns
      5. The Perils of Feature Teams
      6. Clean and Dirty Architectures
      7. Exercises
    4. 9. Systems of Systems: Analyzing Multiple Repositories and MicroservicesSystems of Systems: Analyzing Multiple Repositories and Microservices
      1. Analyze Code in Multiple Repositories
      2. Compare Hotspots Across Repositories
      3. Track Change Patterns in Distributed Systems
      4. Measure Technical Sprawl
      5. Distribution Won’t Cure the Dependency Blues
      6. Exercises
    5. 10. An Extra Team Member: Predictive and Proactive AnalysesAn Extra Team Member: Predictive and Proactive Analyses
      1. Detect Deviating Evolutionary Patterns
      2. Catch the Absence of Change
      3. Guide On- and Offboarding with Social Data
      4. Know the Biases and Workarounds for Behavioral Code Analysis
      5. Your Code Is Still a Crime Scene
      6. Exercises
  5. A1. The Hazards of Productivity and Performance MetricsThe Hazards of Productivity and Performance Metrics
    1. Adaptive Behavior and the Destruction of a Data Source
    2. The Situation Is Invisible in Code
  6. A2. Code Maat: An Open Source Analysis EngineCode Maat: An Open Source Analysis Engine
    1. Run Code Maat
    2. Data Mining with Code Maat
    3. Visualizations
  7. A3. Data Mining with Git, cloc, and CodeScene
    1. Behavioral Code Analysis with Git
    2. A Brief Introduction to cloc
    3. Export Analysis Data from CodeScene
  8. A4. Hints and Solutions to the Exercises
    1. Solutions: Identify Code with High Interest Rates
    2. Solutions: Coupling in Time
    3. Solutions: The Principles of Code Age
    4. Solutions: Spot Your System’s Tipping Point
    5. Solutions: Modular Monoliths
    6. Solutions: Systems of Systems
    7. Solutions: An Extra Team Member
  9.  Bibliography