[mono-android] [MonoTouch] sharing code between mono touch and mono for android
Stuart Lodge
me at slodge.com
Tue Feb 28 08:04:10 UTC 2012
I like that Norway flights example - wish I'd seen that earlier!
I've personally found that as long as you put as much of your code as
possible into the shared ViewModel and lower classes (Model, Services, BL,
DAL, whatever, ...) inside their own project, then refactoring isn't too
painful - it's maybe only 80% automatic, which I personally don't find
unworkably painful. One thing that's helped me is that the way I've tackled
this so far is to build one Mvvm platform first (e.g. WP7) and to then
build the others- I haven't tackled this by having all 3 platforms being
developed concurrently. If you really have to develop all 3 concurrently
then that might be harder.
To be clear this was also recently done across a team of up to 4 devs
working remotely to each other - and I personally used R# a lot :)
A "baby" example of the type of solution I'm using is:
https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20Tutorial/Tutorial
or
https://github.com/slodge/MvvmCross/tree/master/Sample%20-%20CustomerManagement/CustomerManagement
-
hopefully you can see how "thin" we keep the UI/views - those are the
places where the auto-refactoring doesn't work.
One other suggestion/hope for the future - Portable Class Libraries might
help... http://msdn.microsoft.com/en-us/library/gg597391.aspx - but on the
one time I tried these I found I couldn't write the code I needed to write
:/
Stuart
On 28 February 2012 04:34, James Briant <jamie at binaryfinery.com> wrote:
> On Mon, Feb 27, 2012 at 8:03 PM, Felix Collins <felix at intranel.com> wrote:
>
>>
>>
>> On 28/02/2012 4:48 p.m., James Briant wrote:
>>
>>> Yes they can be, but the examples from the book aren't, nor are the ones
>>> from FlightsNorway. If they /are/ in the same solution, it doesn't help
>>> refactoring at all, because there are two separate project hierarchies:
>>> refactoring Library.Droid will change the files in App.Droid, and also in
>>> Library.MT (because the are the exact same files as Library.Droid), but it
>>> wont do the refactoring in App.MT. So, they might as well be in separate
>>> solutions. And in fact, having them all in the same solution /completely
>>> fucks up Intellisense/ and Resharper's Code Dom. Whole Solution Analysis
>>> (in R#) that I totally rely on to make sure my MT projects will actually
>>> compile when switch to the Mac, is completely broken by having the same
>>> file in two different projects.
>>>
>> Sounds like a feature request for JetBrains.
>>
>
> Its not something that they can reasonably solve without a complete model
> change, and then I suspect that they would still run into the fundamental
> problem that Visual Studio itself will not open the same file twice, in the
> context of two different projects. That's the infamous "This file is open
> in another project" error.
>
> These problems are just indicative of the fact that this solution is
> totally ad hoc. There is a way to do target specific programming in an OO
> language, and it is shared libraries with platform specific code in
> platform specific libraries. The problem is that Microsoft totally fucked
> us over by making it so that projects cannot target multiple platforms.
> Since its impossible to do, people then figure, "Well if I'm fucked anyway,
> I might as well start doing other things like using partial classes and #if
> to include platform specific code". This is not sound.
>
>
>
>>
>>> The MT app can be in the same solution, btw. You just need something <
>>> https://github.com/**jamiebriant/VsMono<https://github.com/jamiebriant/VsMono>>to
>>> fool VS into loading it, and a hacked version of monotouch.dll that claims
>>> to be .NET 4. Then you can use R# Solution Analysis to catch errors as you
>>> type: if R# says there are no errors, MonoDevelop will compile it on the
>>> Mac 99.99% of the time. I edit my MT apps on windows.
>>>
>>> I think I'll have to do that (are there step by step instructions
>> somewhere?). My brain hurts trying to learn all the different keybindings
>> on the mac despite having hacked as many as possible. I use the
>> alt-<firstletter> key mnemonics in windows all the time and that plays
>> merry hell on a mac!
>
>
> More details here:
> http://blog.binaryfinery.com/pages/monotouch-visual-studio-productivity
>
>
>
>>
>>
>> Felix
>>
>> ______________________________**_________________
>> Monodroid mailing list
>> Monodroid at lists.ximian.com
>>
>> UNSUBSCRIBE INFORMATION:
>> http://lists.ximian.com/**mailman/listinfo/monodroid<http://lists.ximian.com/mailman/listinfo/monodroid>
>>
>
>
>
> --
>
> jamie briant
>
> founder | binaryfinery | mobile, social, cloud, apps
>
> www.binaryfinery.com | blog.binaryfinery.com | about jamie<http://careers.stackoverflow.com/jamiebriant>
>
>
>
>
> _______________________________________________
> Monodroid mailing list
> Monodroid at lists.ximian.com
>
> UNSUBSCRIBE INFORMATION:
> http://lists.ximian.com/mailman/listinfo/monodroid
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/monodroid/attachments/20120228/6380f9db/attachment-0001.html>
More information about the Monodroid
mailing list