Warning, /sdk/codevis/doc/getting_started.md is written in an unsupported language. File is not indexed.

0001 # Getting Started
0002 
0003 This documentation the GUI application. For the command line tools see the [CLI documentation](command_line_codebase_generation.md).
0004 
0005 - [Visualizing code](#visualizing-code)
0006 - [Generating a database using the GUI](#generating-a-database-using-the-gui)
0007 
0008 ## Visualizing code
0009 
0010 Before going into details on how to visualize your own code, consider the [pre-parsed project files in our repository](../examples/).
0011 Codevis GUI doesn't visualize source code directly, it visualizes project files (.lks files) previously parsed using
0012 our parsing libraries. This can be done either using the CLI or the GUI.
0013 
0014 For a first approach, consider the example project [codevis.lks](../examples/codevis.lks). To visualize the code,
0015 first [download and install codevis](../README.md#prebuilt-binaries) and open the GUI and select "Open existing project", then
0016 select the `codevis.lks`.
0017 
0018 ![example-1](images/codevis-1.png)
0019 
0020 The left panel shows the available packages for this project. Depending on how your project has been parsed, it may be
0021 the case that your packages end up in the `non-lakosian group`, so you may want to expand that group to search for it.
0022 you can also `ctrl-f` for specific packages or components to filter the tree.
0023 
0024 Select `lvtldr` in the tree and drag-and-drop it to the scene. Right click on the `lvtldr` package in the scene and then
0025 select "Load packages or Components" to visualize that particular package:
0026 
0027 ![example-2](images/codevis-2.png)
0028 
0029 Codevis will try to show packages and components in a "levelized" way, as shown in the above figure. But if there are
0030 dependency cycles in the code, it will heuristically try to accomodate components in a digestable way, if possible. In
0031 the image above, there is a cycle between some of the components, but there's still a heuristically-defined hierarchy
0032 between the components.
0033 
0034 "Raw" codevis is only able to show your architecture as it is. In order to further inspect the codebase, the plugin system
0035 must be used. There are [several plugins implemented](../plugins/), but users can develop their own. See the [Python Template Plugin](../plugins/python_template_plugin/) for
0036 a quick example. For more information see the [Plugins documentation](plugins.md).
0037 
0038 
0039 ## Generating a database using the GUI
0040 
0041 In order to parse your code, you need a [compile_commands.json](https://clang.llvm.org/docs/JSONCompilationDatabase.html) file. This file [can be easily generated by cmake](https://cmake.org/cmake/help/latest/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html) adding
0042 `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` when you run cmake. If you are not using cmake, consider using [Bear](https://github.com/rizsotto/Bear).
0043 
0044 Open the GUI and navigate to "File/New Project From Source Code...". In the dialogue that
0045 pops up, options can be set for the database generation. Give your project a name before the parsing dialog shows.
0046 
0047 ![example-3](images/codevis-3.png)
0048 
0049 The suggested setting for the "ignore file matching glob pattern" is
0050 ```
0051 *.t.cpp,*thirdparty*,*standalone*,*.m.cpp
0052 ```
0053 but this is just a suggestion so that the resulting database don't consider those files.
0054 
0055 The "Parse only physical relations" controls whether the tool will only look at
0056 physical information or if it will also generate logical information. See the
0057 [Physical vs Logical](#physical-vs-logical) section for more information.
0058 
0059 Once you're ready, press "Parse" to begin database generation. There is a
0060 progress bar to track what is happening. After the physical parse is done the
0061 window can be closed using the "Hide" button. If a logical parse was also
0062 requested, this will continue in the background even after the window is closed
0063 and the database will be updated with logical information once it becomes ready.
0064 
0065 
0066 ### Physical vs Logical
0067 
0068 As discussed in "Large-Scale C++ Volume 1" by John Lakos, the physical design of
0069 software relates to how files are laid out on disk and how they are compiled
0070 and linked into a unit of release. The logical design of software relates to
0071 the layout of the software within the semantics of the programming language.
0072 
0073 For example, physical things include
0074 - Components
0075 - Packages
0076 - Package groups
0077 - Physical dependency (`#include` relationships between components) relationships
0078 
0079 Logical things include
0080 - Types
0081 - Namespaces
0082 - Uses-In-The- relationships
0083 - Is-A relationships
0084 
0085 Creating a database storing only the physical layout of software is relatively
0086 fast because only the layout of files on disk and their `#include`s need to be
0087 processed. A "physical-only" parse is recommended if you are only interested in
0088 this information.
0089 
0090 Viewing logical information requires a logical parse (done after a physical
0091 parse). This takes much longer because a full AST has to be generated and type
0092 checked and more information has to be stored about each file.