On 2017-09-02 09:38, Ryan Joseph wrote:
It separates the code (which is nice) but then gives you an annoying extra step of typing hook.XXX for every method.
I don't have that problem, and I use interfaces extensively. Like multi-threading, Interfaces are an advanced feature of the Object Pascal language. Unfortunately, many ways that it can be used incorrectly too.
When I use interfaces, I work with the object instance only via an Interface reference. The interface that represents the functionality I need. I also prefer not to use reference counting with interface, but I definitely see a use for reference counting - but again, never mix the two in the same application. I also use interface delegation, which reduces code a lot.
Probably the best example I can think of off the top of my head that shows Interface usage very well is a set of 8 articles (with code) implementing Model-View-Presenter (MVP). I don't know where I originally code the articles and code from, but I can email you [in private] what I have. She shows prenty of ways using interfaces.
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 _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal