[Dune] [#588] Remove Barton-Nackman-trick from dune-localfunctions

Dune dune at dune-project.org
Wed Aug 26 09:28:26 CEST 2009


THIS IS AN AUTOMATED MESSAGE, DO NOT REPLY.

The following task has a new comment added:

FS#588 - Remove Barton-Nackman-trick from dune-localfunctions
User who did this - Martin Nolte (nolte)

----------
The only disadvantage of the Barton-Nackman trick (that I am aware of) is that the interface class is rarely used. On the other hand we could use an engine concept, as is widely done in dune-grid. The disadvantages of this concept are:
- They must be copy constructed (and that constructor is usually protected in dune-grid), i.e., copy the object must be possible.
- Getting a reference to the real implementation or even its type is quite hard (at least in dune-grid).
- Exporting special methods that are only provided by your implementation to the user requires a reference to the real implementation (see above).

In case your problem with the Barton-Nackman trick is checking whether a method is implemented, there is a trick around this: Use a three class hierarchy: Interface -> Intermediate -> Implementation. The interface and the implementation are just what they are now. The intermediate class just redeclares all interface methods private (without implementation). This way, the interface can only call them on the implementation, if they were overwritten as public methods.
----------

More information can be found at the following URL:
http://www.dune-project.org/flyspray/index.php?do=details&task_id=588#comment1020

You are receiving this message because you have requested it from the Flyspray bugtracking system.  If you did not expect this message or don't want to receive mails in future, you can change your notification settings at the URL shown above.




More information about the Dune mailing list