Hi ultramailman,
Sorry for the delayed response. Had a bit of a... "complication in life" last week. But if you still want my help the first code sample more resembles to your requirement than the second one. I'm not sure if your second option is fairly common in c programming but it seems it would look ugly scattered everywhere in your code. The second one more resembles an inheritance than a composition of MVC. Let me know if you need further clarification.
Hello Brent,
The second code segment is just a dirty way to access the other parts, no inheritence was intended.
Better example to replace the mess that was the previous example:
struct model{
struct controller * c
struct view * v;
};
struct controller{
struct model * m;
struct view * v;
};
struct view{
struct model * m;
struct controller * c;
};
Here, I can easily access the model from the view, or the controller from the model, etc. Should easy communication like this be allowed in MVC, or is it better design to not allow them know about each other at all? Thanks