I need a blog - so why not build one?

I thought it would be good to share my journey of learning to develop web applications with my own blog but how best to put one together?

I have previously used WordPress and Blogger so am familiar with how blogs work but, if I want to learn how to create websites, the logical way forward is to create a blog from scratch.

Armed with Visual Studio 2017, a domain and database, I began.

Spoiler alert

As you are reading this on my blog, I obviously succeeded, but there were many challenges along the way.

What I realised is that, to write good code, knowing the syntax, data structures and algorithms is not enough, you also need to know about the quirks of a programming environment - those aspects of writing a program which should work but don't!

ASP.NET MVC is full of these issues and I can understand why so many employers want coders with experience.

For example, the parameters for HtmlAttributes of


are different to the HtmlAttributes parameters of


and most of the other Html Helpers. This means, when you change one to the other, you need to change these parameters, otherwise they won't render correctly.

@Html.EditorFor(model => model.blog.PublishDate,
    new {htmlAttributes = new { @class = "form-control" }})

@Html.TextBoxFor(model => model.blog.PublishDate,
    new {@class = "form-control" }})

Notice how the second parameter has changed between the two. The reason? I haven't yet seen a good one. EditorFor is one of the EditorExtensions and the others are InputExtensions, so there is a structural difference, but, as they are often used interchangeably, it is easy to confuse the two. If you do get them mixed up, the controls won't have the correct class and therefore won't render as they should.

Helpfully, there are lots of people who have come across these same issues and a quick internet search will find many solutions. My favourite place to search is StackOverFlow where a wealth of information is available.

In future blogs, I will detail some of the more annoying quirks I discovered and overcame.

If your code suddenly stops working or doesn't behave as you think it should, you too may have come across a quirk.

The good news is, you learn far more from these issues than when it's all going well.

I just wish they weren't so annoying!