21.07.2013 Views

User Interface Design and Ergonomics - National Open University of ...

User Interface Design and Ergonomics - National Open University of ...

User Interface Design and Ergonomics - National Open University of ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

3.3.2 AS A DESIGN PATTERN<br />

MVC encompasses more <strong>of</strong> the architecture <strong>of</strong> an application than is typical for a<br />

design pattern. When considered as a design pattern, MVC is semantically similar<br />

to the Observer pattern.<br />

Model<br />

Is the domain-specific representation <strong>of</strong> the data on which the application<br />

operates. Domain logic adds meaning to raw data (for example, calculating<br />

whether today is the user's birthday, or the totals, taxes, <strong>and</strong> shipping charges for<br />

shopping cart items).<br />

Many applications use a persistent storage mechanism (such as a database) to<br />

store data. MVC does not specifically mention the data access layer because it is<br />

understood to be underneath or encapsulated by the model.<br />

View<br />

Renders the model into a form suitable for interaction, typically a user interface<br />

element. Multiple views can exist for a single model for different purposes.<br />

Controller<br />

Processes <strong>and</strong> responds to events (typically user actions) <strong>and</strong> may indirectly<br />

invoke changes on the model.<br />

3.4 MVC IMPLEMENTATION FRAMEWORK<br />

3.4.1 GUI FRAMEWORK<br />

a. Java: Java Swing<br />

Java Swing is different from the other frameworks in that it supports two MVC patterns:<br />

Model<br />

Frame level model—Like other frameworks, the design <strong>of</strong> the real model is usually left to<br />

the developer.<br />

Control level model—Swing also supports models on the level <strong>of</strong> controls (elements <strong>of</strong><br />

the graphical user interface). Unlike other frameworks, Swing exposes the internal<br />

storage <strong>of</strong> each control as a model.<br />

View<br />

The view is represented by a class that inherits from Component.<br />

Controller<br />

Java Swing doesn't use a single controller. Because its event model is based on interfaces,<br />

it is common to create an anonymous action class for each event. ] In fact, the real<br />

controller is in a separate thread, the Event dispatching thread. It catches <strong>and</strong> propagates<br />

the events to the view <strong>and</strong> model.<br />

b. Combined frameworks<br />

Java: Java Platform, Enterprise Edition (Java EE)<br />

Simple Version using only Java Servlets <strong>and</strong> JavaServer Pages from Java EE:<br />

144

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!