On Thu, 21 Feb 2002 10:35, Jon Skeet wrote: > I'm trying to understand org.apache.tools.ant.utils.FileUtils. There are > no instance variables, and as far as I can see nothing extends it. Is > there any good reason for needing instances rather than the methods > being static? (Making the methods static wouldn't break 3rd party source > code which created instances and used them; it might break binary > compatibility though.)
The initial design was so that you could potentially provide alternative implementations for different filesystems. For instance the Mac filesystem has the notion of "resource forks" (or is it "non-default streams" or is that plan9?). So when you copy a file on mac you should also copy the other bit aswell (whether it be alternate stream or a resource fork). By making it an instance the theory was that you could return a different FileUtils object on Mac than the one on Win32. In many ways it was an early attempt at providing a "serivce" architecture for filesystems like which I advocate strongly for Ant2. Unfortunately as an approach it was relatively clumsy and IMHO a mistake. In retrospect given the similarities between File systems and the desire for OS-independent build files it needs to be rearchitectured completly and different things separated out in different ways. Adam started to tackle part of this problem with his VFS layer. Not sure what the full solution is though. -- Cheers, Pete -------------------------------------------- Beer is proof that God loves us and wants us to be happy. -- Benjamin Franklin -------------------------------------------- -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
