User Tools

Site Tools


en:software:matlab:trepr:dev:i:guicli

Clear Distinction Between GUI and Functions

The GUI is just an addition to the actual toolbox functions. Although some users may exclusively use the GUI, it is important to separate GUI and functions.

To some extent it is a matter of taste which interface a user prefers, command line or GUI. If it comes to the internal design of the toolbox, it is not a matter of taste any more, but a strict requirement to fully separate function and (graphical) interface.

To give just a few important reasons for separating (graphical) interface and function:

  • The toolbox should always be fully operable from the command line (CLI).
  • To avoid writing code (functions) twice, the GUI should just call functions to perform actual tasks with the data.1)
  • In order to have a working “undo” functionality, every task performed on a dataset needs to be repeatable in a programmatic fashion, without any user interaction.2)
  • Being able to create a proper history of actions being performed on a dataset, every such action needs to connect to a separate function independent of the GUI and user interaction.

Developers' corner

Taking together the reasons for separating (graphical) interface and function as layed out above leads to a set of rules for interface design:

  • Functions need to be (potentially) fully independent of user interactions.
    • The function interface needs to cover all necessary parameters to perform the action.
    • How these parameters are collected is a matter of the respective interface.3)
  • Functions that use several parameters to perform their actions should (optionally) output that parameter set, most probably as an ordered list (Matlab™ structure).

To be continued…

1)
This is true regardless how simple that function may appear to be at the beginning. You never know how complex that function may become in the further development.
2)
Whereas a working “undo” functionality is still in the far future, the toolbox tries to take it into account from the very beginning, thus making the later implementation of such function easier.
3)
That could well mean that besides the GUI, one would like to write separate CLI functions for the actual routines as well.
en/software/matlab/trepr/dev/i/guicli.txt · Last modified: 2020/09/30 21:35 by 127.0.0.1