Re: OO Concept: Liskov Substitution Principle
- From: Lew <conrad@xxxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 30 May 2008 19:18:46 -0400
Joshua Cranmer wrote:
The problem with compatibility is that SquareMatrix assumes that its two dimensions are equal; since these dimensions can only be affected at initialization, thereby rendering this contractual incompatibility moot.
That is not a contractual matter but an implementation matter.
However, in the end, we decide that requiring a separate SquareMatrix class is pointless since a 3x2 matrix multiplied by a 2x3 matrix is a square matrix even if its type is merely a banal Matrix, rendering the entire discussion moot.
The requirement that a SquareMatrix have the same width and height is not a contract issue, since none of the methods or constructors have to make that an externally visible invariant. One could treat a SquareMatrix as a normal Matrix and let it handle its own Squareness in an encapsulated way.
--
Lew
.
- References:
- OO Concept: Liskov Substitution Principle
- From: howa
- Re: OO Concept: Liskov Substitution Principle
- From: Joshua Cranmer
- OO Concept: Liskov Substitution Principle
- Prev by Date: Re: Using POST to send bitmap image with Java
- Next by Date: Re: gui builder
- Previous by thread: Re: OO Concept: Liskov Substitution Principle
- Next by thread: Re: OO Concept: Liskov Substitution Principle
- Index(es):