|
|
Introduction
Why use a framework?
Download
Vision
API stability
Code optimization
Bibliography
Features
Object messaging
Extensibility
Drag-and-Drop
Networking
3D Graphics
Powerful tables
Styled text editor
Memory leak debugger
Tutorial
Class tree
Open protocols
Known bugs
Next release
Future plans
Projects
FAQ
Other software
Log in
|
|
|
|
Why use an Application Framework?
The main advantage of using an Application Framework is that you do not have to re-invent the wheel from scratch. There are several levels of re-use that can be provided by a library:
- If you start with a library of standard widgets, you can build dialogs
very rapidly because you only have to arrange the widgets and write the
code to process the values entered by the user. However, this is
sufficient only for simple utility programs that only display a dialog
and then perform some actions based on the user's input.
- If the library includes support for the Model-View-Controller paradigm,
then you will be able to write your code in a much more maintainable and
extensible way because your objects will be loosely coupled.
Without MVC, every interaction between objects must be implemented with custom
code. With MVC, objects interact by sending each other messages. Each
object therefore only needs to know about messages that it expects to
send and receive, and not about who needs to receive its own messages.
As an example, if one is plotting data, then the Model would be an
object which stores the data to be plotted. The View-Controller is the
graphical widget that actually draws the graph. One can write many
different View-Controller widgets to plot the same data in many
different ways: Cartesian, Polar, 3D, etc. The code for the Model only
has to be written once, and the messages that it sends out notify the
Views when the data is changed (and therefore needs to be redrawn).
With no extra effort, one can even have multiple, simultaneous Views
which all display the same Model.
- If you start with a true application framework, you also get support
for the Document-View architecture. This provides another mechanism for
writing loosely coupled code. An object in one of the program's windows
simply displays, and allows the user to manipulate, that object's data,
i.e., it is a View-Controller, as discussed in #2 above. The Document
class contains the application specific code that binds all the Views
together into a coherent whole. The Document also retrieves and stores
the data, either from a file or from some other source. The Views can
therefore be re-used in other programs because they are only data or
task specific, not application or data source specific.
A good application framework also provides all the necessary
functionality required to rapidly implement Documents that are stored in
files, i.e., Load, Save, Revert to Saved, Save as, Safety Save, etc.
In the JX Application Framework, the JXFileDocument class provides this functionality.
|
|