>> Where's the advantage of a method pointer?

> Maybe Mr. Angus wasn't going here, but behind my
> concept was work I have done in C/C++ with arrays
> of function-through-pointer for varied functionality
> depending on context.

Yes. It was in order to provide much more dynamic variation in behaviour,
but also to have that dynamism encapsulated by the implementing class.

A class would implement an interface as usual, but could dynamically return
a different method implementation from a set of methods declared internally
without recourse to multiple interfaces or classes defined purely to
provide an alternative implementation of an internal method.

I can't see why we persist in putting up with the existing long-winded
approach of defining single method inner or anonymous classes just so that
we can select a method implementation dynamically.

Other languages provide support for this kind of behaviour, and I don't
believe it needs to break any OO principles if it is properly designed.


> This approach [anonymous classes] might do the job just as well.
> What say you, Danny Angus?

It works, obviously, but it contains more meaningless boilerplate code for
structure than significant code for behaviour.
Additionally if you have a number of less trivial methods implemented it
becomes very hard for a programmer to understand the context of the block
they are working in.

Is it not true that when writing this stuff both IDE's and people have
difficulty working out exactly which set of braces to close and when?



> > The main difference is that in the earlier piece of code methods are
wrapped
> > in inner classes, which amounts to about 30 additional characters you
have to
> > type: "class FooBar { ... } implements I" for each class, one
instantiation
> > for each class and a common interface.

Yeah, and my point is why do we have to put up with this...

d.


***************************************************************************
The information in this e-mail is confidential and for use by the addressee(s) only. 
If you are not the intended recipient (or responsible for delivery of the message to 
the intended recipient) please notify us immediately on 0141 306 2050 and delete the 
message from your computer. You may not copy or forward it or use or disclose its 
contents to any other person. As Internet communications are capable of data 
corruption Student Loans Company Limited does not accept any  responsibility for 
changes made to this message after it was sent. For this reason it may be 
inappropriate to rely on advice or opinions contained in an e-mail without obtaining 
written confirmation of it. Neither Student Loans Company Limited or the sender 
accepts any liability or responsibility for viruses as it is your responsibility to 
scan attachments (if any). Opinions and views expressed in this e-mail are those of 
the sender and may not reflect the opinions and views of The Student Loans Company 
Limited.

This footnote also confirms that this email message has been swept for the presence of 
computer viruses.

**************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to