Skip to main content

28 docs tagged with "oop"

View all tags

Class basics

In this chapter, you learn the basics of how to write classes in TypeScript.

Decorator — A Pattern Distinct from TC39 Decorators

Despite the shared name, GoF's Decorator pattern and TypeScript's Decorators syntax are different concepts. This chapter separates the two, then compares the pattern with composition through higher-order functions.

PHPクラス設計ガイド

PHP でクラス設計そのものを入門から実践まで学ぶ全14章のガイド。フレームワーク非依存の設計原則 (カプセル化・単一責任・継承とコンポジション・インターフェース・SOLID) から、Laravel でのモデル/サービスクラス設計まで一気通貫で扱います。

PHPのクラス基本文法

PHPにおけるクラスの基本文法。プロパティ・メソッド・コンストラクタ・可視性修飾子・readonly・コンストラクタプロモーション・enumを解説します。

Singleton — How Far a Module's Single Instance Reaches

An ES module is evaluated only once as long as it resolves to the same URL, so you get a single instance without writing a Singleton class. This chapter maps how far that guarantee reaches and when you still need another approach.

Strategy — Functions Being First-Class

If all you do is swap behavior, passing a function is enough. What still makes you want to bundle things into an object is a strategy that carries several methods or state.

TypeScript Design Patterns

A 16-chapter guide that rereads the 23 GoF patterns in modern TypeScript. Each chapter judges whether language features can replace the pattern, and lays out the conditions under which writing it as a class still pays off.

デザインパターン — 4 つの代表パターンと語彙

Strategy・Singleton・Observer・Abstract Factory の 4 パターンを、それぞれが解こうとした問題から解説します。Strategy と State、Observer とポーリング、Abstract Factory と Factory Method といった混同されやすい組み合わせの区別を扱います。

凝集度・結合度とSOLID原則の総整理

第1部の集大成として、開放閉鎖・リスコフ置換・インターフェース分離の原則を補い、凝集度と結合度という物差しでこれまでの原則を振り返ります。

単一責任の原則

単一責任の原則とクラスを小さく保つ考え方。god classの兆候と、責務分割の実例を解説します。