Python Forum
[PyQt] Managing variables accross a multiple module GUI
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] Managing variables accross a multiple module GUI
#13
global variables, whether safe or not (not everyone can make them safe), just aren't needed in a good design. but few of us have time to make everything we do be 100% a good design. we take shortcuts and those bad design often end up with global variables and other things like gotos (if using a language with such things). i spent years programming in assembly (on mainframes) and got to gradually learn better design through the experience of so many mistakes. but, newbies don't have that experience, yet. when i say i disagree, it's about me and the possibility to actually do the elements of a bad design, safely. what i end up with, as a design, is probably well described more as a fractal with smaller and smaller pieces of decent design all mushed (wow, the spell checker thinks that's a real word) together.

i'm not so sure about programming objects. the object has a state and needs to be manipulated. but extra objects found in a global reference are the things we do not have in a good design. whenever different objects need to communicate, maybe it is that class is what has the bad design and bad implementation. but if its API is good, that can shield us until we get a better one.

i'd say we disagree about the rarity. i'd say globals are never needed. but that is the ideal if we have enough time to be sure everything is a good design. but, i also say that good design itself is what is rare. the more our experience, the better our designs, in a limited time. unfortunately, the nature of our humanity, and the resulting economy, limit our time way too much. that's when i end up taking shortcuts. i just try to make those up with components of good design as much as i can. that may mean a global object instead of a mess of random global variables. the inexperienced won't get to see that. sometimes, when guiding them, i want to not force them to jump too far off path, this time. it's better to guide them in ways they will actually do, getting them closer to a better design. with experience they will learn a good design and the advantages it brings. just not today.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: Managing variables accross a multiple module GUI - by Skaperen - Jul-08-2019, 11:07 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Tkinter] Defining a self made module's function to interact with the main .py variables? Gilush 9 4,479 Jun-08-2020, 09:08 AM
Last Post: Gilush

Forum Jump:

User Panel Messages

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