This Week Reads

Advanced Features with Azure Service Bus

High level overview of advanced features, from Session & FIFO, Auto Forwarding, Scheduling, Deferred, Duplicate detection to high availability and disaster recovery.


Strangler pattern

If you ask me, I think it’s not much of an architecture pattern, but more of migration strategy. Especially useful to migrate from legacy to modern application. It’s worth the read.


10 Important Git Commands that Every Developer Should Know

If you’re new to Git, this is a good start. The 10 important (and also most commonly used) Git commands. If you’re Git veteran, it’s also a good refresher.


Move petabytes of data with resilience – Azure Data Factory adds resume support!

It’s encouraging to learn how far Azure Data Factory has come. It now has support for resuming the pipeline when it fails. The resume will only run from the point where it failed.


How a Kaggle Grandmaster cheated in $25,000 AI contest with hidden code

Cheater is going to get caught eventually. This is an entertaining story to read about cheating in machine learning competition.


Monday Reading List

Blazor Server in .NET Core 3.0 scenarios and performance

Have heard about Blazor? If not, definitely check this post out. For those who already use Blazor, you can skip. Unless you also want to understand the inner working of Blazor.


Everything you need to know about resource tagging in Azure

Azure has feature to tag your resources for some times now. But, how do you use it the right way? This post will explain.


Javascript – Does taking a callback make a function asynchronous?

Interesting question and could be one of those questions as well. The answer is: it depends. Do read more to understand the details.


The Mediator Pattern In .NET Core – Part 1 – What’s A Mediator?

I came across Mediator pattern and has since been intrigue by it. This post will explain what’s it and why do you need it.


How C# 8 Helps Software Quality

The essence of writing codes is not _just_ for computer to interpret and run it. Equally, if not more, importantly is for human to understand and maintain it. C# 8 features will help to do just this by increasing the quality.


Tuesday Reading List

5 questions everyone should ask about microservices

Thinking about building microservices architecture? Or plan to break your currently monolith application into microservices? These are definitely the 5 questions you want to get answers before you start microservices journey.


Boost 10x UI development productivity with SDD

SDD, what? This is something new to me. It’s Showcase Driven Development. Mostly for UI to help with designing and building UI, promote early testing in UI as well as collaboration between designer, developer and testers. Pretty cool concept.


Our team’s troubles with hand-written automated UI tests

Everyone is probably going to agree with you when you say automatic UI testing is imperative. But, it comes with challenges. Steven laid out questions and considerations you ought to think about when writing UI testing. They key is: right balance (don’t over do it) and fill out the test pyramid.


Advanced versioning in ASP.Net Core Web API

Every API endpoint needs a version and ASP.Net Core makes it easy to add one. Read this guideline on how to use versioning in ASP.Net Core Web API.
The kinda-bad thing is, you have to create a free account or login, in order to read the full article.


The Dataflow Pattern in .NET

https://www.dotnetcurry.com/patterns-practices/1412/dataflow-pattern-csharp-dotnet
https://en.wikipedia.org/wiki/Dataflow_programming
https://docs.microsoft.com/en-us/dotnet/standard/parallel-programming/dataflow-task-parallel-library

A refresher on how Dataflow pattern works. Dataflow pattern is used in Task parallel library in .NET and dataflow programming is the concept behind functional programming. It’s a different approach to well-known object oriented programming where data is at rest. In functional programming, data is the one moving, which makes state sorta-obsolete.


This Week Reading List

Want to learn any programming language? — Write These 3 Simple Apps!

https://medium.com/@samuel.fare/want-to-learn-any-programming-language-write-these-3-simple-apps-5af8cd119921

Very good read if you want to learn new programming langugage. Sam Fare challenges you to build 3 simple apps with a new programming langauge: Hello World, Anagram and Pizza app. I’ll throw in one more as a bonus: a Todo app.

 


How to Become a Better Software Developer by Digging & Climbing

