Hi all:
As we are discussing Type concepts and Scala, i thought it might
be a good idea to bring to attention a concept that is often
sort of overlooked by Java/C++ programmers ;-)
"client module code that uses a reference to base_type must
be able to use a reference to derived_type
without knowing the difference"
Stated formally,
"Let q(X) be a property provable about objects X of type T.
Then q(Y) should be true for objects Y of type S,
where S is a subtype of T"
The key idea here is "substitutability" !
Formally this concept is known as 'Liskov Substitution Principle'.
One may say, "ok so that is the theory, but how does it show up
in practice" ?
This issue shows up when we "override a method in derived class".
For the Java folks, here is the example code
http://doodleproject.sourceforge.net/articles/2000/liskovSubstitutionPrinciple.htmlFor the C++ folks, here is the example code
http://www.eventhelix.com/RealtimeMantra/Object_Oriented/liskov_substitution_principle.htm--
On another note, this simple yet powerful concept was invented
by Prof. Barbara Liskov.
She was the first US woman to earn a PhD from a CS Dept (1961).
She received the 2008 Turing Award from the ACM for her work
in the design of programming languages and software methodology
that led to the development of object-oriented programming.
Check out
http://web.mit.edu/newsoffice/2009/turing-liskov-0310.htmlthanks
Saifi.