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

Boyd Timothy btimothy at gmail.com
Thu Mar 15 08:34:26 PST 2007


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
>


More information about the tomboy-list mailing list