Hi I am working on a python app, an outliner(a window with a TreeCtrl on the left to select a document, and a RichTextBox at the right to edit the current doc).
I am familiarized with OOP concepts and terms but I lack practical experience , so any comment/tip/pointer to docs will be welcome. So far, I have created a separated class for each important element of my app - the main Frame (cFrmMain) - the TreeCtrl - the TextCtrl at the right - a cDocument class that contains the entire file with all docs and manages creation/deletion/saving to disk, etc - classes for the toolbar, the menubar, etc With this design, pretty much everything is encapsulated in it respective class. However, that means that the main program logic is in the Frame class. >From there, it instantiates the other classes and is responsable of the communication between them. For example, the user deletes a node on the Tree, this raises an event on cFrmMain (the main Frame class). In the event handler, cFrmMain notifies cDocument that a node (and the associated text) has been deleted so the master file is modified accordingly. The problem is, I have been implementing some funcionalities to test this design, I have less than a dozen operations implemented and cFrmMain has grown more than acceptable, starting to get confusing. This design feels "not quite right" to me, I've been considering allowing the different classes to know of the existence of each other and pass messages between them. I would lose encapsulation (I think), and I don't know if that would be (very) bad... and I'm not sure if with this design I will gain or lose clarity on the code. My questions ( at last :-) ) are: ¿Should I stick to my first design idea, eventually moving code from the main Frame to modules to gain clarity? ¿Is the second idea I present "correct" (I know it'll work, what I want to know is the clearest way of organize my code)? ¿Am I doing this wrong from the start and have to use another design? Thanks for reading this long post. Any comment, hint or pointer to docs will be greatly appreciated. Regards Adrián Garrido -- http://mail.python.org/mailman/listinfo/python-list