Jon Israelson's Blog









Subscribe to "Jon Israelson's Blog" 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.
 

 

Sunday, May 18, 2003
 

Glenn Vanderburg has 3 nice pieces on static vs. dynamic typing.  They are here, here, and here.

[Tom Pierce's Blog]

I especially like this from part 3:

Dave Thomas said, at one point, "Java and C++ have equated an object's type with it class, and that's wrong. The type of an object isn't its class; it's what the object can do."

This is very much in line with my notion that in OO programming, you should not have care what types of objects you are dealing with.  The thing that matters is what messages does an object understand (what the object can do). 

Say you have a method that queries another object for some piece of information.  Do you really care what type that other object is?  All you want is for the object to give you the correct information when you ask it a certain question (send a message, call a method).  Static typing attempts* to ensure at compile time that the receiving object will understand the question at the cost of locking you into dealing with an object of a certain type.  Dynamic typing avoids this rigidity at the risk of you finding out that there is a communication problem at runtime.  You can avoid the dynamic typing risks through proper testing, but there seems to be no clean way to get around the rigidity that static typing causes.

*What happens when you have to use type casting, such as when pulling an object out of a Java collection?  Better hope that you're casting to the correct type.


9:33:21 PM    


Click here to visit the Radio UserLand website. © Copyright 2004 Jon Israelson.
Last update: 3/17/04; 2:54:01 PM.
This theme is based on the SoundWaves (blue) Manila theme.
May 2003
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
Apr   Jun