Extrapolating Device Drivers

I will agree that OOP seems to have some slight advantages when it comes to things that can be easily viewed as relatively simple "device drivers". Specific GUI widgets may be such a case. However, I have not found a way to view everything as a convenient device driver. Many things in custom business applications are simply too interrelated and have constantly-changing "interfaces".

Your use of the term "device driver" borders on EquivocationFallacy, top. On one hand, it includes lots of things (such as GUI widgets), usually not considered to be "device drivers" by the programming community. OTOH, the fact that you use this particular term, generally associated with low-level programs to control hardware, suggests an implication that these sorts of tasks (where a RelationalDatabase would be clearly inappropriate) are somehow "lesser" than, say, OnLineTransactionProcessing? or other "business" applications. (This is an unfortunate prejudice that exists in much of the programming community, as systems programming is both essential and honorable, but it exists).

You ought to be clear as to what you mean by a DeviceDriver. If by that you mean systems programming; then your assertion that the RelationalModel is inappropriate only for "device drivers" is demonstrably incorrect. If, on the other hand, a "device driver" is defined as "something that a RelationalDatabase is inappropriate for", then your claim is a tautology and therefore vacuous.

Please elaborate.

Attempts to make entity-based device-driver things just don't seem to capture the same simplicity of a simple device driver. For example, it does not seem to work out well to make an "Invoice" device, a "Customer" device, etc.

You can erect a better StrawMan than that. Nobody, outside of you, would ever suggest that invoices, customers, and such are "devices".

Business rules are just too interweaving and interrelated to isolate behind clean, stable interfaces. Which "noun" behavior belongs with becomes rather arbitrary. It may change over the course of a project. For example, discounts may be based on where the customer lives one year, and then changed to reflect purchasing history the next. Thus, attaching discounts to Customer is in vain. Plus, there is often no need to reuse entity-specific behavior between different applications/projects. They are very specific to a given need.

A device-driver viewpoint tends to only work when these conditions are true:

What is a "device-driver viewpoint"? I'm not aware of any such paradigm. If you want to make claims about OO, say OO. For what it's worth; OO is most decidedly not usable only under the following constraints.

-- top

Have you ever written device drivers, top? You seem to have several misconceptions about them. What environment did you write them in?

In an informal sense I did a fair amount with pre-Windows printers. But generally I am talking about TextbookOo-like examples. RobertCecilMartin has some examples on his website.

The sort of OO that is found in textbooks ought not be considered a representative sample of real-world problems. Just because some textbook has toy examples, that doesn't mean that more difficult (and more RealWorld) problems are somehow out of reach.

[Since whatever you want to talk about seems to revolve around this, and we apparently haven't seen the kinds of examples you have in mind, would you please provide a more specific pointer, so that we can all talk about the same thing. I wandered around "his website" (may or may not be the one you meant) for a while and didn't see any such thing.]

http://www.objectmentor.com/resources/articles/dip.pdf

[Oh yeah, actually I have read that before. Pretty shallow article; primarily he's illustrating his own idiosyncratic definition of OO. As far as I know, he's the only pundit who uses that DependencyInversion definition. If you think it's a weak technique, I sympathize; to my mind it's more closely related to pre-OO structured programming techniques.]

[Anyway he uses the phrase "I/O driver", not "device driver". I think he was ill-advised to do so, since it sounds like a kind of device driver. Perhaps "I/O handler" would be a safer phrase for what he's talking about.]

[But even he isn't saying that everything should be viewed as an I/O handler. That's merely a toy example. His actual point is about DependencyInversion. It's just that it's unclear what he means by that without an example, is all.]


A question for you, Top. Back up a step and ignore "device drivers" for a second. Instead, please describe the applications/environments/functions, etc. which, in your opinion:

Be specific. :)

WhenToUseWhatParadigm is perhaps the best place to discuss this, and may already have the answers.


EditText of this page (last edited October 25, 2005) or FindPage with title or text search