On Fri, 2004-12-17 at 21:21 +0100, David Landgren wrote:
List,
I have some code that queries an HP LaserJet 4600 printer to retrieve a web page, that I then scrape to pick out the values of the various consumables it has (CMYK cartridges and other kits).
[...]
Printer:: comes to mind. How about:
Printer::Status::<Brand>::<Model>
<Brand> could provide the a common interface around (and wrap) Model.
And Status could provide the generic interface for printer status.
Just some thoughts...
Thanks for that.
This matches my thoughts nicely. I just wasn't sure whether the top level namespace should be Printer or not. There's already a Printer module (although it does printing, rather than dealing with printers).
The biggest problem I see is how to avoid having to sketch out everything up front. I think it's only after I get 3 or 4 Printer::Status::x::y modules under my belt that I'll *begin* to get a feel for where the divisions lie and what methods can be hoisted up the namespace to Printer::Status::X or Printer::Status.
For instance, the older 4500 model had three cartridges: drum, transfer and fuser. The new one only has two, they did away with the drum. Not all models have the same consumables; two models may have none in common. I'm not sure how to represent this elegantly. What I do know is that I don't want to build up a towering hierarchy of classes for something which is, at the end of day, really pretty trivial.
David
