Oct-23-2017, 08:26 AM
Hi,
I'm self-teaching myself Python using examples and the excellent documentation. However, I'm stuck trying to understand classes. Do I need them? Can I structure the code with them? Do they introduce too much complexity? Do they apply to my project?
My project is a program that uses a single random seed to generate a made-up "record label", with multiple "artists", each with multiple "albums", each with multiple "tracks", which are generated CSound music code files. It also names the artists, albums, tracks and members of each band, and it generates artwork and album covers. As a side feature it generates a "Rock Family Tree" of the
(If anyone was interested in learning more about this project, PM me. I'd be glad of collaborators!)
There are functions that generate lists of words, functions that generate lists of note pitches, note lengths etc. A function iterates through the list of artists, another iterates through the list of albums for that artist etc etc.
I'm using PyCharm on Linux, which is a great powerful free IDE, with smart folding features. I'm using functions, and modules to break the functions into a separate file. The main file is still quite big, and I would like to be able to structure it to be able to navigate to bits of it easily.
Can anyone advise me of the best way to structure this project? Does it warrant classes? How would you go about structuring the nested functions of this project? Is there any way to flatten what might be too much nesting?
Any advice greatly appreciated. I can post code later from home if necessary.
Best regards,
Matthew Petty
Dubai
I'm self-teaching myself Python using examples and the excellent documentation. However, I'm stuck trying to understand classes. Do I need them? Can I structure the code with them? Do they introduce too much complexity? Do they apply to my project?
My project is a program that uses a single random seed to generate a made-up "record label", with multiple "artists", each with multiple "albums", each with multiple "tracks", which are generated CSound music code files. It also names the artists, albums, tracks and members of each band, and it generates artwork and album covers. As a side feature it generates a "Rock Family Tree" of the
(If anyone was interested in learning more about this project, PM me. I'd be glad of collaborators!)
There are functions that generate lists of words, functions that generate lists of note pitches, note lengths etc. A function iterates through the list of artists, another iterates through the list of albums for that artist etc etc.
I'm using PyCharm on Linux, which is a great powerful free IDE, with smart folding features. I'm using functions, and modules to break the functions into a separate file. The main file is still quite big, and I would like to be able to structure it to be able to navigate to bits of it easily.
Can anyone advise me of the best way to structure this project? Does it warrant classes? How would you go about structuring the nested functions of this project? Is there any way to flatten what might be too much nesting?
Any advice greatly appreciated. I can post code later from home if necessary.
Best regards,
Matthew Petty
Dubai