Re: small code smell

Tim Hemel <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
On Sun, Aug 31, 2003 at 08:54:20PM +0200, Bram Moolenaar wrote:
> 
> Tim Hemel wrote:
> 
> > This would make the code somewhat cleaner IMO.
> 
> For some places this would indeed be cleaner.  But in other places you
> are taking code out of the context of where it's invoked and dump it in
> a class for the operating system.  I think it should only be done for
> generic things that can be invoked from several places.

I'll give it a shot and report back the result. I think most of the os
dependent code can be refactored out into nice functions. I see a lot of
long routines in Util.py which work on filenames, I'll have a look at those
as well. It seems that a lot of the operations in Util.py would fit nicely
into an OperatingSystem class by themselves.

I agree that you should not get a specific class with a lot of operations that
are invoked only once. Instead, the os specific property that is needed for
making the decision should be put into the class, so that it can be reused.
The big advantage of having such a class is that it is a lot easier later to
add support for another operating system. Or suppose that you know about a
buggy posix implementation. A simple derived class for PosixOperatingSystem
would solve it.

One thing: I am very new to the AAP code, and I do not know yet how to test if
things still work. I saw something about unit tests that have been written,
perhaps someone can tell me where they are and how I run them? I need those
zimbu points badly!! :-)


Tim

-- 
Zen Microsystems: we're the om in .commmmmmmmm...


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.