CSE logo University of Washington Department of Computer Science & Engineering
 CSE 590YA - Summer 2001 - Homework #1
  CSE Home  About Us    Search    Contact Info 

Message Handling for Composite Widgets

Due: Wednesday, June 27, 2001

A student solution that received high marks can be found here.

Description

For this assignment, you are required to design the event-handling component of a PRISM-like user interface in a modular, yet tightly-coupled fashion. Specifically, you are to implement two classes of concrete widgets, a TextBox widget and a Dial widget, each of which may be modified by the user. Because each widget's modifications have a direct effect on what the other widget is displaying, you must implement a higher level object called a DialBox (which could be thought of as containing the TextBox and the Dial, but does not need to have any visible manifestation in the user interface) to handle message-passing between the two widgets. Moreover, since DialBox objects may be part of a much larger system (as in PRISM), DialBoxes should also (a) notify an even higher-level object that data within the DialBox has been changed, and (b) receive messages from higher-level objects that some external data has been changed and in turn notify both the Dial and the TextBox to update themselves.

As we discussed in Wednesday's seminar, the tricky part of this kind of modular design is avoiding loops, wherein widget A notifies the rest of the system's widgets that they should be updated, each of which sends a message back saying that they have been updated, prompting widget A to update itself and start the whole process over again. There are a handful of ways to avoid this problem, and a whole lot more ways of *almost* avoiding the problem. Please submit one of the former!

In your design, you may assume that low-level window events are handled by a main event loop and that your widgets are notified of such events through some generic method that every widget should implement (it could be called, say, "yourValueJustChanged"). You may NOT assume that you have access to any prepackaged message-passing libraries. It is the message-passing that is the most important component of this assignment. As such, please don't spend a lot of time implementing GUI methods for your TextBox and Dial -- focus instead on the data-passing and updating methods.

Guidelines

You are free to design your system in any programming language you like, and your solution in any such language shouldn't really take more than a page. Please be sure to comment your code, or attach a half-page description of what your code is doing. The assignment is due in written/printed form next Wednesday, June 27, in class.

Questions & Clarifications

As always, please contact Ira or me with questions, and if we get enough e-mails containing the same question, we'll update this page with a clarification.

590YA Home


CSE logo Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
(206) 543-1695 voice, (206) 543-2969 FAX
[comments to owner-cse590ya]