On 11/05/2019 19:59, Cranky Frankie wrote: > I'm a long time IT professional trying to teach myself object-oriented > programming. As such I want to build a traditional PC app using MVC (Model > - View - Controller) architecture.
One important thing to realoze about MVC is that there are very many interpretations of it. But the original, and purest in OOP terms, is the Smalltalk version which is all about building GUIs. > For the Model or persistence layer I want to use SQLite. Thats fine but I;d point out that in good OOP the model hould be more than persistence. The model is the core object including all the core behaviour of the application. That is to say the "business logic and behaviour" as opposed to things pertaining to the presentation and usability of the app. > For the View or GUI I want to use wxPython. And again the view should not be "the GUI" it should only be the display element of the model. The view is responsible for displaying an aspect of the model. And there may be several views of the same model. (For example thee may be a graphical view, a form view and a tabular view - with the latter technically being associated with the model class rather than any singular model instance) > For the Controller I want to of course use Python. I'm kind of assuming you'd use Python for all three. Of course if it was a web based app you may use HTML and Javacript for the view/controller part. But python would be a good choice for the model in all cases. > 1) For the IDE I'm most comfortable with Netbeans/Java, In that case use Netbeans. I use Netbeans myself when working with Java and have played with its Python implementation and its OK. Personally for serious Python work I just use vim and 3 consoles, but that's a matter of taste. but you should minimise the number of learning points and learning a new IDE while also learning OOP (and a GUI framework?) is just adding extra work. > 2) For wxPython I'm finding a lot of the documentation is outdated. One of the penalties of open source development is that the software moves faster than authors can keep up! > there a better grahpics framework at this point for a traditional desktop > app? I've used wxwidgets, Tkinter and played with Side/PyQt wxPython is powerful enough for ost things, has a good range of widgets and fits OOP well without forcing a particular MVC style on you. (that may not be a good thing depending on your views. Its certainly much less formulaic in its MVC approach that Java GUIs like Swing and FX where MVC is taken to mad extremes.) > 3) For the O-O part, I'm comfortable with Inheritance and Composition. Do I > need to worry about any of the more advanced design patterns? This app will > be for vehicle ownership - tracking maintenance, etc. Nothing fancy. Inheritance and composition are primarily implementation tricks. The core of OOP is identifying where the functionality sits. Which objects are responsible for which pieces of the jigsaw. The way functions are divided between object methods tends to be quite different to the way you'd do it in a procedural (or functional) approach. Look out for cases where you are trying to fetch data from another object to process it and stop. Ask whether the other object should be doing that bit of processing. Remember that objects do it to themselves. Coming from a Java background resist the urge to write getters and setters. You shouldn't need them most of the time. If other objects are getting and setting your internal data something is probably wrong with your design. > 4) I plan to write my Use Case in Libre Office Write. For the UML diagrams, > is there a simple app to handle that? I don't need it to generate code but > I'd like to have a nice class diagram if possible. I wouldn't worry about UML class diagrams overmuch, they are mainly useful when you get into big apps with dozens (or hundreds or thousands) of model classes. Most desktop apps based on Sqlite only have a dozen or less models and maybe 20-30 classes in total. You don't need UML for that, only CRC cards - which can be in a spreadsheet. If you really want to draw UML Powerpoint will work just fine for starters. A full blown Case tool only pays dividends when you need to make classes available o other projects for reuse or want the tool to identify gaps and inconsistencies in class/method definitions. If you still want to go down the CASE tool route there are add-ons for Eclipse and visual Studio and I suspect for Netbeans too. Google is your friend. > 5) I'm really having trouble envisioning the GUI screens. How does one get > a handle on that? Just draw the screens on paper, or what? Personally that's what I do, keeping them deliberately vague. Whats much more important is getting your wire-frames joined together to show the workflow across windows (the UX design). A state chart can often be useful here too. Managing that workflow/state is what your controllers should be doing. No business logic but all the user flows and GUI rules. The controllers control the usecases not the models. (Jacobsen suggested one controller per usecase, I don't like to be that prescriptive but certainly there should be fewer controllers than there are views and models) > Any ideas very much appreciated. HTH. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor