I'm coding an editor for graphs (Graph Theory).Let's imagine vertex needs these properites :
class Vertex{
int ID {get;}
Color color {get; set;}
Point point{get; set;}
}
But it's violating of SRP(single responsibility principle). So I created somethink like :
class Vertex{
int ID {get;}
}
class Positions{
private Dict<Vertex,Point> _pos;
setPosition(Vertex v, Point pos);
Point getPosition(Vertex v);
}
//etc.
Right?
But ViewModel for vertex needs, all of these properties to be displayed.
class VertexVM
{
Vertex _v;
Positions _positions;
//...
Point position
{
get {return _positions.getPosition(_v); }
}
// same for color etc
}
Is it violationg of SRP? (In my opinion, it is.) Is there any way how to avoid it? Thanks.