Click here to Skip to main content
13,797,167 members

Dominic Burford - Professional Profile





Summary

Follow on Twitter LinkedIn      Blog RSS
6,477
Author
1,841
Authority
7,615
Debator
8
Editor
95
Enquirer
49
Organiser
2,314
Participant
I am a professional software engineer and architect with over eighteen years commercial development experience with a strong focus on the design and development of web and mobile applications.

I have experience of architecting scalable, distributed, high volume web applications that are accessible from multiple devices due to their responsive web design, including architecting enterprise service-oriented solutions. I have also developed enterprise mobile applications using Xamarin and Telerik Platform.

I have extensive experience using .NET, ASP.NET, Windows and Web Services, WCF, SQL Server, LINQ and other Microsoft technologies. I am also familiar with HTML, Bootstrap, Javascript (inc. JQuery and Node.js), CSS, XML, JSON, Apache Cordova, KendoUI and many other web and mobile related technologies.

I am enthusiastic about Continuous Integration, Continuous Delivery and Application Life-cycle Management having configured such environments using CruiseControl.NET, TeamCity and Team Foundation Services. I enjoy working in Agile and Test Driven Development (TDD) environments.

Outside of work I have two beautiful daughters. I enjoy cycling, running and taking the dog for long walks. I love listening to music and am a fan of Rush and the Red Hot Chilli Peppers to name a few.

 
Articles 13 (Prolific)
Tech Blogs 0
Messages 1,015 (Master)
Q&A Questions 0
Q&A Answers 26
Tips/Tricks 14
Reference 0
Comments 68

Reputation

For more information on Reputation please see the FAQ.

Privileges

Members need to achieve at least one of the given member levels in the given reputation categories in order to perform a given action. For example, to store personal files in your account area you will need to achieve Platinum level in either the Author or Authority category. The "If Owner" column means that owners of an item automatically have the privilege. The member types column lists member types who gain the privilege regardless of their reputation level.

ActionAuthorAuthorityDebatorEditorEnquirerOrganiserParticipantIf OwnerMember Types
Have no restrictions on voting frequencysilversilversilversilverAdmin
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSitebuilder, Subeditor, Mentor, Protector, Editor, Staff, Admin
Store personal files in your account areaplatinumplatinumSitebuilder, Subeditor, Supporter, Editor, Staff
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubeditor, Protector, Editor, Staff, Admin
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubeditor, Protector, Editor, Staff, Admin
Edit a Question in Q&AsilversilversilversilverYesSubeditor, Protector, Editor, Admin
Edit an Answer in Q&AsilversilversilversilverYesSubeditor, Protector, Editor, Admin
Delete a Question in Q&AYesSubeditor, Protector, Editor, Admin
Delete an Answer in Q&AYesSubeditor, Protector, Editor, Admin
Report an ArticlesilversilversilversilverSubeditor, Mentor, Protector, Editor, Staff, Admin
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubeditor, Mentor, Protector, Editor, Staff, Admin
Edit other members' articlesSubeditor, Protector, Editor, Admin
Create an article without requiring moderationplatinumSubeditor, Mentor, Protector, Editor, Staff, Admin
Approve/Disapprove a pending QuestionProtector, Admin
Approve/Disapprove a pending AnswerProtector, Admin
Report a forum messagesilversilverbronzeProtector, Editor, Admin
Approve/Disapprove a pending Forum MessageProtector, Admin
Create a new tagsilversilversilversilverAdmin
Modify a tagsilversilversilversilverAdmin

