How well would MvvmCross and CSLA.net work together in a multi-platform strategy (ASP.NET MVC, WP, WPF, WinRT, Win8, Android, iOS) - xamarin.ios

Long time lurker, first time questioner here :)
I have been looking into our company's next software system architecture. We have been using CSLA.net, to some extent, as our business object framework and are thinking of building our new architecture around it. CSLA.net has support for the platforms mentioned in the title and we are looking for mvvm framework that would work well with it.
At the moment we only support windows environments but are also looking to support at least Android and iOS (also mono in general is under consideration). We are looking to share as much of the code as possible between the platforms and MvvmCross seems like really nice piece of mvvm (+) framework, especially in that context. I have watched few n+1 videos and what I have seen so far has been very impressive. I also like the Stuart's style of introducing the framework and concepts around it.
Has anyone tried to build a cross platform application that uses both of these frameworks (CSLA.net and MvvmCross)? If yes, what have been your experiences like? Also if Stuart could comment on the issue of how to merg the viewmodels of the two frameworks. I remember Rocky (Rockford Lhotka) recommending, as a general tip when working with mvvm frameworks, to inherit CSLA.net viewmodelbase(not viewmodel) and implement also mvvm framework's requirements into that class. You can find source of the viewmodelbase from https://github.com/MarimerLLC/csla/blob/master/Source/Csla.Xaml/ViewModelBase.cs.
Any input would be much appreciated.
Regards,
Harri
ps. I think, that this would make a great n+ video. Wouldn't it ;)

I've personally never used CSLA, but I have talked with it's original author, Rocky, both by email and in person.
CSLA presents itself as a business model object layer and that it can very successfully interoperate with independent Mvvm frameworks - see Rocky's post on CSLA+Mvvm
MvvmCross provides the more application and UI level support - and leaves application authors free to choose how they write their business services and models.
Because of this, yes I think it should be possible and even straight-forward to use both of the frameworks together if you want to. To get started, it might be useful to write some prototypes - and perhaps to look at the way other integration has been done - e.g. CSLA+Caliburn integration
ps. I think, that this would make a great n+ video.
I'd much rather see this type of article from someone who understands and uses CSLA. I would encourage all members of the MvvmCross community to contribute their own blog posts, articles, videos and github samples.
One caveat to this advice: I don't know if CSLA support Portable Class Libraries - if it doesn't then you'll probably need to use file-linking rather than PCLs in your app

Yes, you can use a multitude of MVVM frameworks; I've used CaliburnMicro and our own custom MVVM with success. If you haven't checked out Rocky's eBook series, you should definitely do so. One of the big gotchas is the limitations on reflection in Silverlight, hence also in WP8 and WinRT, so some reading up on that is well-advised.
Regarding Portable Class Libraries, you can't those for CSLA business objects (they require more stuff than is available in PCLs), so you do have to do the project linking. Typically, write the complete class in the .NET libary w/ pre-compiler directives, such as
#if !SILVERLIGHT
around code that can't be complied for Silverlight/WP8. I do use PCLs for some basic stuff, like enums and constants, but not for the business classes.

Xamarin have just released some updates that mean the latest framework 4.5 with async features can shortly be implemented...

Related

Haxe for enterprise application development

Is there anything available for Haxe which would be suitable for real-life enterprise application development? (i.e. A professional high level UI component framework.)
Just a note - I know we all love our tools of choice, but please try to keep it objective.. don't just recommend Haxe for something without thinking about whether it's really an effective tool for business requirements.
On one hand, as Jason suggested in his comment, there is missing a haxe-based native UI framework.
On the other hand, we don't really need a haxe-based UI framework, but using the UI framework available to the target platform is enough. Unlike building a library, which is better to be target independent, building a "real-life enterprise application" only requires targeting a specific platform. Since UI is highly dependent on the target platform, it means that we should use a target-specific UI framework. For example, the best UI solutions to an web app are probably jQuery, ReactJS, AngularJS etc., which all can be used in Haxe (jQueryExtern, react.hx, angular.haxe). For Flash/Java/C#, we can simply use any "native" libs by -swf-lib path/to/lib.swc, -java-lib path/to/lib.jar, and -net-lib path/to/lib.dll. For C++, however, although there is continuous improvement (watch the wwx2014 talk), it is still somewhat hard to use native libs.
We are making games in haxe + OpenFL + StablexUI. Not sure if it suitable to post their urls, so that you could see the quality. But it helps if you need your custom ui not native (iOS, Android).

