Stupid Human Programming
Talk on software development.








Subscribe to "Stupid Human Programming" in Radio UserLand.

Click to see the XML version of this web page.

Click here to send an email to the editor of this weblog.


Saturday, October 19, 2002
 

Bala Paranj wrote: Hello, If I have an abstract class Bird and subclasses Sparrow, Pigeon and Ostrich having methods fly(), with no-op for the Ostrich fly() implementation. I am violating the LSP. Is this violation acceptable? Is there any case where the violation is acceptable?

My Reply:

It's up to you. LSP is helpful in programming because it let's programmers more confidently reason about programs because they can assume they know how something will behave. LSP is not a constraint in the real world, it is a constraint that can be put on software to help build systems.

One root of the problem is that types in most programming languages are based on classical categorization. The real world is much more interesting and may combine examplar and prototype based categorization (http://www.bsos.umd.edu/hesp/newman/Newman_classes/Newman300/webpages/categorization.pdf).

A tree stump can be considered on the outer boundry of being a seat, but it's not our best example of a seat. And in fact the only reason a tree stump could be considered a seat at all is because we are human. In the classification system of an ant or an elephant, a tree stump probably wouldn't be in the seat category.

This sort of ambiguity is not easily represented in class structures.

The categories we think of as natural and intrinsic to the world are largely the production of our human embodied self's relation with the world.

In the same way categories in your system need to be related to the problem space. The problem space is what embodies your solution and acts as the context in which questions, definitions, and relationships are resolved.

If you wish to build a software system then following LSP is probably a good idea. Figure out why you care about flight and make all your objects consistent with that view of the world. Trying to model reality in an unsuitable medium like a programming language can get very frustrating. Perhaps the brain is the complexity needed.

You should let the problem you are trying to solve guide what things mean. Leave the platonic realms for philosophers.

comment[]

7:59:28 PM    



Click here to visit the Radio UserLand website. © Copyright 2002 todd hoff.
Last update: 10/19/02; 8:03:34 PM.
October 2002
Sun Mon Tue Wed Thu Fri Sat
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31    
Sep   Nov