Exrin Isolates

Isolates are a fancy way of saying modules. Exrin MVVM framework is designed for larger applications, built by several team members. The standard way at the moment, has had some issues, when the number of team members all working on one section, could affect others. Hence to move past this limitation, Isolates have been created, that separate out Views and Logic, for each section of the app you are working on. This ensures, that in large teams, a change in one section, won’t affect the other, as they will have no reference to each other.

Have a look at Exrin QuickStart if you want to see a Lite application architecture. Have a look at Architecting a Large Xamarin.Forms App, if you want to see how the standard architecture works.

Important Note: To clarify when you would use Isolates, say you have a Payment section in your app, with many different features and ways to pay. Then in your app you also have an Account section, with many ways to change and modify your account settings. In a large app, these groups of features will be well suited to push to an Isolate. Please don’t separate each and every single small feature into a separate DLL. This will cause large performance issues and a hard to maintain application.

Create an Isolate

The first step, is to create a new library. In here you can place, your Views, Logic, and Navigation Logic in the Stacks, to keep it completely separate from any other part of your app.

Here you can see the Views, ViewModels and Stacks all in here. You can even place Models and Services in here. Next you need to add a small class, to help initialize the Isolate.

namespace ExrinSampleMobileApp.Isolate1
{ 
    public class Isolate : Exrin.Framework.Isolate { }
}

Registering the Isolate

You will want to add a reference, from your App project, to this Isolate. In your Exrin bootstrapper, add this single line.

public static Bootstrapper GetInstance()        
{            
    if (_instance == null)                
        _instance = new Bootstrapper(new Injection(), (view) => Application.Current.MainPage = view as Page, () => { return Application.Current.MainPage; } );
    
    // Isolates 
    _instance.RegisterAssembly(AssemblyAction.Bootstrapper, new Isolate1.Isolate());
            
    return _instance;        
}

This will ensure, that the Isolate, has it’s Stacks, Views, Models, Services and ViewModels registered, when the application starts.

Summary

Isolates are a great way to separate large sections of your app out into isolation. You can use the Standard architecture and add Isolates at a later stage if needed, you are not locked into any of these architectures, from when you start. Isolates are designed for large teams, working on different sections all at the same time. This is particularly common in Agile work environments. It is just another pattern, you can potentially use, depending upon your team setup, and desired way of working.

Learn More

If you want to know more about Exrin, have a look at the following resources


XAMARIN.FORMS MONTHLY NEWSLETTER

JOIN 1,000+ SUBSCRIBERS

  1. Don't miss out on updates
  2. The latest info from this site, Xamarin and the community
  3. Unsubscribe at any time*

* We use MailChimp, with double opt-in, and instant unsubscribe

Microsoft MVP | Xamarin MVP | Xamarin Certified Developer | Exrin MVVM Framework | Xamarin Forms Developer | Melbourne, Australia

Related Posts

Tagged:Tags:

Leave A Comment?