CompuServe Messages

AM TCL Lists

    21-Jul-93 13:19:50
Sb: #7239-AM TCL Lists
Fm: Rich Parker 76556,1132
To: Burt Johnson 76304,3574
Burt, You're welcome…and I appreciate your suggestion regarding the index. If I get a chance to revise the book I'll try to do a more comprehensive job. Actually, it's not the transition from C to C++ that seems so difficult, I think it's the transition from procedural to object-oriented design that causes the most problems. One currently popular model for application structure is the "client/server" model. If you look at the CMyData class in your application as the "server" for all of the other modules (because it is a direct descendent of the CDataFile and CFile classes and does all of the I/O), then it might make sense to you for that instance to own all of your data and provide it, upon request, to other modules in the application (which, of course, would be its clients). Getting past that one hurdle seems to help in making the breakthrough to OO design. In my book, you'll see that because the text window contains an instance of CEditText (which actually uses the Mac's TextEdit features), I'm forced to let the window own that data. It's stored in a TE Handle; However, I get the handle back whenever I need to do any I/O with the data. In all other respects, the CEnsembleData class "owns" the data (e.g., for the spreadsheet row and column styles, as well as the spreadsheet data itself). Other modules access that data through the auspices of the CEnsembleData module. In some cases, I have allowed the data handles to be public, and have passed them, explicitly, to other modules (e.g., CList15), so that the data could be more readily accessed; however, in retrospect, I probably should have provided access methods in the CEnsembleData class so that the requested data could be returned, which would have better "encapsulated" that data. Once you get the "hang" of OO design, I don't think the transition to C++ will be that great…at least I haven't found it to be so. Best of luck, -rich-