September 3, 2015

This is a quick demo to show how you can use local storage or cookies to save form state in a browser so that a user hasn't lost progress. I write this in response to a StackOverflow question.

You can do this with a complex object, or with a simple value as well.

The source code for the third party local storage module can be found here.

The controller code below consumes the localStorageService and exposes a method responsible for saving and retrieving the model from the service. That method is then called in ng-change on each input with an ng-model.

(function (ng) {
    'use strict';

    var saveStateController = function ($scope, localStorageService) {

        var username = 'first_last';

        var key = username + '_formName';

        var modelString = localStorageService.get(key);

        if (modelString) {
            $scope.model = JSON.parse(modelString)

        $scope.model = $scope.model || {
            name: '',
            number: null,
            biography: ''

        $scope.saveState = function () {
            localStorageService.set(key, JSON.stringify($scope.model));


        .controller('saveStateController', ['$scope', 'localStorageService', saveStateController]);


For good measure, here is the html as well:

<div ng-controller="saveStateController" class="mini-demo">

    <span class="fields">
            <label>Name: </label>
            <input type="text" ng-model="" ng-change="saveState()"/>

            <label>Number: </label>
            <input type="numeric" ng-model="model.number" ng-change="saveState()"/>

            <label>Biography: </label>
            <textarea ng-model="model.biography" ng-change="saveState()"></textarea>




September 2, 2015

ASP.NET MVC has been touted as the industry-standard way to put together a web application for years now, at least in the Microsoft shops. It is becoming a pretty mature framework within which to build websites and web applications and is still much sexier-sounding than web forms.

I recently saw a question on HackerNews about this: Ask HN: After 20 years of programming, what do I do now?

They want to refactor their career and pick up newer and hotter skills. This person doesn't want to lose ground on salary, on seniority or gamble too much on new technology. This is a respectable stance for someone who has been doing what they do for so long.

The Human Resources Barrier

I started out in web forms myself, but as a very junior developer it was much easier for me to make the transition into an MVC job because I did not have the same salary requirements as someone with decades of experience. It's much less of a gamble for me and for the hiring party. I could convince an MVC shop to hire me based on my potential and my passionate attitude.

A senior developer is in a tenuous situation if they are uncomfortable about the longevity of the skills or technologies that make them senior. It is also true that if you're looking to make the switch, many companies have checklist knockout questions which look to eliminate people without 'X years of experience in Y technology'. While this is stupid, it is still the case.

I thought about this for a bit and recognized a pattern I have seen and see still. I answered with this:

I definitely do not have the level of experience that you have so take this with a grain of salt. I have seen and worked in a lot of companies that have a very heavy portion of their code base in web forms. Many of these companies have been working to transition to MVC but it takes a longer time the larger your legacy beast is.
I would suggest finding a job where you can leverage your experience in .NET Web Forms, while picking up the pedigree for MVC.

Find a hybrid job

Really, anything in your skillset that you can leverage to gain you that professional experience will work. Once you have the professional record, HR departments won't really be a problem for you anymore.

It might be a slight pay cut or less glorious work, but it would be a stepping stone. It would be an incremental and safe move toward relevance.

As an employer, consider hiring one of these people

I think it would be very important for someone looking to make the switch to really push how valuable their experience in the legacy technology would be. They can be invaluable in navigating the bogs and swamps of legacy code if they’ve seen a decade of varied use.

To that point, if you’re in the position to hire someone in this situation, I implore you to consider it seriously. This person recognizes the need to gain new skills and can make the transition a bit less scary because they know the old, hairy stuff better than most.

Possibilities presented in the thread include:

  • Securing short contracts with companies building basic MVC applications (CRUD)
  • Leverage your experience in other technologies and processes to secure a hybrid job
  • Start your own company and do some freelance work for local businesses
  • Attend a developer boot camp as they will often help place you
  • Blog about your learning and contribute to open source (Be public)
  • Get a job through the side door, network with people you want to work with

Best of luck

I hope you found this article useful in some way. Please let me know if you have any other ideas or if you have made the switch yourself and how you did it.