Chapter 11. Interactive Restructuring and Code Organization

Sonargraph offers the concept of an architectural view to enable:

  • Interactive restructuring a software system via refactorings.

  • Interactive organization of a software system via architecture artifacts.

  • 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.

NOTE: The architectural view is still work in progress. Feedback is welcome.

Implemented functionality:

  • 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 logical 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 the artifact.

  • 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 elements with manual filter definition using wildcard patterns (including retrievers) known from the architecture DSL (see Section 10.1.1, “Using other criteria to assign components to artifacts”).

  • 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 logical top-level programming elements (logical).

  • 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.

  • 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:

  • More architecture check related features.

  • Possibility to apply more move refactorings.

  • Possibility to apply rename refactorings.

  • Focus operations.

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

  • Drill down to programming element level.

  • ...