magazine resources subscribe about advertising

New Architect Daily
Commentary and updates on current events and technologies

CMP Media E-Book

Download your copy today.

Research
Search for reports and white papers from industry vendors and analysts.

This Week at NewArchitect.com Subscribe now to our free email newsletter and get notified when the site is updated with new articles







Day of Defeat Online Gaming

 New Architect > Archives > 2000 > 10 > Java@Work  

Powers of Observation

By Al Williams

Both Smalltalk and C++, two common object oriented programming languages, provide architectures for creating multiple views of a single data source. In Smalltalk the architecture is called the Model-View-Controller (MVC). In the popular Microsoft Foundation Classes (MFC) for C++, it is known as the document-view architecture.

The idea is simple: Use one object to represent the data, and another object to represent a user's view of that data. For example, a spreadsheet document object stores numerical data and performs calculations on those numbers. The spreadsheet view object, on the other hand, knows how to present the classic grid and respond to user input.

Such an architecture has several advantages, especially for programs that have graphical user interfaces. With each view being described by an object, it's easy to spawn views in different windows, so that a user can have one window displaying a spreadsheet grid, and two windows displaying the same graph, and another displaying a chart. Also, your view objects can share a common library for visual operations like scrolling and splitting screens.

An Architecture for Java

To create an applet that gives a temperature reading in text and displays a graphical thermometer in a separate window, you can make use of Java's low-level support for building MVC-style programs. The java.util.Observer interface and the java.util.Observable class provides this support. The framework, however, is sparse and to make real use of it you have to do a bit of work.




  Day of Defeat Online Gaming

home | daily | current issue | archives | features | critical decisions | case studies | expert opinion | reviews | access | industry events | newsletter | research | careers | info centers | advertising | subscribe | subscriber service | editorial calendar | press | contacts


Copyright © 2006 CMP Media, LLC Read our privacy policy, your California privacy rights, terms of service.
SDMG Web sites: BYTE.com, C/C++ Users Journal, Developer Pipeline, Dr. Dobb's Journal, DotNetJunkies, MSDN Magazine, Sys Admin,
SD Expo, SD Magazine, SqlJunkies, The Perl Journal, Unixreview, Windows Developer Network, New Architect

web2