[fpc-pascal] corba interfaces - is/as not working properly

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Wed Sep 28 23:44:31 CEST 2016


On 2016-09-28 20:40, Lars wrote:
> i.e. what's the basic point of using an interface compared to objects and
> inheritance and procedures? Where do they really shine?

Not to repeat tons of information already available on the Internet -
Google is your friend.

Objects, Inheritance and Interfaces all have their place, and for
different needs. I like the fact that I can explicitly make available an
API to use Objects, even if the objects are not directly related. I also
like the fact that with interfaces, I can make the implementation private.

I also like to use Interfaces to help with unit testing. Without
Interfaces I can only unit test public methods. I have to create a
"friend class" (aka a class hack) to unit test protected methods. With
Interfaces I don't need any "hacks" and can still unit test
functionality of a class even if that implementation is in the private
section of a class. I like to unit test code, but hate being forced to
make things Public just to unit test them.

Others like the fact that COM Interfaces are reference counted - they
sometimes come in handy, but do tend to complicate matters much more.

Regards,
  Graeme

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/

My public PGP key:  http://tinyurl.com/graeme-pgp



More information about the fpc-pascal mailing list