vendredi 30 mars 2018

Which design pattern a composed object just for proxy purposes relates?

I have my object D which encapsulates different structs(A,B,C in this example). D is mostly for being passed as an parameter to an object called "RealClientInterface". Because D composed of A,B,C which "RealClientInterface" needs to run its functions.

My question if D relates to a design pattern? If it does which design pattern(s) D relates in this case?

Is it a composer since it is being composed of A,B,C? Or it is proxy or builder? Since it is there just as an proxy the real read/write is being done by RealClientInterface?

I need this information for giving a good name to my class D and also documentation purposes.

struct A
{
    //Some data
};

struct B 
{
    //Some data
};

struct C 
{
    //Some data
};

struct D 
{
   A a;
   B b; 
   C c;
};

struct RealClientInterface
{
    void foo ( D& d )
    {
        //reads d.a and inserts d.b
    }

    void foo2 ( D& d )
    {
        //reads d.c and inserts d.b and d.c
    }

    // Many other functions
} ; 

Aucun commentaire:

Enregistrer un commentaire