concept view in category software development

This is an excerpt from Manning's book Seriously Good Software: Code that works, survives, and wins.
Evaluating software from different points of view and for different objectives
Figure 9.5. The communication scheme for the refactored plotting program. According to MVC, the controller interacts with the views only through the model. The arrows between ObservableFunction and ParametricFunction indicate that the former implements the latter, and in addition contains a reference to an inner ParametricFunction.
![]()

This is an excerpt from Manning's book Test Driven: Practical TDD and Acceptance TDD for Java Developers.
How’s that possible? What are we supposed to imagine? We imagine the ideal shape and form of the production code from this particular test’s point of view. Isn’t that cheating? Yes, it is cheating, and we love it! You see, by writing our tests with the assumption that the production code is as easy to use as we could imagine, we’re making it a breeze to write the test and we’re effectively making sure that our production code will become as easy to use as we were able to imagine. It has to, because our tests won’t pass otherwise.
Figure 8.1. The MVC triad and its relationships. The controller acts on the model based on input from the view, the model worries about domain logic unaware of any details of the view or the controller, and the view registers with the model for change notifications and renders the data it obtains from the model.
![]()
In MVC, the controller’s responsibility is to capture user input from the view’s widgets and inflict the appropriate changes to the model, causing the view to update. The model’s only job is to encapsulate domain logic and, if using the Observer pattern, notify registered views of the change. What’s left to the view is the presentation—displaying the data it gets from the model.
The Supervising Controller pattern[4] is a variation of MVP where the presenter (or controller) is responsible for handling all user input (the view delegates all user gestures directly to the registered presenters), and the majority of view-model synchronization happens through data binding, typically using something like the Observer pattern where model objects notify registered listeners—the presenters—of changes, who in turn trigger view widgets to pull the changed data from the model.
As we can see from listing 8.1, the responsibilities of the presenter class are to
register handlers for the various user gestures coming from the view, to
operate on the model objects as appropriate in response to the user gestures, and to
trigger view updates. Considering that the GreenBarView is an interface and that the GreenBarModel is a plain ol’ Java object, the presenter is just as easy to test (and test-drive!) as any regular Java code. Also note that there’s not a single javax.swing.* interface in sight—that’s all left to the view.
Speaking of the view, let’s take a quick look at the view interface for a Supervising Controller-style MVP triad—the GreenBarView, that is:
public interface GreenBarView { public void addRunButtonListener(RunButtonListener listener); void update(GreenBarModel model); }That’s a pretty simple interface. There’s one method for registering new user-gesture handlers and one for telling the view to update itself from the given GreenBarModel. We can imagine the concrete Swing implementation of the GreenBarView interface will be easy to test:
Instantiate the view class, register a listener, simulate a click on the Run button, and verify that the registered listener received the event. Instantiate the view class, pass it a model to update from, and verify that the appropriate widgets now hold the new data.
register handlers for the various user gestures coming from the view, to
operate on the model objects as appropriate in response to the user gestures, and to
trigger view updates. Considering that the GreenBarView is an interface and that the GreenBarModel is a plain ol’ Java object, the presenter is just as easy to test (and test-drive!) as any regular Java code. Also note that there’s not a single javax.swing.* interface in sight—that’s all left to the view.