Click here to Skip to main content
15,893,266 members

Dominic Burford - Professional Profile



Summary

Follow on Twitter LinkedIn      Blog RSS
6,554
Author
2,053
Authority
9,852
Debator
8
Editor
100
Enquirer
212
Organiser
2,954
Participant
I am a professional software engineer and technical architect with over twenty 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 am also an avid cyclist who enjoys reading, listening to music and travelling.

 

Reputation

Weekly Data. Recent events may not appear immediately. For 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 frequencysilversilversilversilver
Bypass spam checks when posting contentsilversilversilversilversilversilvergoldSubEditor, Mentor, Protector, Editor
Store personal files in your account areaplatinumplatinumSubEditor, Editor
Have live hyperlinks in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Have the ability to include a biography in your profilebronzebronzebronzebronzebronzebronzesilverSubEditor, Protector, Editor
Edit a Question in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Edit an Answer in Q&AsilversilversilversilverYesSubEditor, Protector, Editor
Delete a Question in Q&AYesSubEditor, Protector, Editor
Delete an Answer in Q&AYesSubEditor, Protector, Editor
Report an ArticlesilversilversilversilverSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending ArticlegoldgoldgoldgoldSubEditor, Mentor, Protector, Editor
Edit other members' articlesSubEditor, Protector, Editor
Create an article without requiring moderationplatinumSubEditor, Mentor, Protector, Editor
Approve/Disapprove a pending QuestionProtector
Approve/Disapprove a pending AnswerProtector
Report a forum messagesilversilverbronzeProtector, Editor
Approve/Disapprove a pending Forum MessageProtector
Have the ability to send direct emails to members in the forumsProtector
Create a new tagsilversilversilversilver
Modify a tagsilversilversilversilver

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


 
GeneralPerforming Code Coverage for .NET Core 2.0 applications Pin
Dominic Burford23-Mar-18 4:54
professionalDominic Burford23-Mar-18 4:54 
GeneralRe: Performing Code Coverage for .NET Core 2.0 applications Pin
Slacker00723-Mar-18 5:12
professionalSlacker00723-Mar-18 5:12 
GeneralRe: Performing Code Coverage for .NET Core 2.0 applications Pin
Dominic Burford23-Mar-18 5:15
professionalDominic Burford23-Mar-18 5:15 
GeneralBuilding ASP.NET Core 2.0 web applications Pin
Dominic Burford21-Mar-18 5:39
professionalDominic Burford21-Mar-18 5:39 
GeneralObtaining the authentication token returned from Azure AD B2C in ASP.NET Core 2.0 Pin
Dominic Burford16-Mar-18 2:03
professionalDominic Burford16-Mar-18 2:03 
GeneralVersioning a .NET Core 2.0 application Pin
Dominic Burford13-Mar-18 2:34
professionalDominic Burford13-Mar-18 2:34 
GeneralThe next generation technical stack Pin
Dominic Burford12-Mar-18 4:43
professionalDominic Burford12-Mar-18 4:43 
GeneralWriting flexible code Pin
Dominic Burford22-Jan-18 23:58
professionalDominic Burford22-Jan-18 23:58 
As part of a previous project I had to implement a login service for a mobile app. I wrote the service using ASP.NET Web API in C#. The service returned a user JSON object if the login was successful. All well and good. As part of my current project, I have a need to write another login service for a completely different application. This time I need to write a login service for a web application.

Looking at the requirements of the new web app login, it occurred to me that the code would be very similar to the mobile app login service. They both needed the ability to locate a user (based on their email address) and check if the email that was entered by the user matched the email held in the User table in the database.

So I began thinking how I could make my login code more flexible and generic so that I could accomplish the same login functionality using different user types (a mobile app user and a web app user). I eventually came up with a solution that uses interfaces and generics, and gives me the flexibility to write multiple login services for any user type.

The following code is based around an n-tier architecture where there is a data abstraction layer that handles all interaction with the back-end database, and a business abstraction layer that enforces the domain logic rules.

Before going any further, for clarity I have deliberately omitted any code relating to authentication, security, permissions etc. When reading through the code, please bear this in mind. Do not copy and paste the code as-is.

So let's start off by describing how the data has been made flexible. For this I created an interface that would be implemented by the data classes responsible for fetching the user from the User table.

