Re: [Tutor] Modularity

2016-01-15 Thread wolfrage8...@gmail.com
Modularity of code is difficult for sure and is kind of an art. To do it best you will have to read about and implement some of the Design Patterns. There are many but some of the ones that I have leaned towards over time are Composition over inheritance, Message Passing Interfaces, Mediator, and

Re: [Tutor] Modularity

2016-01-14 Thread Mark Lawrence
On 14/01/2016 15:27, James Chapman wrote: I should have re-read that last reply before hitting send. Apologies for the poor sentence construction! Something I forgot to highlight before which might be related to your initial question. If you have a file called sound.py which contained a class c

Re: [Tutor] Modularity

2016-01-14 Thread James Chapman
I should have re-read that last reply before hitting send. Apologies for the poor sentence construction! Something I forgot to highlight before which might be related to your initial question. If you have a file called sound.py which contained a class called WavFile, if you imported just sound li

Re: [Tutor] Modularity

2016-01-14 Thread James Chapman
May I suggest: https://docs.python.org/2/tutorial/modules.html In particular: * https://docs.python.org/2/tutorial/modules.html#the-module-search-path * https://docs.python.org/2/tutorial/modules.html#packages Now the next bit of advice is likely to be controversial but I have good reasons for i

Re: [Tutor] Modularity

2016-01-14 Thread Alan Gauld
On 14/01/16 03:56, kay Cee wrote: > I'm looking to make individual modules for each class eg. Ball, > Paddle,bounds, Game, Physics and Logic. That's not usually necessary in Python. It's often better to group several related classes in a single module. For example your Ball and Paddle and any ot

[Tutor] Modularity

2016-01-14 Thread kay Cee
Recently I've decided to write a pong style game with pygame; however, I can't seem to modularize the game successfully. I'm looking to make individual modules for each class eg. Ball, Paddle,bounds, Game, Physics and Logic. Used like this : ball = Ball(), paddle = Paddle() and etc... In a Game