FS3D
Design patterns

This page give a brief overview of the design patterns used in Fs3d.

The C++ version of FS3D (FindSources3D) is built around dtk plugin system. It uses mainly MVC, and facade design pattern (a design pattern being a solution to a common software architecture problem).

dtk plugin system

A plugin is an implementation of a concept. These concepts, corresponding to an abstraction of an atomic ("elementary") operation (e.g. dipolefit) are defined in fs3dCore. Plugins are designed following the facade pattern described below.

MVC

general definition

the MVC (Model View Controller) design pattern defines three elements:

the model contains the data (e.g. a database) the controller make use of these data. It is the intelligent (algorithmic) part of the software. the view is the part that allow the user to pilot (interact) with the software.

the MVC pattern is actually layered: the model is independent of everything else, the controller knows the model, and the view knows the controller (but not the model, though it can manipulate it through the controller).

Changing a layer should not affect the others (as long as the API (i.e.: the exposed functions) doesn't change).

fs3d implementation

the model part is in the folder fs3dCore/data. It defined the data types used by the different modules. the controller is splitted in three parts: -the module definition, defining the module's API is in fs3dCore -the concrete implementations of these modules are in the plugins -the aggregation of the whole pipeline (i.e. combining the atomic operations into more complex ones) is done in fs3dPipeline class in fs3dCore. the view part is in fs3dWidgets for the most part, and in app for the fs3dMainWindow that aggregate all the widgets together.

facade pattern

This design pattern is used to provide a "service" to the use. All the internal operations are hidden to the users, (black box concept), and the service is provided though an unique API. That's how modules are implemented in FS3D: plugins have to match an interface (defining the methods setInput(), run(), output() ) while the main application uses plugins only through this interface, without any knowledge of the plugins internals.