The Java Tutorials' Weblog

pageicon Thursday May 08, 2008

Tutorial Examples and Model View Controller (MVC) Design

On the Java Tutorials Community Portal forum, developer Arjan Vermeij recently posted an update to an old Swing demo -- SliderDemo3. (Actually, he first posted his demo some time ago on a different java.net forum, but I asked him to post it on our forum.)

I'm sure many of you are familiar with Model-View-Controller (MVC) design. If you aren't, the purpose of MVC design is to separate the data and logic from the GUI, or the display, of an application. In fact, Arjan has written an article on this very subject: A Generic MVC Model in Java if you would like more information.

For program design, this just makes good sense.

However, Arjan points out that we don't use MVC design in our tutorial examples. He has taken SliderDemo3 and re-designed it using MVC architecture. He illustrates the point of MVC design by extending the GUI of the example without affecting the rest of the code. It's nicely done.

I posted some commentary about his example in the slider-demo-3 thread. I won't repeat the whole entry here, but this is one of those trade offs we look at when working on the tutorial. To create tutorial examples with perfect design principles, we would have to bloat examples that are designed to illustrate a specific piece of information. Sometimes, we just don't want to do that.

However, I do think there is room for more sophisticated "real world" examples and we haven't addressed that need as well as we might. It's an issue I don't see being resolved in the near future, with resources being what they are.

This is why the Java Community Portal is a needed resource. People like Arjan can share and leverage this sort of information.

To follow (or contribute to) the discussion, check out the slider-demo-3 thread.

-- Sharon Zakhour

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed

« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
12
14
15
16
18
19
20
21
22
23
26
27
28
29
30
     
       
Today

Feeds

Search this blog

Links

Weblog menu

Today's referrers

Today's Page Hits: 430