https://dmitripavlutin.com/become-better-software-developer-digging-climbing/

Even if you are an experienced developer, it’s still a very good read. Dmitri shares what he did to become a better developer (and we always have room to become a better developer). It’s a conceptual idea, which is why it’s a very good read, with some practical examples.

 


Event-driven analytics with Azure Data Lake Storage Gen2

https://azure.microsoft.com/en-us/blog/event-driven-analytics-with-azure-data-lake-storage-gen2/

If you are dealing with big data, the ingestion, processing, storage, consumption and ETL stuff, add this to your reading list. It outlines a way to use event-driven technique using Azure services to build data for analytics.

 


Azure solution architectures

https://azure.microsoft.com/en-us/solutions/architecture/

One of my favorites. This is more of a reference than a reading. Microsoft docs provides cloud architecture solutions (based on Azure services) for different scenarios and needs. Definitely check it out when you need to design and build a new system.

 


The Azure Infrastructure Architect Map

https://techcommunity.microsoft.com/t5/Azure-Developer-Community-Blog/The-Azure-Infrastructure-Architect-Map/ba-p/766268

Yet another good resource for a reference. This guides you through way-too-many Azure services based on your needs, sorta help you to decide what Azure service to use for a specific scenario. There’s also Solution Architect map and Security Architect map. Links are in the article.

 


Pipeline Pattern Implementations in C# .NET – Part 1

https://michaelscodingspot.com/pipeline-pattern-implementations-csharp/

Part 1 of 2 where Michael explains how to implement pipeline pattern in C#. This is not about `System.IO.Pipelines` library, but rather,
Part 2 – https://michaelscodingspot.com/pipeline-pattern-tpl-dataflow/

Monday Reading List

Learn how you can use GraphQL in .NET Core and C#

Don’t worry if you don’t know what GraphQL is, this article introduces the basic of GraphQL and went further on how to use it in .NET Core. The NuGet package used allows you to expose C# class as query-able Graph API.

 


After Your Talk 🗣: The Power 💪 of Leverage

If you’re into giving a talk kinda guy, you definitely should follow Jeremy Likness. He has lots of tips and tricks from how you get started to how to engage your audiences after the talk. This particular one is what you need to do after your talk. It’s part of the whole series of technical presentation guide.

 


Do-It-Yourself FAQ Bot

Super cool and fairly easy way to build FAQ chat bot. Chloe also built fake boyfriend app which link you can find in the article. This FAQ chat bot involves Azure Bot Services and Twilio.

 


10 OOP & SOLID Design Principles for writing Clean Code

After you have coded for a long time, it’s easy to forget the basic principles of OOP design. This article talks about how to write a clean code with OOP design pattern. Although example is in Java, the principles can be used in most languages. Some basic principles includes DRY, SOLID, Delegation, Program for Interface, etc.

 


Microfrontends: The Benefits of Microservices for Client-Side Development

The world has not moved on from Microservices yet, now there’s Microfrontends! It’s micro-app but for frontends. You can mesh Angular, Reach, Vue, jQuery and everything else into a single-SPA, isn’t that amazing? If that sounds terrible, there’s a reason why Microfrontends makes sense. Read on.

 


5 Steps in Programming to Keep You From Getting Stuck

Everyone stuck at a problem every once a while. But who knows talking to a duck can help? Yes!

Entity Framework, .Net and SQL Server Table Valued Parameter

This is step by step setup of using SQL Server TVP (Table Valued Parameter) in .Net application with EF (Entity Framework). In this example, I use SQL Server 2016 (SP2-CU3), .Net 4.5.1 and EF 6.20.

1. Create a table to store data.

CREATE TABLE [dbo].[Something] (
    [Id]            INT	IDENTITY(1,1)   NOT NULL,
    [Name]          VARCHAR(150)        NOT NULL,
    [Status]        CHAR(1)             NOT NULL,
    CONSTRAINT [PK_Something_Id] PRIMARY KEY CLUSTERED ([Id] ASC)
);
GO

