Hello.

There was an idea to address the problem of finding design patterns in the source code written in C #. Actually, after studying this area and everything that I have to face, I identified 3 levels of pattern implementation:

  1. "general implementation", when the programmer himself creates classes, objects, defines the inheritance hierarchy, relations between objects, etc. That is, in fact, implements the pattern from scratch. The search for such patterns will be organized taking into account possible options for their implementation.

  2. Deeply integrated into .NET patterns, for example, it is not a secret that Observer in .NET implements events and delegates.

  3. using classes from BCL. For example, to implement the "Prototype", you can implement the IClonable interface. To implement Iterator, you need to implement the IEnumerable and IEnumerator interfaces, etc.

The question is, is it enough to take into account these three levels of implementation of design patterns to organize their successful search, or do you need to take into account any other possible options? Thank you in advance.

  • 2
    I think your task, if you solve it for real, is on the verge of artificial intelligence. The same iterator can be implemented without IEnumerable, manually. How do you distinguish a unary operator from a cloning implementation? Are you going to analyze the source code? Then you have to solve, for example, the problem of stopping . - VladD
  • The problem is to write, for example, a neural network in that a large sample of examples and counterexamples is needed and it will be problematic to create about 1000 different implementations for each pattern ... These are 23000 source codes (if you implement the search for 23 GOF templates) ... And you can use a unary operator more in detail?) - PashaKrizskiy
  • Well, the neutron network will give an approximate, not an exact result. You definitely do not need? And a unary operator (for example, a minus) is no different from a cloning operation by signature. Both there and there class C { public CF() { ... } } . - VladD
  • Is this when operators are overloaded? Well, then it's easy to distinguish, in the overload the static method should be used - PashaKrizskiy
  • is this why it should be used by static meotd? - Grundy

0