Class — Object-Oriented Programming Reference
Quick-reference skill for OOP concepts, class design, SOLID principles, and common design patterns.
When to Use
- - Designing class hierarchies and choosing inheritance vs composition
- Applying SOLID principles to refactor code
- Understanding polymorphism, encapsulation, and abstraction
- Choosing the right design pattern for a problem
- Comparing OOP across languages (Java, Python, TypeScript, C++)
Commands
intro
CODEBLOCK0
OOP fundamentals — classes, objects, the four pillars.
solid
CODEBLOCK1
SOLID principles — SRP, OCP, LSP, ISP, DIP explained with examples.
inheritance
CODEBLOCK2
Inheritance vs composition — when to use each, diamond problem, mixins.
patterns
CODEBLOCK3
Essential design patterns — Factory, Strategy, Observer, Singleton, Builder.
access
CODEBLOCK4
Access modifiers and encapsulation — public, private, protected across languages.
abstract
CODEBLOCK5
Abstract classes, interfaces, and protocols — contracts and polymorphism.
pitfalls
CODEBLOCK6
Common OOP pitfalls — God class, deep hierarchies, over-engineering.
comparison
CODEBLOCK7
OOP across languages — Java, Python, TypeScript, Go, Rust.
help
CODEBLOCK8
version
CODEBLOCK9
Configuration
| Variable | Description |
|---|
| INLINECODE10 | Data directory (default: ~/.class/) |
Powered by BytesAgain | bytesagain.com | hello@bytesagain.com
类——面向对象编程参考
面向对象编程概念、类设计、SOLID原则及常见设计模式的快速参考技能。
使用场景
- - 设计类层次结构,选择继承与组合
- 应用SOLID原则重构代码
- 理解多态、封装和抽象
- 为问题选择合适的设计模式
- 跨语言(Java、Python、TypeScript、C++)比较OOP
命令
intro
bash
scripts/script.sh intro
OOP基础——类、对象、四大支柱。
solid
bash
scripts/script.sh solid
SOLID原则——通过示例解释单一职责原则、开闭原则、里氏替换原则、接口隔离原则、依赖倒置原则。
inheritance
bash
scripts/script.sh inheritance
继承与组合——何时使用每种方式、菱形问题、混入。
patterns
bash
scripts/script.sh patterns
基本设计模式——工厂模式、策略模式、观察者模式、单例模式、建造者模式。
access
bash
scripts/script.sh access
访问修饰符与封装——跨语言的public、private、protected。
abstract
bash
scripts/script.sh abstract
抽象类、接口和协议——契约与多态。
pitfalls
bash
scripts/script.sh pitfalls
常见OOP陷阱——上帝类、深层层次结构、过度设计。
comparison
bash
scripts/script.sh comparison
跨语言OOP——Java、Python、TypeScript、Go、Rust。
help
bash
scripts/script.sh help
version
bash
scripts/script.sh version
配置
| 变量 | 描述 |
|---|
| CLASS_DIR | 数据目录(默认:~/.class/) |
由BytesAgain提供 | bytesagain.com | hello@bytesagain.com