Note that there are some explanatory texts on larger screens.

plurals
  1. POWhat Design Pattern Should I use to accomplish the task below
    primarykey
    data
    text
    <p>I need to be able to conditionally execute a method. I prefer not having a bunch of IF statements throughout my code for several reasons, the most notable is that at a certain point in the future the method will no longer be used.</p> <p>I am not sure of the best way to do this or what pattern(s) I should choose to accomplish this task.</p> <p>The application I refer to is an application that is going to replace a legacy system. The legacy code will be turned off and no longer used at some point. Once that point of time comes, I don't want to have to go back and change any code (if at all possible).</p> <p>The following is a fictious conceptual example in psuedo of what I mean:</p> <pre><code>NewSystemEmployee.Save(Employee e) if (Legacy System Is Running) { LegacySystemEmployee.Save(Employee e) } </code></pre> <p>The method <code>NewSystemEmployee.Save</code> always needs to execute. I only want to execute <code>LegacySystemEmployee.Save</code> as long as the Legacy system is running. Once the Legacy system is shutdown, I no longer want to execute <code>LegacySystemEmployee.Save</code></p> <p>Once the legacy system goes away, I don't know how I can accomplish what I want without:</p> <ol> <li>Creating an IF statement before I call <code>LegacySystemEmployee.Save</code> OR</li> <li>Removing every call to <code>LegacySystemEmployee.Save</code> method OR</li> <li>Changing <code>LegacySystemEmployee.Save</code> method so that it is a stub and nothing more</li> </ol> <p>I also have a requirement that the <code>NewSystemEmployee</code> class does not refer in any way to the <code>LegacySystemEmployee</code> class.</p> <p>Any suggestions?</p> <p>Thanks so much </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. 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