[tomboy-list] Please Review: Details of refactoring done in tomboy-portable branch

Sanford Armstrong sanfordarmstrong at gmail.com
Mon Mar 19 06:14:12 PST 2007


Boyd,

Thanks for the comments.  I originally wanted to have a separate DLL
for each platform, but to be honest I just couldn't figure out how to
get the makefiles to do that for me.  I think I'll need some help in
that department.  It should be no problem to move the interfaces into
the Tomboy namespace.  Though, to avoid clutter, I was thinking about
putting them in a Tomboy.Interfaces namespace (and directory) that was
still inside Tomboy.exe.

I also thought that since so much of what happens in Tomboy.Main() is
inherently platform-specific, that instead of additional refactoring,
it might make more sense to turn the current Tomboy.exe into a library
Tomboy.dll.  Then Main could live in Tomboy.Gnome.exe and
Tomboy.Win32.exe.  For the most part, the design would be the same as
what you have described, except that instead of Tomboy.exe using
reflection to pull a factory from Tomboy.Gnome.dll, you would have
Tomboy.Gnome.exe injecting the factory into Tomboy.dll.  I haven't
really played with this yet, but thought it might be worth discussing.

Thanks,
Sandy


On 3/15/07, Boyd Timothy <btimothy at gmail.com> wrote:
> Sandy,
>
> First of all, THANK YOU for getting this going.  I know I personally
> wouldn't undertake this effort since I don't think anyone should use
> certain operating systems, but the reality is, this will help many
> others be able to have their notes on whatever system they choose to
> use, so this rocks!
>
> I think as long as we refrain from muddying up the waters too much, a
> general refactor will be okay.  We should make sure that the code is
> still organized clearly and doesn't inhibit GNOME development.
>
> Comments:
>
> I like the general approach you've taken of writing interfaces that
> the different platforms would implement.
>
> Is there a way we could not use #if/#else statements?  It might be
> cleaner to continue to build a Tomboy.exe that is platform agnostic
> and dynamically load platform-specific libraries (similar to how
> plugins are dynamically loaded) like Tomboy.Win32.dll for all the
> implementations of the interfaces defined in Tomboy.exe.  That way,
> Tomboy.exe remains entirely platform independent.
>
> You could then create the following directories and use
> configure/Makefiles to determine which ones to compile:
>
> tomboy/Tomboy.Win32
> tomboy/Tomboy.GNOME
> etc.
>
> You'd then define things like IPreferencesClient, ITrayIcon, etc. in
> Tomboy.exe (in the Tomboy namespace) and then have each platform
> provide factory methods and implementations of each of these.
> Tomboy.exe would then look for a class provided by the
> Tomboy.<Platform>.dll called something like TrayIconFactory and then
> ask it to load itself or whatever.  Doing it this way would make it so
> you wouldn't have to manage any complex #if/#else blocks.
> Additionally, the platform implementations would be completely
> separate and controllable from different files.
>
> After looking at your existing code, as an example, you'd have each of
> your platform dlls implement a Tomboy.PlatformFactory class.  This
> would be place where Tomboy.exe would get the implementations from
> (almost exactly what you have implemented already).
>
> Anyhow, those are my initial thoughts on the matter.  Good work so far!
>
> -Boyd
>
> On 3/14/07, Sanford Armstrong <sanfordarmstrong at gmail.com> wrote:
> > Tomboy devs,
> >
> > I'd like to start moving some of the changes from the tomboy-portable
> > branch into the trunk, mostly because maintaining a branch is a pain
> > and the sooner I get it in trunk the sooner I can find and fix bugs,
> > or get you all to fix them for me.  ;-)
> >
> > I'm not "done", but I'm at least at a point where I can document the
> > approach.  I've attempted to do so here:
> >
> > http://live.gnome.org/Tomboy/Win32/Refactoring
> >
> > Basically, I'm looking to see if anyone has feedback to give before I
> > start committing functional pieces.  If you think the work is bad I'd
> > like to know *before* I affect everyone.
> >
> > Specifically, I want to know if people are OK with these areas:
> > * The idea of dumping platform-dependent stuff and the interfaces that
> > serve to abstract them in the Tomboy.Platform namespace (and moving
> > some files to a "Platform" directory).
> > * My approach for dealing with GConf.  Please see details/alternatives
> > on the wiki.
> >
> >
> > I think this will be good for Tomboy.  In the short term, it will make
> > ports to Windows and other platforms with full Mono/GTK+ easier.  In
> > the long term, it's the first step towards other refactorings that
> > could make it possible to create entirely new front ends (and back
> > ends) for Tomboy.
> >
> > But if people think it's needless complication and we should be
> > focusing on making Tomboy kick ass on GNOME, I'd be interested to hear
> > that, too.
> >
> > Thanks for your time,
> > Sandy
> > _______________________________________________
> > tomboy-list mailing list
> > tomboy-list at lists.beatniksoftware.com
> > http://lists.beatniksoftware.com/listinfo.cgi/tomboy-list-beatniksoftware.com
> >
> _______________________________________________
> tomboy-list mailing list
> tomboy-list at lists.beatniksoftware.com
> http://lists.beatniksoftware.com/listinfo.cgi/tomboy-list-beatniksoftware.com
>


More information about the tomboy-list mailing list