public interface ILoginData<TEntity, TModel>
{
    TEntity FindByUsername(TModel model);
}
The TModel represents the user model that is passed into the function, and TEntity is the user that is returned from the User table. Both of these objects should be POCO (Plain Old C# Object) objects. Although I have specified a different type for the parameter and the return type, you could quite easily have the same object for both. I wanted to keep them separate so that the input and output objects can be different.

An example impementation of TModel could be as follows.

public class UserModel
{
    public string Email { get; set; }
    public string Password { get; set; }
}
A similar definition can be used for the TEntity object too.

Any class that implements this interface therefore has to provide a mechanism for locating a user. This is the first step towards implementing our flexible login service.

An example class definition of a data class that implements our interface is as follows.

public class UsersData : ILoginData<UserEntity, UserModel>
{
    public UserEntity FindByUsername(UserModel model)
    {
        UserEntity result = null;
        if (!string.IsNullOrEmpty(model?.Email))
        {
            result = this.GetUserByEmail(model.Email);
        }
        return result;
    }
}
Next we need to implement a business service that invokes our data layer class. We need to implement another interface to ensure that each of our login classes each contain the same method.

public interface ILoginService<T>
{
    T LoginUser(string username, string password);
}
This is the actual login method that is being declared here. Each login class must implement a function called LoginUser that will return a user object. The parameters in this particular example are the username (email) and password, but your own function may take different parameters as required.

public class WebLoginService : ILoginService<UserEntity>
    
    //ensure that our data class implements our interface from earlier so that we can 
    //guarantee that is contains the method FindByUsername()
    private readonly ILoginData<UserEntity, UserModel> _data;

    public UserEntity LoginUser(string username, string password)
    {
        UserEntity result = null;

        if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password))
        {
            UserModel user = new UserModel
            {
                UserName = username,
                Password = password,
            };
            result = this._data.FindByUsername(user);
            if (result != null)
            {
                //check if the user's email address and the entered password matches the one in the database
                result.IsAuthenticated = string.CompareOrdinal(password, result.Password) == 0;
            }
        }
        return result;
    }
}
Here's an example implementation of our interface. Note the line of code below.

result = this._data.FindByUsername(user);
This is invoking our data class from earlier. We know that our data class contains this method because the reference to our data object is of type ILoginData<userentity, usermodel="">.

I have implemented two login classes using this design (a mobile app and a web app). It gives me the flexibility to substitute different models and entities into the code. I have also implemented the following constructor which allows me to pass in different implementations of the data class so that I can unit test the login functionality without having to touch the database.

public WebLoginService(ILoginData<UserEntity, UserModel> data)
{
    this._data = data;
}
I invoke this constructor from my unit tests which contains a different implementation of my data class.

This design can be used for implementing other functionality besides login code. In fact, it can be used whenever you have any dependancy between one class and another class. Instead of relying on concrete types, you are relying on an interface and coding to that instead. It gives you the ability to provide different types of models and entities, as well as fully supporting unit testing.
"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


modified 24-Jan-18 5:20am.

GeneralA cautionary tale of over-confidence in your own opinions Pin
Dominic Burford22-Dec-17 1:57
professionalDominic Burford22-Dec-17 1:57 
GeneralWhat lies ahead in 2018 Pin
Dominic Burford21-Dec-17 0:18
professionalDominic Burford21-Dec-17 0:18 
GeneralTemplated HTML emails using RazorEngine Pin
Dominic Burford30-Nov-17 4:49
professionalDominic Burford30-Nov-17 4:49 
GeneralSending emails using Azure Sendgrid service Pin
Dominic Burford29-Nov-17 11:18
professionalDominic Burford29-Nov-17 11:18 
GeneralBuilding native enterprise apps is (probably) the wrong approach Pin
Dominic Burford28-Nov-17 1:05
professionalDominic Burford28-Nov-17 1:05 
GeneralAppropriate vs Consistent Pin
Dominic Burford9-Nov-17 3:24
professionalDominic Burford9-Nov-17 3:24 
GeneralCreating Generic RESTful API Services Pin
Dominic Burford20-Oct-17 5:01
professionalDominic Burford20-Oct-17 5:01 
GeneralIs your software team a democracy or a dictatorship? Pin
Dominic Burford16-Oct-17 21:44
professionalDominic Burford16-Oct-17 21:44 
GeneralSimplifying updating data Pin
Dominic Burford21-Sep-17 22:46
professionalDominic Burford21-Sep-17 22:46 
GeneralWhen 100% code coverage is not always enough Pin
Dominic Burford21-Jul-17 5:11
professionalDominic Burford21-Jul-17 5:11 
GeneralThat's the app in the app stores Pin
Dominic Burford18-Jul-17 5:00
professionalDominic Burford18-Jul-17 5:00 
GeneralDefensive Programming Pin
Dominic Burford28-Jun-17 7:23
professionalDominic Burford28-Jun-17 7:23 
GeneralMy first year - How time flies Pin
Dominic Burford19-Jun-17 1:40
professionalDominic Burford19-Jun-17 1:40 
GeneralShould software architects write code? Pin
Dominic Burford16-Jun-17 4:22
professionalDominic Burford16-Jun-17 4:22 
GeneralEnsuring your data is safe with Azure SQL Database Pin
Dominic Burford2-Jun-17 2:24
professionalDominic Burford2-Jun-17 2:24 
GeneralWhat makes a Senior Software Engineer? Pin
Dominic Burford30-May-17 21:53
professionalDominic Burford30-May-17 21:53 
GeneralMore Software Interview Skills 101 Pin
Dominic Burford25-May-17 6:03
professionalDominic Burford25-May-17 6:03 

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.