2. Create `User Defined Table Type` in SQL Server. For simplicity, in this example the type’s columns are same as table I created on step 1. In real-world, the type’s columns could be significantly different than table where we store the data, it might even used for join with other tables.

CREATE TYPE [dbo].[udt_Something] AS TABLE (
	[Name]		VARCHAR(150)	NOT NULL,
	[Status]	CHAR(1)		NOT NULL,
);
GO

3. Create stored procedure to take parameter (of a `User Defined Table` type we created earlier) and perform necessary task to persist our data.

CREATE PROCEDURE [dbo].[sp_SaveSomething]
	@udt_Something [dbo].[udt_Something] READONLY
AS
BEGIN
    INSERT INTO [dbo].[Something]
        SELECT *
        FROM @udt_Something
END
GO

4. Create extension method to convert `IEnumerable<T>` object to a `DataTable` object. In order to use SQL TVP, we have to pass our parameter as a `DataTable`. This method will help convert our data to `DataTable` type.
Helper.cs

using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Reflection;

namespace QC
{
    public static class Helper
    {
        public static DataTable ToDataTable<T>(this IEnumerable<T> enumerable, IEnumerable<string> orderedColumnNames)
        {
            var dataTable = new DataTable();

            // Get all properties of the object
            PropertyInfo[] properties = typeof(T).GetProperties(BindingFlags.Public | BindingFlags.Instance);
            PropertyInfo[] readableProperties = properties.Where(w => w.CanRead).ToArray();

            // Get column
            var columnNames = (orderedColumnNames ?? readableProperties.Select(s => s.Name)).ToArray();

            // Add columns to data table
            foreach (string name in columnNames)
            {
                dataTable.Columns.Add(name, readableProperties.Single(s => s.Name.Equals(name)).PropertyType);
            }

            // Add rows to data table from object
            foreach (T obj in enumerable)
            {
                dataTable.Rows.Add(columnNames.Select(s => readableProperties.Single(s2 => s2.Name.Equals(s)).GetValue(obj)).ToArray());
            }

            return dataTable;
        }
    }
}

5. For the purpose of this example, let’s say we want to save a collection of objects. This is our object definition.
Something.cs

namespace QC
{
    public class Something
    {
        public int Id { get; set; }
        public string Name { get; set; }
        public string Status { get; set; }
    }
}

6. Using EF, called stored procedure we created and pass in `SqlParameter`, which is a collection of objects that we converted to `DataTable`. Don’t forget to specify parameter type as `User Defined Table Type`.
DataAccess.cs

using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

namespace QC
{
    public class DataAccess
    {
        public void Save(IEnumerable<Something> data)
        {
            // Columns for ordering, the order of the columns must be the same as user defined table type
            var orderedCols = new[] { "Name", "Status" };

            // SQL parameter to pass to stored procedure
            var param = new SqlParameter("@udt_Something", SqlDbType.Structured);
            param.Value = data.ToDataTable(orderedCols);
            param.TypeName = "dbo.udt_Something";

            try
            {
                // QCDB is our EF entities
                using (var db = new QCDB())
                {
                    // Call stored procedure and pass in table valued parameter
                    db.Database.ExecuteSqlCommand("EXEC dbo.sp_SaveSomething @udt_Something", param);
                }
            }
            catch
            {
                throw;
            }
        }
    }
}

7. Example of usage.
OpsController.cs

using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;

namespace QC
{
    public class OpsController : ApiController
    {
        public void SaveSomething()
        {
            var data = new List<Something>();
            data.Add(new Something { Id = 1, Name = "Chap", Status = "A" });
            data.Add(new Something { Id = 2, Name = "Stick", Status = "D" });

            var dataAccess = new DataAccess();
            dataAccess.Save(data);
        }
    }
}