OOD Question: Data / GUI boundary
-
Hello, I'm writing a program that displays a list of tasks on a CListView report. The report view will have varying text color/font & item background colors depending on the context of each specific task (list item). Where should I put the functions to determine these GUI parameters? In the document class or the CListView derived class? Should the document have functions that return the color of each specific list item? Or should the ListView make the determination based on gathering information about the Document tasks/items? I suppose I could throw out the idea of modularity and just treat the GUI and the document as mutually dependent, but I believe that this would be poor design. Does anyone have any pertinent wisdom about how to lay this out? thanks! JennyP
-
Hello, I'm writing a program that displays a list of tasks on a CListView report. The report view will have varying text color/font & item background colors depending on the context of each specific task (list item). Where should I put the functions to determine these GUI parameters? In the document class or the CListView derived class? Should the document have functions that return the color of each specific list item? Or should the ListView make the determination based on gathering information about the Document tasks/items? I suppose I could throw out the idea of modularity and just treat the GUI and the document as mutually dependent, but I believe that this would be poor design. Does anyone have any pertinent wisdom about how to lay this out? thanks! JennyP
I would place the functions in the listview class since they alter listview behavior. If you place them in the document, you'll have to redesign (or replicate code) if you find you need additional document types in the future. Even if you don't need additional documents, you're more likely to find listview code samples on CodeProject, and that may save you some coding time.