7.17. Restructure and Organize Code

Sonargraph offers the session model concept to be able to:

  • Restructure a software system applying refactorings.

  • Organize a software system defining an architecture.

  • Generate architecture DSL files to be checked automatically.

  • Generate refactoring lists applied to the "production" modifiable (virtual) model.

A session model is created using a specific structure aspect and applying operations on this structure. The structure is created based on the currently loaded (parsed) system after having applied the selected virtual model. The session model is persisted in a file. The user can define multiple session models. The session model is manipulated using the Session and Operations view.

NOTE: The session model support is still work in progress. Feedback is welcome.

Things that already work:

  • Create a Session model which is persisted in a file. Use File->New->Session->New Session... or right click in the Files view on the Sessions node. Choose between 3 model structures (physical with or without root directories or logical module scope) when creating a session. Open an existing session from the files view via the context menu. Both create and open will only be possible with a loaded parser model.

  • The Session 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 the platform with left mouse click to add or remove elements to/from the current selection.

  • Create and edit artifacts with their properties either based on a selection or empty. Try the context menu on selections (right mouse click) to see what is possible.

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

  • Defining allowed artifact connections.

  • Hiding non-artifact/non-module nodes in their corresponding artifacts making the unaccessible.

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

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

  • Architecture check in real time meaning that you see the dependencies changing their colors according to their violation state.

  • Undo/redo.

  • Architecture DSL file generation based on the defined session architecture.

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

Things to come:

  • More architecture check related features.

  • Possibility to apply delete dependency and move node refactorings.

  • Focus operations.

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

  • Drill down to programming element level.

  • Forward/backward navigation.

  • ...