Re: [Tutor] Looking for some direction
On 13/05/19 10:56 AM, boB Stepp wrote: On Sun, May 12, 2019 at 5:19 PM boB Stepp wrote: On Sun, May 12, 2019 at 1:05 PM David L Neil wrote: I'm using Gnome Terminal under Fedora (Linux). This allows multiple terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it irritates me that whilst I can set "profiles" for particular purposes; there does not seem to be a way to save a 'session'. Thus each time Terminal re-starts, I have to re-build each terminal, manually. (suggestions of other similar tools would be most welcome) I may be mistaken, but I think that a terminal multiplexer like tmux (https://github.com/tmux/tmux/wiki) is capable of session management. I have no personal use of tmux, but have been intrigued enough about others referring to it that eventually I will get around to seriously checking it out. Actually, tmux is starting to look more and more interesting. David, I think you might this helpful. I am currently looking at an introduction to tmux by a Stack Overflow developer. This article is at https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/ (There was a link to this on the tmux wiki I sent out a link to earlier.) I think I may start playing around with this! Thanks Bob. Am taking it for a spin... -- Regards =dn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 18/05/19 4:15 AM, Alan Gauld via Tutor wrote: On 16/05/2019 04:17, Alex Kleider wrote: Alt-Tab and the X cut 'n paste mechanism provides enough integration between windows. I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and browser but I can't make it cycle from one terminal to another. How do you do that? Sorry I've been busy, my mother passed away early this morning and we've been with her the last few days. Sympathies! FWIW I just use Alt-Tab. I'm on Linux Mint with Cinnamon. Yes, and Ctrl-Tab to switch windows within an application (Cinnamon on Fedora) -- Regards =dn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 13/05/19 6:13 AM, Alan Gauld via Tutor wrote: On 12/05/2019 10:15, David L Neil wrote: Interestingly, I split these into two - my laziness for running/testing is 'Save, Alt-Tab, Up-arrow, Enter' which would be 'ruined' by using the cmdLN for anything else. In a bash shell I use Ctr-R (for reverse search) and hit py to run the last python command. So for me its Alt-Tab, Cmd-R, py 2 characters extra and I get to use the OS for whatever I like in between... :-) Good one! -- Regards =dn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On Fri, 17 May 2019 at 17:17, Alan Gauld via Tutor wrote: > > Sorry I've been busy, my mother passed away early this morning > and we've been with her the last few days. Really sorry to hear that Alan. I hope you're holding up okay. (Obviously don't feel the need to answer python-tutor questions here right now if you'd rather not...) All the best, Oscar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 16/05/2019 04:17, Alex Kleider wrote: >> Alt-Tab and the X cut 'n paste mechanism provides >> enough integration between windows. > > I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and > browser but I can't make it cycle from one terminal to another. How do > you do that? Sorry I've been busy, my mother passed away early this morning and we've been with her the last few days. FWIW I just use Alt-Tab. I'm on Linux Mint with Cinnamon. -- 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
Re: [Tutor] Looking for some direction
On 2019-05-16 03:35, Oscar Benjamin wrote: On Thu, 16 May 2019 at 04:30, Alex Kleider wrote: On 2019-05-12 00:59, Alan Gauld via Tutor wrote: > On 12/05/2019 00:24, David L Neil wrote: > > Alt-Tab and the X cut 'n paste mechanism provides > enough integration between windows. I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and browser but I can't make it cycle from one terminal to another. How do you do that? I don't have Ubuntu 18.04 here to test but from memory there is a setting (enabled by default) so that alt-tab switches between applications but to switch between windows within an application you can use alt-~ (That's alt with the tilde key: ~). It works! Thank you very much. a ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On Thu, 16 May 2019 at 04:30, Alex Kleider wrote: > > On 2019-05-12 00:59, Alan Gauld via Tutor wrote: > > On 12/05/2019 00:24, David L Neil wrote: > > > > Alt-Tab and the X cut 'n paste mechanism provides > > enough integration between windows. > > I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and > browser but I can't make it cycle from one terminal to another. How do > you do that? I don't have Ubuntu 18.04 here to test but from memory there is a setting (enabled by default) so that alt-tab switches between applications but to switch between windows within an application you can use alt-~ (That's alt with the tilde key: ~). That's assuming you have multiple terminal windows. If on the other hand you multiple terminal tabs within one window then you can use ctrl-pgup/pgdn or alt-1/2/3 to switch between tabs. -- Oscar ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 2019-05-12 00:59, Alan Gauld via Tutor wrote: On 12/05/2019 00:24, David L Neil wrote: "3 consoles": what is the purpose of each? (my first reaction stemmed from many editors including a built-in console) One for vim, One for the Python interpreter One for an OS shell used for running/testing the app plus any miscellaneous Unixy type things I need to do (sed/grep/awk/git etc). I'll usually also have a web browser for reading documentation if necessary, although that's mostly done in the interpreter using dir()/help(). Alt-Tab and the X cut 'n paste mechanism provides enough integration between windows. I tried this (Ubuntu 18.4) and Alt-Tab cycles between terminal and browser but I can't make it cycle from one terminal to another. How do you do that? Alex ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 12/05/2019 23:19, boB Stepp wrote: > I may be mistaken, but I think that a terminal multiplexer like tmux > (https://github.com/tmux/tmux/wiki) is capable of session management. > I have no personal use of tmux, but have been intrigued enough about > others referring to it that eventually I will get around to seriously > checking it out. Me too. its been on my "must check that out" list for years! But I really must -- 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
Re: [Tutor] Looking for some direction
On 12May2019 17:19, boB Stepp wrote: On Sun, May 12, 2019 at 1:05 PM David L Neil wrote: I'm using Gnome Terminal under Fedora (Linux). This allows multiple terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it irritates me that whilst I can set "profiles" for particular purposes; there does not seem to be a way to save a 'session'. Thus each time Terminal re-starts, I have to re-build each terminal, manually. (suggestions of other similar tools would be most welcome) I may be mistaken, but I think that a terminal multiplexer like tmux (https://github.com/tmux/tmux/wiki) is capable of session management. I have no personal use of tmux, but have been intrigued enough about others referring to it that eventually I will get around to seriously checking it out. Tmux is great, but I mostly use it for persistent sessions. It has facilities for running multiple panes in one terminal, which could be useful for remote sessions; locally I just use multiple panes in my terminal emulator, and in fact just multiple local panes connected to remote sessions anyway. I do use tmux panes in email though: I invoke mutt in a tmux session and replies start in a subpane, with mutt's index view in the upper (smaller) pane. But otherwise it is almost all persistent (and named) sessions. Now, I am spoilt: on a Mac I have access to iTerm3, which does: multiple tabs _and multiple panes and subpanes. My usual coding layout is a terminal in the left half of the screen running vim (with, usually, two _vim_ windows in it, vertically split). Often, that window gets a horizontal split, with a short and wide terminal pane below the editors, where I have a shell. The right hand half is antoher terminal, usually split intovarious panes, often 2 more evenly split. FOr shells and Python interpreters. But a really good terminal emulator is an outstanding tool. And iTerm3 seems to outshine everything else (Mac only alas - I'd like to find a food X11 equivalent - everything I've tried is deficient). Tabs and multiple panes is hugely flexible. It also has a toggle keystroke to expand a particular pane to the full window for when you want lots of text (diffs, commiting, etc). So unlike Alan, since it is all one Mac app (iTerm3), there's no Alt-TAB to switch apps, and since it does focus-follows-mouse cut/paste is very fast (iTerm3 has a mode like most X11 apps: select implicitly copies, so no Cmd-C copy keystroke for me either). Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On Sun, May 12, 2019 at 5:19 PM boB Stepp wrote: > > On Sun, May 12, 2019 at 1:05 PM David L Neil > wrote: > > > I'm using Gnome Terminal under Fedora (Linux). This allows multiple > > terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it > > irritates me that whilst I can set "profiles" for particular purposes; > > there does not seem to be a way to save a 'session'. Thus each time > > Terminal re-starts, I have to re-build each terminal, manually. > > > > (suggestions of other similar tools would be most welcome) > > I may be mistaken, but I think that a terminal multiplexer like tmux > (https://github.com/tmux/tmux/wiki) is capable of session management. > I have no personal use of tmux, but have been intrigued enough about > others referring to it that eventually I will get around to seriously > checking it out. Actually, tmux is starting to look more and more interesting. David, I think you might this helpful. I am currently looking at an introduction to tmux by a Stack Overflow developer. This article is at https://www.hamvocke.com/blog/a-quick-and-easy-guide-to-tmux/ (There was a link to this on the tmux wiki I sent out a link to earlier.) I think I may start playing around with this! -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On Sun, May 12, 2019 at 1:05 PM David L Neil wrote: > I'm using Gnome Terminal under Fedora (Linux). This allows multiple > terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it > irritates me that whilst I can set "profiles" for particular purposes; > there does not seem to be a way to save a 'session'. Thus each time > Terminal re-starts, I have to re-build each terminal, manually. > > (suggestions of other similar tools would be most welcome) I may be mistaken, but I think that a terminal multiplexer like tmux (https://github.com/tmux/tmux/wiki) is capable of session management. I have no personal use of tmux, but have been intrigued enough about others referring to it that eventually I will get around to seriously checking it out. -- boB ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 12/05/2019 10:15, David L Neil wrote: > Interestingly, I split these into two - my laziness for running/testing > is 'Save, Alt-Tab, Up-arrow, Enter' which would be 'ruined' by using the > cmdLN for anything else. In a bash shell I use Ctr-R (for reverse search) and hit py to run the last python command. So for me its Alt-Tab, Cmd-R, py 2 characters extra and I get to use the OS for whatever I like in between... :-) -- 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
Re: [Tutor] Looking for some direction
On 12/05/19 7:59 PM, Alan Gauld via Tutor wrote: On 12/05/2019 00:24, David L Neil wrote: "3 consoles": what is the purpose of each? (my first reaction stemmed from many editors including a built-in console) One for vim, yes - that 'replaces' the window/app running an IDE/GUI-based editor. * One for the Python interpreter * One for an OS shell used for running/testing the app plus any miscellaneous Unixy type things I need to do (sed/grep/awk/git etc). Interestingly, I split these into two - my laziness for running/testing is 'Save, Alt-Tab, Up-arrow, Enter' which would be 'ruined' by using the cmdLN for anything else. I might even 'raise' your bid, by adding a third terminal here - when needing to ssh into a VPS or other remote m/c. I'll usually also have a web browser for reading documentation if necessary, although that's mostly done in the interpreter using dir()/help(). +1 (to make it 'worse', I have two web browsers open - plain-Firefox for 'ordinary browsing' and the FF Development Edition for, well, development work. Yes, that habit probably came out of testing web stuff in multiple browsers, but now the DE is where I cruise the PSL docs, etc, as a de-facto separation-of-concerns in my mind. Alt-Tab and the X cut 'n paste mechanism provides enough integration between windows. Very handy! * > One for the Python interpreter * I also do this, all-the-time. My youngest/new grad colleague observing this last week, was most puzzled. He felt it was 'double-handling' because "most ideas could/should be hashed-out in TDD design" cf 'code experimentation'. Will be interesting to see if he takes-on the idea, or continues to tease 'the old boy'... (any comment if this is my failing to (fully) appreciate TDD philosophy?) I'm using Gnome Terminal under Fedora (Linux). This allows multiple terminals in tabs (and thus Ctrl-Tab rapid-switching). However, it irritates me that whilst I can set "profiles" for particular purposes; there does not seem to be a way to save a 'session'. Thus each time Terminal re-starts, I have to re-build each terminal, manually. (suggestions of other similar tools would be most welcome) I'm also conscious of advising the OP on IDEs/editors: in that I am currently using Sublime Text but find the "build" mechanism quite alien to Python (HTML, CSS, JS, etc - but not Rust!). Similarly, I need to learn more about using ST's built-in terminal (preferably at full-size rather than a few lines at the bottom of the editing window). That might cut-down on one concurrent terminal... (similarly, am open to suggestions for improving Python dev using ST) Thanks for your feedback! -- Regards =dn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
On 12/05/2019 00:24, David L Neil wrote: > "3 consoles": what is the purpose of each? > (my first reaction stemmed from many editors including a built-in console) One for vim, One for the Python interpreter One for an OS shell used for running/testing the app plus any miscellaneous Unixy type things I need to do (sed/grep/awk/git etc). I'll usually also have a web browser for reading documentation if necessary, although that's mostly done in the interpreter using dir()/help(). Alt-Tab and the X cut 'n paste mechanism provides enough integration between windows. -- 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
Re: [Tutor] Looking for some direction
On 12/05/19 10:57 AM, Alan Gauld via Tutor wrote: On 11/05/2019 19:59, Cranky Frankie wrote: ... 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. "3 consoles": what is the purpose of each? (my first reaction stemmed from many editors including a built-in console) -- Regards =dn ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
Hi, It seems you have a good overall idea on how you would tackle the project. First, have you talked to the people you are trying to build the application for, or are you the very people you're building this for? If you're building this for other people, try an figure out common scenarios on how they're doing things. As developers, jumping to code is tempting but I think it comes at an unnecessarily high price we pay later. Second, a document that explains what your application does in the present tense to show these people might come in handy based on your users telling you what they do daily. Written before code. "AutoAwesome allows you to track the vehicles in your fleet. You can easily [insert what the end users have described] in a list of features." That document will elicit reactions and feedback. Again, it's easy to have fantasies about how broken their workflow is and think we know better and we can just code away and build the perfect product that will inspire awe when finally revealed. I get the sense that you might be lucky enough to know exactly what the needs are, but in case it's not for you, talking to users is important. On 5/11/19 7:59 PM, Cranky Frankie wrote: For the Model or persistence layer I want to use SQLite. For the View or GUI I want to use wxPython. For the Controller I want to of course use Python. I'm also planning on using Git for source control. If you're using SQL, SQLAlchemy for the ORM (Object Relational Mapper) might be worth checking out. One benefit is allowing you to avoid writing raw, possibly unsafe queries. However, if you are comfortable writing SQL, then by all means just start and ship a first working version 0. A first working version in the hands of users will get you feedback on what really matters which neither you nor us can think of right now. One thing to do a bit later would be to decouple the persistence layer from your application. i.e: not make assumptions on which persistence technology you're using in your application. For example, in one project, we could save to a database or to Elastic interchangeably without the "application" changing because all the parts that are "specific" to the persistence technology used were contained in the appropriate, specific, module. Again, this all doesn't really matter right now. What matters is building an application in which you can go through one simple scenario from start to finish by the end the week.. 1) For the IDE I'm most comfortable with Netbeans/Java, but I'm forcing myself to try and get comfortable with PyCharm. Is it worth sticking it out with PyCharm, or should I go with the Python module in Netbeans? Or is there another IDE I should look at? I'd recommend to work with the IDE you're most comfortable with to produce the application. If you want to try another IDE, you can play with PyCharm when you're not working on your application. The goal here is to have a working product. Your users don't care which IDE you've developed the application with. Yes, tools are important up to the point where focusing on them prevents you from shipping the product you were trying to optimize the tools to ship in the first place. 2) For wxPython I'm finding a lot of the documentation is outdated. Is this book any good: http://www.blog.pythonlibrary.org/2019/05/08/creating-gui-applications-with-wxpython-now-available/ Or is there a better book/course/website I should be working with? Or is there a better grahpics framework at this point for a traditional desktop app? One thing to think about is having the core of your application decoupled from the technology you use for persistence, view, or other things. For example, if you have to create a user, format addresses, parse text, etc. You can have functions that do each part that are blind to whether you're using wxPython or PyQt and only understand text. You can then use these functions by importing them whether you're building a web application, a Terminal User Interface, or a desktop application since they don't make assumptions. In other words, having utility functions you can import from different parts of the projects, or from other projects, that you import is better than having say parsing done by a method in a wxPython widget. You can then concentrate on the functionality and not bother with the "viewing" technology by building a console application first. Show it to the users where they could simply input text and you could display the results on a terminal, *then*, worry about the specificity. Again, the goal is to have software that *does* something, then make it look good, unless the end state itself is looking good. 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. Not worrying, but keeping the goal
Re: [Tutor] Looking for some direction
On Sat, May 11, 2019 at 12:05 PM Cranky Frankie wrote: > 2) For wxPython I'm finding a lot of the documentation is outdated. I'm a fan of wxPython myself, for a number of reasons - it suits the way I think, and the applications it generates look native to the platform they're running on, as opposed to the way Java apps always seem look a little odd whether you run them on Windows or Mac. wxPython is a Python wrapper around the wxWidgets library (written in C, I believe); any time I've found the wxPython documentation lacking, the wxWidgets docs filled in the gaps. But the best documentation of all is the wxPython demo app; it contains working examples - with modifiable source code - for nearly every wxPython control, plus a few user-contributed extra controls. There's also an excellent mailing list (wxpython-us...@googlegroups.com) which is a great place to get help. The downsides: - there's no (working) WYSIWYG code generation tool - wxGlade is so bad it's worse than nothing - layout is controlled by sizers in a model that might be different from what you're used to; failure modes if/when you screw up are surprising and nonintuitive. (Not disastrous, just confusing.) Make sure to include the Layout Inspection Tool while you're codebashing, and comment it out for production! Welcome to Python (and wxPython, I hope) - enjoy! ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
Cranky, It is a little difficult to answer your question. First impression is that your experience gives you good ideas of how to solve the problem. Some of them may not suit the Python environment as well as (say) that of PHP/MSFT. So, a learning opportunity there too. Second impression is that there are a lot of moving parts. How many of them do you know well, and how many are learning-targets? Trying to tackle 'too much' that is 'new' may result in heavy frustration. (no mention of skill-levels, so 'just sayin') The web-ref is not a book, but a *simple* article. It will serve, as long as you stick within the narrow scope of that article. The instant you deviate or customise, you're 'on your own'. For this reason, my recommendation is always a (proper/full) book*, if at all possible. You speak of MVC, so one (of many) Python web framework is Mig Grinberg's "Flask". Apart from his own, there are several other books which cover this subject. Following such a text will enable you to start-out on 'toy examples' and then gather expertise. Likely, you will re-shape this project whilst learning. * I used the term "book" but the last person to whom I recommended such couldn't afford the cost, and these days there are many excellent on-line and equally structured alternatives, eg Python courses on Coursera.org and edX.org (both 'freemium' offerings) - IIRC(?) Flask is available on Lynda (LinkedIN). That said, let's try responding to each of your points:- On 12/05/19 6:59 AM, 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. Just want to make sure I'm heading about this in the best way so I'm looking for some direction. For the Model or persistence layer I want to use SQLite. For the View or GUI I want to use wxPython. For the Controller I want to of course use Python. I'm also planning on using Git for source control. 1) For the IDE I'm most comfortable with Netbeans/Java, but I'm forcing myself to try and get comfortable with PyCharm. Is it worth sticking it out with PyCharm, or should I go with the Python module in Netbeans? Or is there another IDE I should look at? To my observation an IDE is less important in Python (than for highly structured, strongly typed, compiled, ... languages). My advice is, once you've chosen and found that it works, do NOT switch editor/IDE in anything less than one year. Under the 80-20 'rule', we use a basic few editing 'features' to do most of our work. Thus, it stands to reason that it will take periods of 'real time' before you decide 'there must be an easier way' to achieve some functionality and go looking in the editor's menus/help/etc to see if/what it might be! The other aspect is that 'religious wars' are fought over "which is the best editor/IDE" style questions. If you believe 'everyone' you'll 'jump' so often that you'll never figure-out 'which'. So, given that PyCharm is purpose-built, has a good reputation, and you have already used it: "if it ain't broke, why fix it"? (NB I don't use it, but have in the past) 2) For wxPython I'm finding a lot of the documentation is outdated. Is this book any good: http://www.blog.pythonlibrary.org/2019/05/08/creating-gui-applications-with-wxpython-now-available/ Or is there a better book/course/website I should be working with? Or is there a better grahpics framework at this point for a traditional desktop app? - attempted to tackle in 'strategy' comments, above 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. At risk of creating a dichotomy, whilst there are books which attempt to 'translate' the original gang-of-four patterns (and more) into 'Python', none has really impressed. "Pythonista" talk of "pythonic" solutions. Personal observations when learning Python (as if I'm not still...) included the need to desist from trying to solve a problem in xyz-other-language and 'translate' that to Python, but to learn how Python's construction enables its own solution-approach - sometimes quite distinctive. My favorite simple example of this is that many other languages offer do/for-loops. However Python's construct should be called for-each because it does not manage an index, eg loop-around doing something with array[index]; but instead/additionally "iterates" over a "collection", eg for item in list: ... Which also disposes of the need to learn the GoF iterator pattern as a "pattern" - but does not excuse you from understanding the "idiom". Once again, such are best (IMHO) learned from the cohesive and comprehensive coverage of a decent Python book*, cf numerous and unrelated web/blog/etc entries. 4) I plan to write my Use Case in Libre
Re: [Tutor] Looking for some direction
On 11May2019 14: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. Just want to make sure I'm heading about this in the best way so I'm looking for some direction. For the Model or persistence layer I want to use SQLite. That's reasonable. I'm trusting you're aware of SQL injection issues and will be constructing your SQL with '?' parameter placeholders to avoid this? For the View or GUI I want to use wxPython. For the Controller I want to of course use Python. I'm also planning on using Git for source control. All reasonable. 1) For the IDE I'm most comfortable with Netbeans/Java, but I'm forcing myself to try and get comfortable with PyCharm. Is it worth sticking it out with PyCharm, or should I go with the Python module in Netbeans? Or is there another IDE I should look at? I haven't an opinion about IDEs except that unless the IDE doesn't work with Python for whatever reason, there's no reason to switch IDEs unless you want to learn a specific new IDE. Several of us don't really use IDEs and just use editors and terminal windows, though that is less common in the Windows world. Just use what already works unless there's some feature elsewhere which you need. [...] 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. I wouldn't worry. Python mostly does inheritance; I suppose mixin classes (inherits) are like composition. The biggest change you'll find coming from Java is likely the typing: Python _values_ are strongly typed, but the variables are not - they can refer to a value of any type. And there aren't really Java interfaces. However, there are lint tools to look for issues like this. Oh yes: more than one class per Python source file - group them by package/module/topic. Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Looking for some direction
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