Follow @RoyOsherove on Twitter

Strong Vs. Loose Typing/Loose binding

Ted Neward writes about the differences between Loose-Coupling, Loose-Typing, and Loose-Binding. Well, that's just the beginning. He starts off a discussion about which might be better for which tasks, the coding of GUI vs. Server code using Loose-typing vs. Strong-Typing, What was so great (and bad)about VB and how Ruby.Net fits in to all this.

Highly recommended.

As for me, I'll just say there's some cool stuff to be done using Loose-binding(not typing). in VB6, you had the object class, on which you could instantiate anything using CreateObject, and than just call any method you liked on that object. It didn't check in compile time whether this was legal or not, it just "assumed" whatever was in your object would support this functionality when the time comes.

This allowed me to do a very cool trick, where, by using the Word automation components, I would instantiate a "word.Application" object, and call methods on it via a loosly typed object. This approach allowed me to variating Office installations on the host computer(assuming they are >= Office 97). No need to reference a specific Word 9.0 or Word.80 build in my project.

Since I was doing on ly the simplest of thinsg using Word's Document object model, I could get away with the same operations being on done different Office versions, since they all had support(and backawrds compatibility support) for those operations.

Yes, Loose binding sure saved me a lot of coding time.

Microsoft Internet Controls Life Saver

Work, work, work....