Python Forum
How do you (experienced) do it?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you (experienced) do it?
#1
Assume the program requires having:
... Task-1: One GUI window to do something.
... Task-2: A second GUI window to do something else.
... Task-3: Code to do something.

A. Would you open a new .py file for each task to get them working.  Then create a master .py file and import the three tasks as functions (or classes).

B. Or just open a master .py file and code tasks 1, 2 and 3?  Using functions or classes is not the real question.  Whether coding all in one .py file as task-1, then task-2, then task-3 is the question.

Being new to Python and coding my first program, I'm in the process of doing it as step-A above to make it easier (and less cluttered) to code each task separately.  But I'm wondering if experienced Python programmers do it as in Step-B.

So how do you do it?
Reply
#2
I would do it as step A, and maybe get even more detailed than that. Like write one piece of task 1, test it, write another piece of task 1, test that and any interaction with the first piece, rinse and repeat. If this is something serious, I will have separate .py files of test code for each task. Although if the GUIs for task 1 and task 2 are similar, I might write common code for the two tasks that each of them then import, or a parent class that both of them inherit from. A lot is going to depend on the actual tasks involved, and I would figure out the file structure while planning out the objects and functions and how they interact.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
(Mar-15-2017, 09:14 PM)ichabod801 Wrote: I would do it as step A, and maybe get even more detailed than that. Like write one piece of task 1, test it, write another piece of task 1, test that and any interaction with the first piece, rinse and repeat. If this is something serious, I will have separate .py files of test code for each task. Although if the GUIs for task 1 and task 2 are similar, I might write common code for the two tasks that each of them then import, or a parent class that both of them inherit from. A lot is going to depend on the actual tasks involved, and I would figure out the file structure while planning out the objects and functions and how they interact.

Hi ichabod801,

Thanks for sharing your insights for my question.  It's helpful to know how experienced Python programmers approach their coding.

Raptor88
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Anyone experienced with webkit2png? KipCarter 3 3,131 Mar-23-2020, 03:08 PM
Last Post: KipCarter
  Project Using Python, No Skill, Idea first = Need experienced to show me the path. nefajcito 3 3,974 Apr-22-2017, 09:11 AM
Last Post: nefajcito

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020