Offline Development Environment Tips
On this page, we discuss various software development features available in the offline development environment for Quorum. This includes a variety of shortcuts and helpers for understanding or working with source code. Note that while these features are mentioned so that teachers or students can use them, all of them are optional. Source code written from a plain text editor will ultimately work the same after being compiled. By its nature, this tutorial uses concepts learned throughout the course, so it is somewhat advanced.
The NetBeans programming environment, by default, has a wide variety of keyboard shortcuts available to the user. These shortcuts vary by operating system and can be customized by preference. In this section, we discuss some of the more common shortcuts.
When navigating throughout NetBeans, there are a variety of shortcuts that can assist in getting from place to place. These are described in this section.
- Projects Window (CTRL + F5 or APPLE + 1): This window allows us to navigate source code files and project data.
- Editor Window (CTRL + F5 or APPLE + 0): This window is the primary active editor on the system.
- Navigator Window (CTRL + F5 or APPLE + 7): This window allows us to navigate around a source code file logically, as opposed to line-by-line, with the keyboard.
- Output Window (CTRL + F5 or APPLE + 4): This window shows the output of any software we are writing.
- Variables Window (CTRL + F5 or SHIFT + CONTROL + 1): This window shows any active variables and what information they contain.
- Call Stack Window (CTRL + F5 or SHIFT + CONTROL + 3): This window shows us, while debugging, what kind of actions have been called and are currently in memory.
- Breakpoints Window (CTRL + F5 or SHIFT + CONTROL + 5): This window shows us what breakpoints are currently active on the system.
This section includes a variety of new hotkeys for keyboard navigation in the editor. There are many more hotkeys other than those listed here, but these can be useful.
- Jump Between Brace Matches (CTRL + [ or APPLE + [): In the editor, when items match, like an if statement, loop, action, or class, some items will be shown in yellow if they match appropriately. This keyboard shortcut allows the user to jump between the beginning or ending of those points.
- Next Marked Occurrence (ALT + UP or DOWN): In the editor, when a symbol is in scope and the cursor is on it, it is marked (in yellow, by default). By pressing ALT + UP or ALT + DOWN we can jump between these occurrences.
- Go to Line (CTRL + G): In the editor, if we press CTRL + G, we can then type a line number and jump to it.
- Go to Declaration (CTRL + B or APPLE + B): In the editor, if the cursor is on a variable, type, or action, we can jump to where that item is declared by pressing this hotkey. For example, if you make class of a particular type, or use something from the standard library, we can jump to that source code and examine it.
- Use Editor Hint (ALT + ENTER): In the editor, the compiler can sometimes make a suggestion, or automatically fix an error. When this occurs, we can press ALT + ENTER and a box will appear to allow this to occur automatically.
This section includes a variety of new hotkeys for keyboard navigation in the editor. There are many more hotkeys other than those listed here, but these are particularly useful.
- Run (F6): This shortcut will run the active project.
- Build (F11): This shortcut will build the active project.
- Clean and Build (SHIFT + F11): This shortcut will first clean the active project, which means delete any of the previously built files (if any), and then rebuild it from scratch.
- Stop Currently Executing Program(CTRL + SHIFT + DELETE or APPLE + SHIFT + DELETE)
Debugging Quorum in NetBeans is very similar to debugging in most programming languages. Specifically, when a debug session is started, Netbeans loads new controls, which are in the top bar (as shown in the previous image). These controls and their keyboard shortcuts are named below and their purpose is described.
- Start Debugging (CTRL + F5 or APPLE + F5): Start the debugger
- Stop Debugging (SHIFT + F5): Stop the debugger.
- Pause (no hotkey is available by default): If a Quorum program is currently executing, this will temporarily stop it.
- Continue (F5): If we are stopped at a breakpoint, this will resume execution of the program.
- Step Over (F8): Execute the current line and stop at the next one.
- Step Into (F7): Execute the current line and if the current line contains an action, go inside of that action and stop.
- Step Out (CTRL + F7 or APPLE F7): If we are inside of an action, finish it and stop again when control goes back to whatever component called that action.
- Run to Cursor (F4): Continue the program until it hits the cursor. If the cursor is never hit, the program either runs forever or terminates.
- Stop Currently Executing Program (CTRL + SHIFT + DELETE or APPLE + SHIFT + DELETE)
Miscellaneous Shortcut KeysThere are many shortcuts for performing various tasks in Netbeans. Many additional shortcut keys can be found in Oracle's guide to NetBeans' shortcuts Shortcut keys are often dependent on the operating system and can always be changed in the preferences window.
Development Environment Features
This section provides a basic list of features that the development environment for Quorum supports and their broad purpose. Using these features is optional.
Many modern development environments, including the one for Quorum, has a feature that is often called code completion. Code completion is a pop-up window that provides information about the source code. It used to determine the kinds of actions, variables, or other attributes of the object we can interact with.
Coloring, Highlighting, and Folding
This image shows an example of the coloring, highlighting, and folding features in NetBeans. Notably, there are several kinds of colors. Blue indicates keywords, green indicates field variables, and a yellow highlight indicates all of the locations that the variable is used. The keyboard shortcuts above allow us to quickly navigate between the items.
In addition to colors, NetBeans allows us to "fold" regions of our source code, in order to hide them. By default, folds are open, but by using keyboard shortcuts or the mouse, we can open and close them.
Sometimes when we program, we make errors. At other times, the programming language we are using can detect aspects of the program we are writing and provide us with suggestions. For example, one common error is to "forget" (or not know) where a library lives on our system. Consider the class Drawable in the following image. If we were to type Drawable and then a variable name, Quorum can detect that there is a class called Drawable in the standard library and provide us a suggestion to fix it automatically. In other words, it is not necessary to memorize all of the locations for classes in the standard library, as Quorum can figure them out on its own. The hotkey for this is ALT + ENTER.
There are many ways to navigate source code in modern development environments. We can use the mouse to navigate or scroll in an environment. We can use the keyboard shortcuts to move between declarations, highlights, or by line. Many environments also include a built in navigation window. The navigation window is an optional way to move around source code logically, with either the keyboard or mouse. It is sometimes useful to view code in this way, as opposed to line-by-line.