Actions with a green tick can be performed by this member.


 
GeneralThe latest version of our app nears completion Pin
Dominic Burford7-Dec-18 3:21
professionalDominic Burford7-Dec-18 3:21 
GeneralIs Silicon Valley a force for good? Pin
Dominic Burford27-Nov-18 22:57
professionalDominic Burford27-Nov-18 22:57 
GeneralUsing Javascript to retrieve values from a Xamarin Forms WebView Pin
Dominic Burford27-Nov-18 6:01
professionalDominic Burford27-Nov-18 6:01 
GeneralUsing the MVVM pattern with a Xamarin Forms mobile app Pin
Dominic Burford21-Nov-18 2:13
professionalDominic Burford21-Nov-18 2:13 
This article assumes that the reader is already familair with the MVVM software design pattern. If you are not familair with this design pattern, then it's worth reading up on that first, before proceeding with this article. There are many descriptions of this article, including this one[^]. It is useful to understand the design pattern from a purely conceptual perspective, before looking at the various technical impementations of it. By understanding the design pattern at a conceptual level, you will far easier comprehend its implementation details.

I have used the MVVM design pattern previously. In fact, I have used the MVVM pattern within our current mobile app. For this, I used Kendo UI controls in conjunction with javascript. This particular implementation uses what is known as an observable. An observable (which is based on the Observer design pattern[^] is an object that maintains a list of dependents (called observers) and notifies them of any changes in state. It is this notification system that provides the two-way notification (or binding) that is essential to the MVVM design pattern.

With our latest incarnation of the mobile app now well underway, we have come to the point where we can start building our data entry forms. I have so far implemented the underpinning infrastructure and architecture which enables the app to consume our services, save data to local storage using SQL Lite and send emails from the app. All of this is now fully implemented and working.

We have several data entry forms within our app that allow the user to submit data to our backend services. These include forms for submitting:

- mileages
- service, repair and MOT bookings
- vehicle inspections

As we have already done so in our previous mobile app, we will be using the MVVM design pattern to implement these data entry forms.

We will impement the data entry forms using XAML and Telerik controls. We could have used the native Xamarin UI controls, but there is a greater selection of Telerik controls, and they provide a consistent API and are easily themable. Although the implementation uses Telerik controls and XAML, the underlying concepts can be applied with any UI technology.

I'll use an example that refers to a simple data entry form that allows a user to enter a message which is sent to the backend service. The message may be to request information for example. This trivial example containing just the one UI control should suffice to demonstrate how the MVVM pattern can be implemented.

I tend to begin the development of a new data entry form from the Model and work backwards from there i.e. Model -> ViewModel -> View.

All Models inherit from the the same base Model class. This base Model class inherits from NotifyPropertyChangedBase which is a Telerik class that supports behaviour similar to INotifyPropertyChanged.
public class BaseFormModel : NotifyPropertyChangedBase
{
}
This ensures that all Models used by the data entry forms will support the ability to raise events when a property on the Model changes. These changes to the Model will be notified to the ViewModel.

Models used by the data entry forms also inherit from the following interface.
public interface IFormData<T>
{
    T CreateDefaultModel();
}
By implementing this interface, the Model must therefore contain the method CreateDefaultModel(). This method is used by the ViewModel to supply a default Model (containing default values) which can be used when the View (the XAML form) is first displayed to the user. It implements generics which therefore allows it to work with any type of Model.

Here's the Model for the "Message Us" data entry form. For the purposes of this simple example I have removed much of the code for clarity.
public class MessageUsModel : BaseFormModel, IFormData<MessageUsModel>
{
    private string _messageToSend;

    [DisplayOptions(Header = MessageUsModelConstants.MessageHeader)]
    [NonEmptyValidator(MessageUsModelConstants.MessageError)]
    public string MessageToSend
    {
        get => _messageToSend;
        set
        {
            if (_messageToSend == value) return;
            _messageToSend = value;
            OnPropertyChanged();
        }
    }

    public MessageUsModel CreateDefaultModel()
    {
        return new MessageUsModel
        {
            _messageToSend = ""
        };
    }
}
The decorations on the public property MessageToSend are Telerik specific and define the validation rules / messages for the property. These rules / messages are then enforced by the View. Using this particular implementation of MVVM, the data rules are therefore defined at the level of the Model (which makes sense). Whenever a new value is set on the MessageToSend property, the OnPropertyChanged() event is raised. This updates the state of the ViewModel that is bound to the Model.

Moving onto the ViewModel, we define the base behaviour for all our ViewModels in our base class.
public abstract class ViewModelBase<T> : NotifyPropertyChangedBase where T : new()
{
    /// <summary>
    /// This is the View-Model's reference to the Model. Use this whenever the view-model needs to reference the model.
    /// </summary>
    public T FormModel = new T();

    /// <summary>
    /// Implement this method in the derived class to define what actions to take when the user
    /// submits data from one of the data-entry forms 
    /// </summary>
    /// <returns></returns>
    public abstract Task PostCompleteTask();
}
I have used an abstract class that inherits from the same Telerik class as the base Model class i.e. NotifyPropertyChangedBase. The public property FormModel is a reference to the Model. This property is used by the ViewModel when it needs to refer to the Model. The method PostCompleteTask() is invoked by the ViewModel when the form is ready to be submitted. As this is an abstract method, it must therefore be implemented by each inheriting subclass. This provides consistency to all of our ViewModels. The actual work performed by each ViewModel will always be defined within this method.

Here's the ViewModel for the "Message Us" class. For the purposes of this simple example I have removed much of the code for clarity.
public class MessageUsViewModel : ViewModelBase<MessageUsModel>
{
    public MessageUsModel MessageUsModel;
        
    public MessageUsViewModel()
    {
        this.MessageUsModel = this.FormModel.CreateDefaultModel();
    }

    public override async Task PostCompleteTask()
    {
        //implement your code here to submit the form data
    }
}
The public property MessageUsModel is the reference to our Model. This is initially populated with a default instance in the class constructor by invoking the method CreateDefaultModel() (which we saw earlier) using the public property FormModel (which we also saw earlier).
this.MessageUsModel = this.FormModel.CreateDefaultModel();
When the user has finished entering their message and is ready to submit the form, clicking on the form's submit button will invoke the PostCompleteTask() method that will perform whatever processing as necessary (in our case all form data is submitted to our backend services using RESTful Web API services).

Finally, here's the XAML for the View and the code-behind.
[XamlCompilation(XamlCompilationOptions.Compile)]
public partial class MessageUsView : ContentPage
{
    public MessageUsViewModel Muvm;

    public MessageUsView()
    {
        InitializeComponent();

        //initiate the view-model and bind it to the form
        this.Muvm = new MessageUsViewModel();
        this.BindingContext = this.Muvm;
    }

    private async void DataFormValidationCompleted(object sender, FormValidationCompletedEventArgs e)
    {
        dataForm.FormValidationCompleted -= this.DataFormValidationCompleted;

        if (e.IsValid)
        {
            await this.Muvm.PostCompleteTask();
        }
    }

    private void CommitButtonClicked(object sender, EventArgs e)
    {
        dataForm.FormValidationCompleted += this.DataFormValidationCompleted;
        dataForm.CommitAll();
    }
}
And the XAML code.
<input:RadDataForm x:Name="dataForm" CommitMode="Immediate"  />
<input:RadButton x:Name="CommitButton" Text="Save" Clicked="CommitButtonClicked" IsEnabled="True"/>
The important parts to note are the setting up of the binding between the View and the ViewModel in the constructor. This sets up the two-way binding, such that any changes in the View are reflected in the ViewModel and vice-versa. These changes are also reflected in the underlying Model (if that wasn't already clear).
this.Muvm = new MessageUsViewModel();
this.BindingContext = this.Muvm;
When the user clicks the Submit button, the actions implemented within the ViewModel's PostCompleteTask() method are invoked.

This is a fairly simple example. In a real world use case there would undoubtedly be more complexity, but this should serve as a useful example of using the MVVM design pattern within a Xamarin mobile app. The fact that we are using Telerik UI controls doesn't change the core concepts discussed. The MVVM design pattern is a very powerful design pattern that is perfect for use within data entry forms.
"There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult." - C.A.R. Hoare

Home | LinkedIn | Google+ | Twitter

GeneralConsuming a private nuget feed in an Azure DevOps build pipeline Pin
Dominic Burford2-Nov-18 7:55
professionalDominic Burford2-Nov-18 7:55 
GeneralBuild a Xamarin.Forms iOS mobile app using Azure DevOps Pin
Dominic Burford9-Oct-18 0:38
professionalDominic Burford9-Oct-18 0:38 
GeneralDeploy a Mobile app to Azure using Azure DevOps Pin
Dominic Burford21-Sep-18 6:30
professionalDominic Burford21-Sep-18 6:30 
GeneralSetting up my first build pipeline with Azure DevOps Pin
Dominic Burford19-Sep-18 5:06
professionalDominic Burford19-Sep-18 5:06 
GeneralChoosing a mobile application development platform Pin
Dominic Burford4-Sep-18 2:36
professionalDominic Burford4-Sep-18 2:36 
GeneralExecuting an AJAX request from an ASP.NET Core querystring parameter Pin
Dominic Burford20-Aug-18 6:05
professionalDominic Burford20-Aug-18 6:05 
GeneralBuilding a Document Manager with ASP.NET Core 2.1 Pin
Dominic Burford19-Aug-18 23:38
professionalDominic Burford19-Aug-18 23:38 
GeneralReducing the surface area of the client Pin
Dominic Burford26-Jul-18 22:32
professionalDominic Burford26-Jul-18 22:32 
GeneralUnderstanding what you're doing Pin
Dominic Burford26-Jul-18 4:24
professionalDominic Burford26-Jul-18 4:24 
GeneralSetting environments in ASP.NET Core Pin
Dominic Burford16-Jul-18 22:29
professionalDominic Burford16-Jul-18 22:29 
GeneralCreating a zipped deployment for an ASP.NET Core web application Pin
Dominic Burford29-Jun-18 0:59
professionalDominic Burford29-Jun-18 0:59 
GeneralI’m turning into a Microsoft fanboy Pin
Dominic Burford8-Jun-18 6:45
professionalDominic Burford8-Jun-18 6:45 
GeneralAdding a confirmation dialog to an ASP.NET Core 2.0 form page handler Pin
Dominic Burford7-Jun-18 5:34
professionalDominic Burford7-Jun-18 5:34 
GeneralUploading a file in ASP.NET Core 2.0 Pin
Dominic Burford1-Jun-18 5:07
professionalDominic Burford1-Jun-18 5:07 
GeneralASP.NET Core 2.0 Razor Page Handlers Pin
Dominic Burford15-May-18 1:01
professionalDominic Burford15-May-18 1:01 
GeneralMocking the HttpContext Session object in ASP.NET Core 2.0 Pin
Dominic Burford30-Apr-18 5:31
professionalDominic Burford30-Apr-18 5:31 
GeneralUsing ViewComponents in ASP.NET Core 2.0 Pin
Dominic Burford16-Apr-18 23:49
professionalDominic Burford16-Apr-18 23:49 
GeneralWeb application metrics with Application Insight Part 2 Pin
Dominic Burford10-Apr-18 23:50
professionalDominic Burford10-Apr-18 23:50 
GeneralWriting flexible code in ASP.NET Core 2.0 Razor Pages Pin
Dominic Burford3-Apr-18 6:06
professionalDominic Burford3-Apr-18 6:06 
GeneralPerforming Code Coverage for .NET Core 2.0 applications Pin
Dominic Burford23-Mar-18 5:54
professionalDominic Burford23-Mar-18 5:54 
GeneralRe: Performing Code Coverage for .NET Core 2.0 applications Pin
Slacker00723-Mar-18 6:12
professionalSlacker00723-Mar-18 6:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.


Advertise | Privacy | Cookies | Terms of Service
Web01 | 2.8.181207.3 | Last Updated 12 Dec 2018
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid