"Original Brownster" <[EMAIL PROTECTED]> wrote > 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.
Good so far. One nitpick is that class names should be nouns. They refer to objects not actions. So your class could maybe be called just Stream or RippingStream or somesuch. This has a knock on effect further down... > The second module contains all the code to handle the pygtk > interface > and written as a separate class called Windowapp() Thats fine. > 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=....) And thats fine too, although UC isn't an entirely obvious name for the StreamRipper (to me anway!) > from then on within the Windowapp class i refer to the methods in > streamrip like > > self.UC.Dumpstream(...) etc. One of the features of OOP is that you don't need to include the class name in the method name since the object itself tells you what you are acting on. Thus we know that UC is the object and you just want to dump it. So just call the method dump... It keeps things shorter, avoids duplication and generally improves readability. But this is a cosmetic issue and others may disagree. But the general notion is that we are aiming for a semantic form of object.action it's only in procedural programming that you need to embed the type into the name. > better another way for example should I have used inheritence and > allowed the windowapp class to inherit the methods of streamrip()? Absolutely not. The WindowApp ius one thing the stream another. If you want to use the stream elsewhere(in a web app say) you would be stuck. You should always try to keep presentation and application logic separate (even in non OOP programs!) -- Alan Gauld Author of the Learn to Program web site http://www.freenetpages.co.uk/hp/alan.gauld _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor