Advertisement
Guest User

Untitled

a guest
Oct 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. public interface IFunctionality1
  2. {
  3. void DoStuff(IReadOnlyList<Person> persons, IReadOnlyList<Case> cases);
  4. }
  5.  
  6. public interface IFunctionality2
  7. {
  8. void DoMoreStuff(IReadOnlyList<Person> persons, IReadOnlyList<Case> cases);
  9. }
  10.  
  11. public class ActualFunctionality1 : IFunctionality1
  12. {
  13. public void DoStuff(IReadOnlyList<Person> persons, IReadOnlyList<Case> cases)
  14. {
  15. //code block for the first functionality should have been moved here
  16. }
  17. }
  18.  
  19. public class ActualFunctionality2 : IFunctionality2
  20. {
  21. public void DoStuff(IReadOnlyList<Person> persons, IReadOnlyList<Case> cases)
  22. {
  23. //code block for the second functionality should have been moved here
  24. }
  25. }
  26.  
  27. //common variables used accross all functionalities
  28. var functionality1 = ObjectFactory.GetInstance<IFunctionality1>();
  29. var functionality2 = ObjectFactory.GetInstance<IFunctionality2>();
  30.  
  31. var persons = personsRepo.GetPersons(filterParameters);
  32. var cases = casesRepo.GetCases();
  33.  
  34.  
  35. //call the component for the first functionality here
  36. //the actual code for it is not found here, changes to that code have fewer chances to affect anything else because it is separate
  37. functionality1(persons, cases)
  38.  
  39. //call the component for the second functionality here
  40. functionality2(persons, cases)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement