Re: small code smell

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Tim Hemel wrote:

> > 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.

A proposal for refactoring is welcome.  Aap has gotten to the point that
most functionality is present and we can overview what's there, so that
some cleaning up can be done,

> 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.

Good point, keeping changes to support another operating system in one
place makes it easier.  Currently a grep for "os.name" would need
to be done.

> 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!! :-)

It's very simple:  Run "aap" without arguments in the aap/Exec
directory.

-- 
This is an airconditioned room, do not open Windows.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///          Creator of Vim - Vi IMproved -- http://www.Vim.org          \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html  ///


-------------------------------------------------------
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.