This article is the note of a online course I plan to learn this year. The content is what I need as a complementary to my day to day work - how to design and write good code(the thoughts and practices, in my daily work, you need to either read some good code from your company code base or some famous project, however, we only know how to write, we do not know why and the logic behind it). From the table of content I regard it as a helpful recourse for those who want write lean code, as well as the people who want to learn design pattern, and perform well in such interviews.
Object oriented
Object oriented has many characteristics(encapsulation, inheritance, polymorphism, abstract), they the basic for some complex design patterns
- Four characteristic for OO: encapsulation, inheritance, polymorphism, abstract
- The difference of object oriented and procedure oriented
- OO analysis, OO design, OO programming
- Difference of interface and abstract class, and when to use them
- Programming based on interface rather than implementation
- Use compose rather than inheritance;
- Procedure oriented - domain model, anaemic domain model, rich domain model
Design principle
Design principles are the philosophy of building code.(Vague and abstract).
SOLID principles:
- SRP
- OCP
- LSP
- ISP
- DIP
- DRY, KISS, YAGNI, LOD
Design Pattern
Design patterns are solutions to some particular scenario/questions, they a some standard solutions to some problems.(Most likely extendability)
-
Creation type
- Used more: Singleton pattern, factory pattern(single && abstract), builder pattern
- Used less: prototype pattern
-
Structure type
- Used more: Proxy pattern, bridge pattern, decorator pattern, adaptor pattern
- Used less: Facade pattern, compose pattern, Flyweight pattern
-
Behavior type
- Used more: Observer pattern, templated pattern, strategy pattern, Chain of Responsibility Pattern, Iterator patter, stage pattern;
- Used less: Visitor pattern, memo pattern, command patter, explainer pattern, agent pattern
Coding rules and refactoring
Coding rules how should we write clean code, preventing the readability issue.
Refactoring, based on the previous principles/patterns, we refactor the code to mitigate some issues generated by code over time.
- The tools we used for refactoring is the OOD thinking, design principles, design patterns…
- Why, what, when, how
- The way of keep refactoring works: unit test and testability
- Big scale vs small scale refactor
Object oriented has many characteristics(encapsulation, inheritance, polymorphism, abstract), they the basic for some complex design patterns
Design principles are the philosophy of building code.(Vague and abstract)
Design patterns are solutions to some particular scenario/questions;
Coding rules how should we write clean code, prevent the readability issue.
Refactoring, based on the previous principles/patterns, we refactor the code to mitigate some issues generated by code with time.