Welcome to my blog!

Write Clean Code

October 6, 2018 23:01

Write Clean Code (edit)



Ternary Operator Example (? :)

return value = 10 ? true : false;

Null Coalescing Operator Example (??)

return artist ?? new Artist() {};

Prefer String interpolation

string temp = $"Name: {name}, Age: {age}";

Use expression bodied Methods

public string GetMessage() => return "Hello World";
public string Name => "Afzaal Ahmad Zeeshan"; 

A few things you should know prior to reading this guide:

  1. Improvements to C# that were made in its 6th version
  2. LINQ in .NET framework
  3. Asynchronous programming and Task object in C#
  4. Unsafe programming in C#, which allows you to go into memory management

Curly braces + Check null

public void Draw(Shape shape)
    if (shape == null)
        throw new ArgumentNullException("shape");

Tips & Tricks

October 3, 2018 16:24

Tips & Tricks (edit)

inurl: tips-tricks


T3 Templates


T4 Templates



Dapper By Eample


Generate SQL script (.SQL) from XML Schema (.XSD)





OOP in JavaScript

  • Work effectively with JavaScript
  • JavaScript Built-in Functions
  • Prototype-based OOP
  • Class-based OOP
  • Pseudo-classes
  • Pseudo-elements


In JavaScript, almost "everything" is an object.

  • Booleans can be objects (if defined with the new keyword)
  • Numbers can be objects (if defined with the new keyword)
  • Strings can be objects (if defined with the new keyword)
  • Dates are always objects
  • Maths are always objects
  • Regular expressions are always objects
  • Arrays are always objects
  • Functions are always objects
  • Objects are always objects

All JavaScript values, except primitives, are objects.

JavaScript defines 5 types of primitive data types:

  • string
  • number
  • boolean
  • null
  • undefined

Built-in methods

var message = "Hello world!";
var x = message.toUpperCase();

Adding a Method to an Object

person.name = function () {
return this.firstName + " " + this.lastName;

Prototype-based OOP

var genericAnimal = Object.create(null);

genericAnimal.name = 'Animal';

Class-based OOP

function Person(name) { ... }

var adam = new Person('Adam');


Recent posts