vendredi 19 août 2016

Self-Referencing CTror. Does this pattern smell?

I'm doing a code review for a senior developer and they've implemented quite a curious design pattern.

public class A : ABase
{
    private ABase aBase { get; }
    public A(A a)
    {
        aBase = a;
    }
    public A () {}
    //loads of stuff depending on aBase being initialised
}

The A() ctor is used throughout, then the constructed object is passed back into the A(A) ctor....

My question: Is this a legitimate design pattern? And if not, how does a junior developer approach a senior developer doing something crazy to the code base.

Aucun commentaire:

Enregistrer un commentaire