C# Strategy Design Pattern by Delegate vs OOP

后端 未结 5 1385
悲哀的现实
悲哀的现实 2020-12-23 15:07

I wonder what\'s the pros/cons of using delegate vs OOP when implementing strategy design pattern?

Which one do you recommend to use? or what kind of problem does de

5条回答
  •  無奈伤痛
    2020-12-23 15:20

    According to this Pluralsight blog post:

    The primary difference between Delegates and Interfaces is that while delegates reduce the code base and increase readability of code, you have to be careful on how you use them otherwise you might end up sacrificing testability. Coding to interfaces is usually more reliable, even if it requires more code

提交回复
热议问题