Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Interfaces
Message
From
03/02/2008 09:26:46
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
 
 
To
02/02/2008 20:27:59
General information
Forum:
ASP.NET
Category:
Other
Title:
Environment versions
Environment:
VB 8.0
Miscellaneous
Thread ID:
01288224
Message ID:
01288644
Views:
15
I understand your point about different versions of the same class for different clients. I think that is the example that has made the most sense to me. Thanks for the input!

>Maybe you've just never thought about the advantages of doing so. For example, one advantage would be you could create an array of objects of type whatever interface is required for the LoadById method. The fact that it's a customer, a product, etc. Doesn't matter, they all implement that iterface, so they can all be cast to that interface.
>
>You can then do a "For Each...." or some such loop, calling the LoadById method on all the objects you've put in the array. You don't care, nor need to know exactly what the object type is.
>
>Interfaces just allow for some standardized way of programming. I've worked on an old Foxpro system that had imports/exports for given clients. Each client maybe had some specific format requests, but the basics were the same, reading the data, writing the export, etc.
>
>The code for each client was written as if that type of procedure had never been done before. Makes for some very ugly code. And a pain for someone who didn't write the original code to figure out how the process works.
>
>>So it would be a good idea to implement an interface containing Load, Save, LoadByID, and methods like that?
>>
>>>Simplicity does not in and of itself mean that you shouldn't use interfaces.
>>>
>>>One reason to use interfaces is as you noted before to enforce contracts among classes. So that if they implement a certain behavior it will be done thru consistent method calls among all those classes.
>>>
>>>When you notice that a substantial number of your classes, even thou they might be totally unrelated, implement a similar feature, then an interface might be called for. So you, or anyone looking at your system, can be rest assured that the feature is called in a similar fashion in any new class that might get added.
>>>
>>>>>>>>I think the tread you were looking for is this one: Thread #1278205. Now, I am out of this thread <g>
>>>>>>>
>>>>>>>BTW, thanks for the link!

>>>>>>
>>>>>>That Thread got side-tracked a bit with the talk about "simulating mulitple inheritance", but there was still a lot of useful opinions.
>>>>>>
>>>>>>And the example that Bruce gave in *this* thread of how he's using Interfaces is an excellent example.
>>>>>>
>>>>>>If you're still having a hard time getting your head around it, ask a few more questions. We'll get you straightened out! <g>
>>>>>>
>>>>>>~~Bonnie
>>>>>
>>>>>Bonnie,
>>>>>I think the problem I am having is that I only design simple classes and I don't need the advance functionality that you guys seem to be doing. So I assume I shouldn't use an interface for every class?
>>>>>
>>>>>Thanks,
>>>>>Mike
Very fitting: http://xkcd.com/386/
Previous
Reply
Map
View

Click here to load this message in the networking platform