473,387 Members | 1,362 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What is "implementation code"?

Hello, I'm a beginner with what appears to be a simple question for
which I haven't been able to get an answer. Can someone explain what
"implementation code" is in relation to VB.NET? I want to be sure I
have a good understanding of this before I continue with my studies.
Thanks in advance.

Semper Fi
Nov 20 '05 #1
1 10395
Without knowing in what context you read it I'll take a stab and suggest
that it refers to the code used to implement an interface.

Just to give you a little bit of grounding on the subject, a class is
characterized by its public methods and properties. When you write code
that accesses a class through its methods the compiler uses the class name
and method name along with the number and type of parameters to decide how
to call the code inside the class. It is possible for two classes, having
different names, to have common method names. For example class A might
have a method called foo and class B. might also have a method similarly
called foo.

public class A
public sub foo()
'do stuff
end sub
end class

public class B
public sub foo()
'do different stuff
end sub
end class

In this case it is possible to call a.foo or b.foo but notice that in both
of these cases the class name and the method name go together to make a
unique calling address for the compiler and so in reality the two methods
even though they have the same name have nothing whatsoever in common and
are not bound to behave in a similar manner.

In many cases however, it is desirable to create a method name that means
something, such as "draw" or "sort" and know that when the method is called
a certain behavior will be carried out. This is where interfaces come in
handy.

An interface is the declaration of a "public face" that can be, if you will,
stuck on to any number of classes so that all of those classes, regardless
of their other functional behaviors, will always support the properties and
methods defined in the interface. It's a kind of contract of behavior
between what might otherwise be wildly dissimilar classes.

public interface IFoo
sub foo()
end interface

Note how an interface declaration never has any real code in it. It just
declares the names, parameters and return types of each of the methods and
possibly the types and accesses of properties.

Now, it is possible to make any number of classes that "implement" this
interface and so the method name will maintain its meaning across all of the
classes that use it.

class A
implements IFoo

public sub foo() Implements IFoo.foo
'do stuff
end sub

end class

class B
implements IFoo

public sub foo() Implements IFoo.foo
'do stuff
end sub

end class

These new declarations may look very similar to the ones you saw earlier
however there is one important difference between them. It is possible now
to take either one of those classes and extract from it an IFoo interface
that is guaranteed to have the foo method in it and both of those classes
will be expected, by contract, to behave in a clearly defined manner.

dim x as IFoo

dim classa as A=new A()
dim classb as B=new B()

x=ctype(classa, IFoo)

x.foo()

x=ctype(classb, IFoo)

x.foo()

Note that a class which declares it implements an interface must provide
concrete implementations for all of the methods and properties the interface
describes. It is this code, designated "do stuff" in the example above that
is called "implementation code"

A classic example of an interface that you might use all of the time is the
ICollection Interface that is implemented by all of the collection classes
in .net. This interface allows any class to provide enumeration behavior
which is used extensively in data binding.
--

Bob Powell [MVP]
C#, System.Drawing

The November edition of Well Formed is now available.
Learn how to create Shell Extensions in managed code.
http://www.bobpowell.net/currentissue.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

Read my Blog at http://bobpowelldotnet.blogspot.com

"Mitan" <mi*******@comcast.net> wrote in message
news:2b**************************@posting.google.c om...
Hello, I'm a beginner with what appears to be a simple question for
which I haven't been able to get an answer. Can someone explain what
"implementation code" is in relation to VB.NET? I want to be sure I
have a good understanding of this before I continue with my studies.
Thanks in advance.

Semper Fi

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: lpe | last post by:
http://www.pycode.com I was kinda suprised when I could not find any good sites with 3rd party modules (other than the Vaults of Parnassus, where you must host files elsewhere), so I decided to...
6
by: wyhang | last post by:
I want a implementation just like the "join" in the unix shell, I googled the web and found nothing. Any suggestion will be highly appreciated, thank you~
5
by: apple | last post by:
UDBV8 fp 6a - AIX 5.1 We have scheduled cron jobs to do backups. Periodically and starting to occur more frequently, a backup fails with this error: SQL2072N Unable to bind the shared library...
0
by: Peter Insley via .NET 247 | last post by:
Hi, have been searching for an answer for this for quite a while,I would be greatfull for any help. We are developing a codebase that of components that we wouldlike to be able to write in MC++ or...
1
by: Phil Sandler | last post by:
Hello all, Thanks in advance for any help with this. I am trying to get sample code to run from Michael Russell's excellent article on removing whitespace:...
3
by: Bill J | last post by:
For a VB.NET 2003 standard Windows MDI application, is there a way of implementing the "What's This" functionality through the applications main Help menu? All forms in the application have a...
2
by: Praveen Chandra | last post by:
Hi, I am trying to build a static library, while building the library i am getting the following error: fatal error C1189: #error : "No sstream/strstream implementation" Following is the...
5
by: Nicolas Pontoizeau | last post by:
Hi, I am handling a mixed languages text file encoded in UTF-8. Theres is mainly French, English and Asian languages. I need to detect every asian characters in order to enclose it by a special...
1
by: webtourist | last post by:
Warning: New learner here Not sure what the term means "implementation of Python". So what exactly does it mean *"implementation of Python"* like cpython, Jython, IronPython ????? In terms of...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.