Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Quality Reviewer evaluates regressions and understands changes in the source code using automated Software Metrics visualization (SW complexity, size and structure Metrics, Halstead Metrics, ISO 9126 maintainability, ISO 25010, ISO 19515, Chidamber & Kemerer, SQALE), as well as Effort Estimation (APPW, AFP, QSM FP, SRM FP, COSMIC, COCOMO, Revic) and reporting features. It helps to keep code entropy under control, be it in house development or outsourced maintenance projects.

...

          Where: SDC is the Static Defect Count per severity.

Application Architecture

Ideally, software can be easily modified, is understandable, reliable and reusable. In practice, this often remains an ideal and over the course of time the software becomes increasingly rigid, opaque and fragile. In many cases the underlying cause is that the dependency structure of the software degrades over time.

A study by Dan Sturtevant investigated the impact of software dependencies on defect rate, productivity and staff turnover. It classified modules into the following types:

  • Peripheral: Few dependencies

  • Utility: Many ingoing dependencies

  • Control: Many outgoing dependencies

  • Core : Many in- and outgoing dependencies

The outcome of the study was that software dependencies have the following impact:

Defect rate

  • 3.1X increase between periphery and core

  • 2.6X for McCabe

  • Combined effect 8.3X

image-20240424-084601.pngImage Removed

Lower productivity

  • 50% decline as developer moves from periphery to core (conservatively)

Higher staff turnover

  • 10x increase in voluntary and involuntary terminations as developer moves from periphery to core

DSM-Design Structure Matrix

A Design Structure Matrix consists of a matrix to visualize Dependencies of hierarchically organized elements and a set of algorithms which can be applied on the matrix to sort the elements in order to discover layering.

An example of Quality Reviewer’s automatically generated Design Structure Matrix is shown below:

...

A Design Structure Matrix (DSM) consists of two parts

  • A matrix to visualize dependencies

  • Algorithms which can be applied on the matrix to discover e.g. layering in the software.

The DSM consists of a matrix with the same elements in the rows and columns

  • The hierarchy of packages and elements is visible on the left.

  • The relations between the elements are shown in the cells.

In a DSM, the hierarchy can also be folded in whole or in part. The relational strengths of the collapsed cells are simply combined. As a result, the DSM will become more compact, but will still remain correct in terms of content.

In this way it is possible to display a system with thousands of elements and still keep the overview.

Architectural Discovery

By applying a partitioning algorithm on the DSM, the layering of the software can be discovered. Such an algorithm tries to reorder the DSM in such a way that as many relationships as possible come under the diagonal.

After partioning elements with many inbound relationships (providers) have shifted to the bottom, while the elements with many outgoing relationships (consumers) have shifted to the top.

Cyclic relations can be easily spotted, because the type of relations remain above the diagonal.

DSM Assist in refactoring

A DSM can be used to improve the dependency structure. One can think of:

  • Removing cyclic dependencies.

  • Improving the cohesiveness of a component by move elements to other component were the have stronger relations.

In the matrix we can move an element to another component or layer, combine it with other elements or split and then recalculate all dependencies to see if this yields a better dependency structure.

After recalculating the dependencies it can be seen that the cyclical relationship between the presentation and application layer has disappeared.

The advantages of such an impact analysis are particularly evident in improvement scenarios that take place at the architectural level and thus affect multiple components. Without the use of a DSM, such analysis are unreliable, because the intended and the actual software architecture often do not match.

DSM-Supported Languages

  • .NET: C# and vb.NET

  • JAVA

  • C/C++

  • UML in Sparx System Enterprise Architect format

  • DSI File. Two DSI model files can be compared

A DSI file represent an analyzer’s output. Each code analyzer must export its DSM results to DSI file. To ensure that the Quality Reviewer can import this file, it must conform the DSI file XSD schema below:

...

DSI file is a way to import 3rd-party analyzer DSM output to Quality Reviewer.

DSM Application Area

Some common usage scenarios for DSM visualization of the code architecture are:

  • Reduce defects

    • By helping to reduce complex software dependencies.

    • By improving the understanding the system and the implications of change. See the conclusion of chapter 25 ‘Where Do Most Software Flaws Come From?’ from the book ‘Making Software’. See oreilly,

  • Reduce learning time for unfamiliar code bases:

    • By allowing you to get a high level overview of a code base.

  • Asses software architecture:

    • Discovery of software architecture of undocumented software.

    • Checking if it is in line with the documented architecture.

    • Discovery of emergent architecture. See Scaled Agile on intentional versus emergent architecture.

  • Impact analysis of architecture refactoring:

    • Align implemented architecture with intended architecture.

    • Isolate parts of the software, so they can be outsourced.

    • Encapsulate third party software, so it can be easily replaced.

    • Separating critical software from non critical software, so only critical parts need to be developed using more formal processes e.g. in health domain.

DSM Advantages

DSM visualization is a technique for analysing, improving, and managing complex system architectures.

  • Powerful technique

    • Scales better than boxes and lines diagram.

    • Highlighting dependency cycles is a key strength.

    • Partitioning algorithms provide mechanism for architectural discovery in large code base.

    • It can be easily kept in sync with the code.

  • Proven technique

    • Has been used successfully in a wide variety of projects in many industries.

    • Can be adopted at any stage of the project.

    • Enforce architecture: Check if implemented software architecture conforms to defined one.

    • Architectural Discovery: Identify structure existing code base.

    • Re-engineer/refactor: Impact analysis of architectural refactoring scenarios prior to implementation.

  • Can be applied at multiple levels

    • Architecture, Component and Class

Call Graph

Starting from source code, a Call Graph is automatically generated by Quality Reviewer showing how classes and functions call each other within an application:

...

Software Development Anti-Patterns

  • Accidental Complexity

  • Blob Class

  • Code Review Candidate

  • Complex Class

  • Excessive Coupling

  • Excessive Overloading

  • Indecent Exposure

  • Large Class

  • Lava Flow

  • Long Method Class

  • Long Parameter List

  • Poltergeists

  • Speculative Generality

  • Spaghetti Code

  • Lasagna Code

Architecture Anti-Patterns

  • Bloated Service

  • Dead Component

  • Dead Element

  • Deficient Encapsulation

  • Chatty Service

  • Data Service

  • Low Cohesive Operations

  • Stovepipe Enterprise (Megaservice)

  • Jumble

  • Vendor Lock-In

  • Combinatorial Explosion

  • Duplication

  • Deficient Names

Documentation

...

  • Feature Envy

  • Hub-like Modularization

  • Weakened Modularity

  • Functional Decomposition

Lasagna Code

  • Lazy Component (Class)

  • Refactoring Candidates

...

  • Swiss Army Knife

Further to the above available Software Development and Architecture Anti-Patterns, you can create your own custom Anti-Patterns based on metrics’ search queries, using graphs to interpret the impact of the values. When metrics based searches provide quick access to elements of interest, saving these queries serve as input for custom analysis.

...