Porting Windows Phone game with Xamarin

I currently have a very simple memory game for Windows Phone that I would like to port over to iOS, Android and possibly Win8 using Xamarin tools.
I would like to centralize my business logic in one assembly and simply create the UI for each platform.
For the most part, the code is simple C#, but I do make use of Bitmaps to show the cards in the game. However, from what I've read, there is no standard support across the different platforms for using Bitmaps.
What would be a recommended approach to this problem?
I'm thinking I have to use something like MonoGame, but feel that is overkill for what I want to do.
You say your code is in C#. As far as I know Xamarin is the only way to get C# code to run on Android and iOS. Xamarin has a free starter edition that you might be able to use but your app will be size limited. Once you hit the size limit you'll need to pay for a license.
After you've decided to pay for a license there are no other costs involved if you want to use MonoGame for the port. If your game is already using XNA or you have some XNA experience I recommend using MonoGame. MonoGame is a port of XNA and is designed for making games, so many game related tasks are easier.
The alternative is to build your game as an app using the standard app building API. This is possible but I can't see any advantages doing it this way unless you are trying to save money by using Xamarin's free edition. If you plan to make more games in the future, you'd be better off biting the bullet and learning MonoGame.
Using bitmaps with MonoGame shouldn't be a problem. Although, you may need to convert them to PNG's first.
Centralizing the business logic in one assembly is sort of possible using Portable Class Libraries but due to the limitations of PCL's it's often easier to use file sharing. Basically you have a soft link to the files in each project. Updating the files updates them in all projects at the same time, but adding new files requires you to add them to each project individually. It's a little bit of a maintenance pain, but not much.
For sure, as a starting point you should separate UI and logic.
To reach this I highly recommend you to make console version of game. Using console it is possible only send commands with parameters to application. No mouse or real-time keyboards usages. All UI-related tasks will be left. Only business logic and commands to use will remain.
Then, you should try MonoGame. It's reliable enough for 2D games. Even more, If IL-code is not too much, it's free for iOS and Android!
Other way is... Unity 3D. Using that engine is depends of code you wrote. In some cases it's possible to use that game engine with shared business logic. Thanks to new Unity 3D policy, indie game developers could make and deploy their games for free.
In short, plan is:
Implement core functionality (with console I/O);
Then, choose engine and implement UI for target platforms.

MonoTouch - cross-platform API abstraction layer?

I understand that with MonoTouch and MonoDroid that you develop against the native UI layer, which is a good thing. However, I was wondering if there were any cross platform Mono API layers for features such as camera, location, storage, notifications etc... ?
PhoneGap supplies a JavaScript a abstraction layer that does just this. Is there a Mono equivalent?
There is an official monomobile api project from xamarin - that provides camera, contacts and gps abstractions, plus there are discussions (but not firm roadmaps) about extending this further. See http://blog.xamarin.com/2011/11/22/introducing-the-xamarin-mobile-api/ for an intro
Beyond that:
some api's exist cross platform from the start - eg isolated storage can be used on all platforms.
I've seen a few other GitHub projects started - eg chrisntr's mono extensions
I've written a few abstractions (e.g. File, gps, camera) in http://GitHub.com/slodge/mvvmcross
I recently came across MonoDroid.Dialog. I have yet to use it, but if it is as easy as MonoTouch.Dialog to do tables then I will be very happy with it.

Code sharing between MonoTouch and MonoForAndroid

