[Parti-discuss] [PATCH] client support for M$ Windows!
Antoine Martin
antoine at nagafix.co.uk
Mon Mar 30 06:52:19 EDT 2009
Hi Toby,
> Antoine Martin <antoine at nagafix.co.uk> wrote on 25/03/2009 02:31:04 PM:
>> Nathaniel Smith wrote:
>>> (In general, I want to avoid having different code paths for different
>>> platforms when possible; it's just more chances for bugs to creep in,
>>> and makes testing harder.)
>> Indeed, I am more used to writing server side Java code. So writing code
>> that knows and even cares and branches based on what platform it is
>> running on is a new and completely alien concept to me... and it makes
>> me cringe!
>
> I work on multiplatform code day-in, day-out. Identify all the areas which
> need platform-specific handling, abstract them and stick all the
> platform-specific code into it's own folder. That way at least you have
> some hope of maintaining sanity in the main line.
I am well versed in handling platform-specific using abstraction
(dealing with JDBC/SQL variations in my case rather than OSes - and in
Java rather than python - but still...)
I think that in this case we should try to keep the code in the same
file(s), changing the code if needed (as Nathaniel did with the socket
code) rather than splitting the flow into separate code-paths/files.
(note that I didn't even attempt to do that with my first cut... I'm not
exactly leading by example here!)
It may not be possible to do this cleanly in all cases... For example, I
think the clipboard stuff will need some abstraction before we can
handle both platforms.
One thing is for sure: the use of statements like "if.platform == win32"
should be kept to a minimum. (yuk)
Cheers
Antoine
More information about the Parti-discuss
mailing list