OJ Develops

Thoughts on software development. .NET | C# | Azure

Design Pattern Spotlight: Adapter Pattern

02 June 2016

The Adapter Pattern's intent is "convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces" (taken from the Design Patterns book). That statement seems intimidating at first, but the core concept is really simple. In fact, I won't be surprised if you are already using this pattern in your application. Let's talk more about it below.

Read More

Some Tips on Organizing Code

23 May 2016

One of the signposts pointing to clean code is well-organized code files. Contrary to popular belief, aesthetics and organization are important when it comes to writing code, because having organized and structured code improves readability. A piece of code written once will get read multiple times, so it's worth the time to put a little more effort into improving the code's readability. In this post I will be sharing some tips on how to make more organized and readable.

Read More

Converting JSON Data Into C# Objects

12 May 2016

There are times when we would need to convert JSON string data into C# objects. An example would be when consuming some Web API that returns JSON data. Although we can work with the JSON string data directly, it would be much nicer if we could somehow convert the data into an object, so that we can work with them more easily. In this post we will talk about how to do this.

Read More

Libraries and Frameworks

09 May 2016

Today we are going to take a look at libraries and frameworks. We will describe each of them and take a look at some examples for each. We will also take a look at a practical example of how being able to distinguish between the two will help us in our daily coding.

Read More

Why Use ViewModels?

02 May 2016

Let's talk about a simple but important topic - why use viewmodels in our web applications. Specifically, the kind of viewmodels that we will be talking about are the ones that are used as parameters or return values in controllers.

Read More

Introduction to Dependency Injection - Part 2

28 April 2016

In the last post I gave an introduction to dependency injection, where I described what it is, how it can be achieved, and the motivation behind it. We left off by providing an example in an ASP.NET MVC controller, where we manually "newed up" dependencies inside the constructor of a controller. In this post we will take a look at dependency injection frameworks and see how they can help us manage dependencies.

Read More

Introduction to Dependency Injection - Part 1

25 April 2016

The concept of dependency injection has been around for a long time. But now that dependency injection is baked into ASP.NET Core 1.0, I thought it would be a good time to write about what it is and why and how we can take advantage of it.

Read More