Chapter 11. Interactive Restructuring and Code Organization

Sonargraph offers the concept of the architectural view to enable:

  • Interactive restructuring a software system via refactorings.

  • Interactive organization of a software system via architecture artifacts. Components (physical) or top-level programming elements (logical) are assigned to those artifacts based on the package, namespace or directory structure or based on an architectural pattern language overcoming structural constraints.

  • Generation of architecture DSL files that can be automatically checked.

  • Generation of refactoring lists that are applied to the "production" modifiable (virtual) model.

An architectural view is created using a specific structural aspect and by applying operations to it. The structural aspect is created based on the currently loaded (parsed) system after applying the selected virtual model. Multiple architectural views can be defined that are each persisted in an individual file.

  • Creation of an architectural view which is persisted in a file. Use menu "File""New""Architectural View""New Architectural View..." or right-click in the Files view on the Architectural Views node and use the corresponding context menu entry. Choose between 4 model structures (physical with or physical without root directories, logical system or logical module scope) when creating an architectural view. An existing architectural view can be opened from the files view via the context menu or via double-click. Both "create" and "open" interactions require a loaded parser model.

  • The architectural view shows a tree-like structure down to component level (physical) or top-level programming element (logical).

  • Selection support by pressing SHIFT in combination with the arrow keys (up and down) or left mouse click for bulk selection. Use the modifier key (CMD, CTRL) of your operating system in combination with left mouse-click to add or remove elements to/from the current selection.

  • Artifacts with their properties can be created either based on a selection or empty. Try the context menu on selections (right mouse click) to see what is possible. F2 allows editing 1 or multiple artifacts.

  • Assignment of elements to existing artifacts or removal from existing artifacts via drag and drop.

  • Assignment and parent structure changes for artifacts are possible via drag and drop.

  • Assignment of components (physical) or top-level programming elements (logical) to artifacts with manual filter definition using patterns. All assignment strategies from the architecture DSL are supported, see Section 10.1, “ Models, Components and Artifacts ” and following chapters.

  • Defining allowed artifact connections.

  • Hiding non-artifact/non-module nodes in their corresponding artifacts to make them unaccessible.

  • Applying delete refactorings to non-artifact/non-module nodes.

  • Applying delete refactorings to dependencies.

  • Applying move refactorings to components (physical) or top-level programming elements (logical).

  • Applying rename refactorings to non-artifact/non-module nodes.

  • Using focus operations visualize only certain elements of the Architectural view.

  • Creating packages, namespaces or directories when needed as targets for move refactorings.

  • The operations you apply (e.g. create/edit artifacts, move elements, delete elements ...) may be seen in the operations view. The operations may also be deleted from that list using the context menu. Operations that have no effect (e.g. a previous element is no longer their because the code changed) are marked with a warning marker.

  • Checking the architecture in real-time meaning that you see the dependencies changing their colors according to their violation state.

  • Undo/redo of operations.

  • Forward/backward navigation.

  • Generation of an architecture DSL file based on the model defined in the architectural view.

  • Export of resulting refactorings into an Excel file.

  • Export of resulting violations into an Excel file.

  • The views Properties, Parser Dependencies (Out) and Parser Dependencies (In) react to the selection in the Architectural view and show the corresponding additional information of the selected element.

Things to come:

  • Transfer refactorings to the "production" modifiable (virtual) model.

  • Drill down to programming element level.

  • More architecture check related features.