0

I am writing a program using Python 3.6. The code reads words from a file, chooses random coordinates on a grid and places the words on it.

I have a single class instance that I use to create the plot. I can do the bulk of my code inside the main program using the class as a helper, or I can do the bulk of the code inside the class object itself. How does one determine which code should be in the main program and which should be inside the class object?

  • Please consider creating a [mcve] – Pitto Mar 26 '18 at 20:59
  • I am not certain how to provide an example because I am not experiencing a specific problem. I desire help in programming styles or proprieties when it comes to where the bulk of the load should be carried: the main program or the class object? Does it matter? Whatever is easiest? – long_time_newbie Mar 26 '18 at 21:05
  • It'll be easier to answer that questions for a specific problem than in general, so an example would good. Note that this might also be better suited for https://codereview.stackexchange.com – Daniel Lenz Mar 26 '18 at 21:17
  • Can you accomplish everything with module level functions and variables and do away with the class altogether? – wwii Mar 26 '18 at 21:59
  • Thank-you for that pointer to the discussion on using classes in Python. That helped me a lot. Can I write the program without a class? Yes, but it means carrying multiple arguments between functions. After reading the above, I believe I will tend to limit my class use to those variables that are much easier to keep together inside the class instance. Thank-you one and all. – long_time_newbie Mar 26 '18 at 22:59

0 Answers0