What would be the best practice to share busines logic c# code between MonoTouch and Mono For Android projects?
Edited:
Initially, my question was about the physical file sharing:
What do you propose to use: network file sharing or some code
version control (git, svn)? In my case I am using two workstations -
Mac (MonoDevelop with MonoTouch) and PC (Visual Studio with
MonoDroid).
What about Solution/Project folder structure? In
"Blog Post: Xamarin Mobile World Congress 2012 Unofficial
Conference App Released!" example structure is quite confusing:
several solutions in one folder and then different platform projects in one
subfolder with different folder and project names. It can not be accomplished nativly
with IDE. Are they editing content of solution files and folder names manualy
outside of IDE environment?
And for projects of common code what kind of profile (template) to
use? Monotouch has several: Empty Project, MonoTouch Library
Project and MonoTouch Binding Projects? In Android i supose -
Android class library?
This is a very general question, but here are a few resources that may help you get started:
Video: Cross-platform Mobile Development
Blog Post: Shared Libraries For Windows Phone 7, MonoDroid and Beyond
Book: Mobile Development with C#
Blog Post: Xamarin Mobile World Congress 2012 Unofficial Conference App Released!
Edit (to answer your new questions)
The idea behind linking files across projects is that there is only one actual copy of the file, rather than having to manage multiple copies and keep them in sync yourself. The file will actually exist in just one project and be linked into the others, but when the projects are compiled it treats the file as if it were actually there.
I can't speak to exactly how they created their folder structure, but I know there have been many cases where I would manually edit project or solution files to get the folder structure I want, because there was no way to get what I wanted through the IDE alone. This really boils down to personal preference on how you want your folders to be structured.
In the end, what you need is a class library project for every platform you want to target. When going with the linked file approach, it's totally up to you where you put the physical files. One approach I use often is to actually create a standard .NET 4.0 class library, put the files in there, and then link them into my Mono for Android and MonoTouch class libraries. If all you care about is targeting iOS and Android, that may be more trouble than it's worth, and you can just let the files live in one project and link them into the other.
Disclaimer: I've got a particular Mvvm methodology that I use for sharing code across multi-platform projects...
Despite this, I genuinely don't believe in "one size fits all" frameworks - I think you need to be careful to pick an approach that best suits your project, your developers and your organisation.
With that said, some of the tools you can use within the Mono development approach are:
using Portable Class Libraries to share exactly the same code between platforms
using platform specific Class Libraries to share code between platforms, linking these using the Project Linker tool from Microsoft
using #define code within your class libraries to provide platform specific implementations of the projects (I personally try to avoid this approach, but it does often provide the quickest route to market)
using DI/IoC techniques to provide components for those occasions when platform specific implementations really are required.
using a assembly linking to provide IoC - e.g. this is what the Xamarin MobileAPI does
using server-based logic for genuine shared functionality - e.g. using REST or SOAP-XML services to implement logic
sharing tests (e.g. NUnit) between platforms to assure the quality of your logic
using shared code techniques - MVC (MonoCross) or MVVM (MonoMobile.Views or MvvmCross) for UI "controller" logic; MonoTouch.Dialog and MonoDroid.Dialog for "View-level" abstractions; CrossGraphics for UI "drawing"; SQLite.Net for database; etc.
I'm finding the MonoTouch, MonoDroid and the Microsoft tools provide real and signigicant benefits in developing cross platform code - but you do have to work and think to achieve this.

Best choice to build a website like http://www.pageflakes.com/

What is the best language and approach to build the widgets website like http://www.pageflakes.com/. By best I mean rapid development, performance, smoothness and by approach I mean that some one will use drag and drop plug in jQuery (some issues) etc.
Two functionality will be main in my site:
selecting the widget and then dragging on the specified position i like
saving the state without login for the user.
You don't mention your existing language skills which might be the most important detail here. Also, are you prepared to learn a new language/framework for this project?
Some generic advice assuming you would be using Java: since the site in consideration looks more like a web application as opposed to a "web site", a framework which supports rich controls/Ajax natively might work wonders here. A GWT based framework like SmartGWT might be an interesting candidate.

Resources