31 August 2010

Software Design Puzzle #4 - Building A Flexible Weather Station

The puzzle is on building a flexible weather station. This weather station's main job is to provide instantaneous updates to its clients on various weather conditions like temperature, atmospheric pressure, wind speed, pollution levels and a forecast on the rain. The clients are heterogeneous starting from a full blown weather forecasting websites which are interested in all updates (everything from temperature to rain forecast that are available time to time) to a roaming marketing guys who just want forecast of rain to plan their travel. The point is there are few clients that want all updates, few wanting all except few conditions and many wanting only few conditions. The clients will also be requesting for more weather parameters dynamically.

The requirement is to identify design pattern(s) that will suit these requirements. Model the class diagrams focusing on important aspects of the design. The following is a just a sample client (thanks to Google).

A question that comes to my mind on these puzzles. Does it really help me to build my OO expertise?

An honest answer is it depends. The idea of posting these puzzles is not make us OO guru with few hundred puzzles and in fact OO requires naked thinking. I feel that a lot of thinking can be stimulated by these examples. Memorizing a design doesn't help though. Just skim through the puzzle and solve it. When you are solving think about abstraction. Abstraction is your ability to see sand in a beach as a thin line when you are flying few thousand feet above and view them as a mighty rock when seeing through microscope.

No comments: