DNApy icon indicating copy to clipboard operation
DNApy copied to clipboard

variable/object to store global state of the software

Open openpaul opened this issue 8 years ago • 1 comments

So, I will try to explain what I mean with that title. In DNApy the genbank-data is saved in the genbank.gb class. All modifications are directly written to this object and can be exported to a file.

Settings for DNApy are stored in a text-file and loaded into a global variable called settings. Moreover some Classes have some settings in their init-method.

Selected enzymes or other changes of settings are not handled consistent yet. I think it would be good practice to have some central setting-object that has the ability to bind listener to it to trigger some updates whenever a certain setting changes. This would enable selective updates of the GUI, allow more easy implementation of new features and prevent fragmentation of different storing and update mechanisms.

Some researching brought the therm observer patterns (https://en.wikipedia.org/wiki/Observer_pattern) to my attention as well as properties (https://docs.python.org/2/library/functions.html#property). I don't know which way would be the way to go. Maybe you've got some more ideas?

What do you think about this?

openpaul avatar Aug 20 '15 19:08 openpaul

I think you are exactly right about the fragmentation of settings being a problem. It's been bugging me for a while too. I've been meaning to put some time into it and fix that problem, remove some bugs, clean up the code and make everything more consistent too. But there always seems other fires that I have to put out in the "real world".

mengqvist avatar Nov 06 '15 21:11 mengqvist