Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>At first glance this calls for the <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">Strategy pattern</a> (or in fact <a href="http://en.wikipedia.org/wiki/Template_method_pattern" rel="nofollow noreferrer">Template Method</a>), possibly with a <a href="http://en.wikipedia.org/wiki/Factory_method_pattern" rel="nofollow noreferrer">Factory Method</a> to control which strategy to use. Example (in pseudo-Java):</p> <pre><code>class Saver { protected void LegacySave(Employee e) {} public final void Save(Employee e) { NewSystemEmployee.Save(e); LegacySave(e); } } class LegacySaver extends Saver { protected void LegacySave(Employee e) { LegacySystemEmployee.Save(e); } } </code></pre> <p>Since at some point in time you will no more need the legacy call, it makes sense to implement the default <code>LegacySave</code> as empty. Then you can trivially use the class like this:</p> <pre><code>getSaver().save(employee); </code></pre> <p>where <code>getSaver()</code> is the factory method which silently decides which <code>Saver</code> implementation to present to its caller. Trivially it can get the class name from a config file.</p> <p>Question is, how do you need to change the behaviour: runtime, or by restarting the application? If you can restart the application, it is easy to change that one line in the configuration which controls the strategy to use. Changing behaviour on-the-fly is slightly more tricky, but doable.</p> <p>A lot depends on what programming language you use. E.g. in Java / C++ / C# you can easily accomplish what you want with <a href="http://en.wikipedia.org/wiki/Dependency_injection" rel="nofollow noreferrer">dependency injection</a>; in some other languages it might not be that easy.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload