Blog
Mert Özen's blog posts on software development, backend, frontend, and DevOps.
Static Members, Static Classes and Extension Methods in C#
Static fields and methods that belong to the type, the absence of this in static methods, const versus static readonly and when the static constructor runs, static classes, an ISBN-validating extension method, the rules of extensions and the threading trap of shared static state.
Encapsulation and Access Modifiers in C#: public, private, protected, internal
Why a get-only List property protects nothing, keeping invariants inside the object, IReadOnlyList versus AsReadOnly, the six access modifiers and their defaults, private belonging to the type, and the assembly boundary with internal and InternalsVisibleTo.
Fields, Properties and Constructors in C#: Building Objects Right
The parameterless constructor that disappears once you write your own, private and readonly fields, a validating property, auto-properties, get-only, private set, init and computed properties, constructor chaining and the order in which initializers run.
Classes and Objects in C#: Writing Your First Own Type
A class is a recipe, an object is what it produces in memory. The first Book class with fields and methods, this, what being a reference type means, identity comparison with ==, null and NullReferenceException, and how classes are laid out in files and namespaces.
JavaScript OOP Patterns: Inheritance or Composition? Factory Functions and Mixins
We talk about the cost of inheritance, combining behavior with composition, factory functions and mixins, choosing between closures and #private, the SOLID principles that fit JavaScript, and when a class is worth writing.
JavaScript Classes: Constructor, Getters/Setters, Static and Private Fields
We build class syntax with a cookie-cutter analogy and work through constructors, getters/setters, static members, # private fields, extends and super, then see that a class is really prototypes underneath.