|
Interface Programming Author: Richard Grimes Introduction Europe is changing, some people think it is good, others would prefer that it would not happen. If I buy a newspaper in the UK I will pay in Sterling, if I buy a paper in the Irish Republic then I will pay in Punts, but if I go to Euroland (which means mainly France or Germany) I will pay in Euros. The point is I know from the country what currency I should use. That is a kind of contract; if I try to use pounds in the Netherlands then I will not be able to buy anything. What if I try to use Francs in France? Well, I will be able to use them, because while Euroland is being constructed there is essentially a dual currency system in operation, both currencies are supported. However, at some point the Euro will be the only currency, and at that time Francs and Deutchmarks will no longer be accepted. How does this fit in with COM interfaces? An interface is a contract. When a component says that it supports an interface it means that it agrees to every part of the interface - it is an all or nothing affair. That component may agree to support an older contract if it wishes to - just like France and Germany do now with their currencies - but the component, of course prefers the newer interface. When does an interface become a 'new' interface? When you do anything to an existing interface (add a new method, change the parameters on a method, change a method name - anything) that interface is now a new interface and so should have a new IID. Its just like going into any town in the UK and saying "the currency has changed, but only a little, we have kept the P, U, N of pound, got rid of the O and D and added a T". Now that means a new currency, the punt, which is a fine currency in itself, but it is not the currency that most people in that town would expect to use. You cannot change a currency and say that it is the same as before, and equally so you cannot change an interface and say it is the same interface. Mail a question to the author!! As part of the IDevResource commitment to Open Publishing, all of our authors are available to answer all of your trickiest questions at Author Central. For information about the authors, or to mail a question, visit them at Author Central. Did you like this article? If you liked this article, tell us about it. You can email your remarks to us at [email protected] Want to read more articles by this author? Try these: Byte size articles: ATL Server By Richard Grimes, 220200 COM and Apartments By Richard Grimes, January 7th 2000 An Introduction to WTL By Richard Grimes, January 7th 2000 An Introduction to Interface Programming By Richard Grimes, January 7th 2000 Full size articles: What is Async COM? By Richard Grimes. Microsoft Transaction Server By Richard Grimes, December 9th 1999 What COM is all about By Richard Grimes, December 6th 1999 Further Reading:
More ByteSize articles: 'ILoveYou' By Richard Grimes, 200500 COM+ 2.0 - First Announcement of Microsoft's New Technology By Richard Grimes, 100500 How to use DDX with WTL? By Girish Bharadwaj, 270300 ATL Server By Richard Grimes, 220200 COM Threading Models By Gopalan Suresh Raj, 070200 ActiveX & COM By Gopalan Suresh Raj, 270100 Type Library Info, XML and a bit of XSL for fun! by Richard Anderson 121199 COM and Apartments By Richard Grimes, 070100 What is WTL? By Richard Grimes, 070100 An Introduction to Interface Programming By Richard Grimes, 070100 Some links on COM:
Author Bio: Author: Richard Grimes Richard Grimes started programming aeons ago on 8-bit computers and hasn't looked back since. He has spent an interesting time as a research scientist (the little known "Grimes Effect" is his creation), underpaid time as a computer trainer and done time as a distributed object developer. ATL took hold of Richard while he was part of a team developing a COM-based workflow system and its elegance and simplicity has had a lasting effect on him. Although his is not an obsessively pure COM existence, he finds that an ATL-assisted COM lifestyle gives him more time to enjoy his garden. Go to Richards pages in Author Central. Contribute to IDR: To contribute an article to IDR, a click here.
|
|