Стоит ли его применять или он вреден и только плодит кучу методов которые ничего не делают.
Если стОит — что с ним делать в случае такой структуры данных
namespace detail {
struct A
{
void met1();
...
void met5();
void rename(string newName);
}
struct B
{
int u;
int v;
vector<A*> listOfA;
};
struct C
{
void set_name(string value);
string get_name();
string name;
vector<B> listOfB;
};
} // namespace detail
class Registry
{
public:
C& current() { return listOfC[currentIdx]; }
int currentIdx() { return currentIdx; }
???
private:
vector<C> listOfC;
int currentIdx;
}
допустим надо визуализировать эту структуру в GUI, в каком-нить TreeView и там ее редактировать
согласно закону Деметры надо в Registry вытащить все методы вплоть до A ?
void B::renameA(int idxA, string newName) { listOfA[idxA].met1(newName); }
void C::renameA(int idxB, int idxA, string newName) { listOfB[idxB].A_met1(idxA, newName); }
void Registry::renameA(int idxB, int idxA, string newName) { current().A_met1(idxB, idxA, newName); }