[Tutor] OOP - have I done it right or could it be better?

Original Brownster original_brownster at yahoo.co.uk
Wed Jan 24 10:01:02 CET 2007


--- Kent Johnson <kent37 at tds.net> wrote:

> Original Brownster wrote:
> > Hi,
> > I'm fairly new to using OOP and very new to Python, my first
> program is
> > coming along well and I have split the code into 2 modules.
> > 
> > The program finds stream urls, downloads them, re-encodes them to
> othe
> > formats, all this functionality I have created in one module with
> one
> > class called Streamrip and methods to handle this.
> > The second module contains all the code to handle the pygtk
> interface
> > and written as a separate class called Windowapp()
> > 
> > You call the Windowapp() routine, in its' init method I have a call
> to
> > create an instance of the streamrip class:
> > 
> > self.UC = Streamrip(var=....)
> > 
> > from then on within the Windowapp class i refer to the methods in
> > streamrip like
> > 
> > self.UC.Dumpstream(...)  etc.
> 
> This all sounds good. You have a module, Streamrip, that implements
> the 
> core functionality you need. From your description, this module
> doesn't 
> know about the GUI so it could be reused by another kind of client, 
> tested, etc. You also have a module that implements a GUI front-end
> to 
> Streamrip. All good. Just make sure the Streamrip module doesn't know
> 
> anything about the Windowapp module - keep the dependencies one-way.

That's good then as that's how it works, it looks like I'll be adding a
command line interface too as I am thinking this and cron will be a
good way to schedule jobs. With the modular approach it means I'll
pretty much not have to touch the core functionality routines.

Thanks for your advice I feel I'm getting there!
The hardest part for me so far has being moving from VB interface
programming, when I first looked at some of the gui programming
toolkits in linux I was a bit overwhelmed however, once I made a start
I soon got some little programs running. 

Wayne.



	
	
		
___________________________________________________________ 
New Yahoo! Mail is the ultimate force in competitive emailing. Find out more at the Yahoo! Mail Championships. Plus: play games and win prizes. 
http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk 


More information about the Tutor mailing list