import { CodeSurfer, CodeSurferColumns, Step, } from "code-surfer"; import { comic } from '@mdx-deck/themes' import { nightOwl, github } from "@code-surfer/themes";
export const theme = github;
etc.
<img style={{ height: '80%' }} src="https://firebasestorage.googleapis.com/v0/b/programming-paradigm.appspot.com/o/why-programming-paradigm.png?alt=media&token=0eb5ebf8-72af-4bc7-8e3f-39078e9fa9e2" alt="why-programming-paradigm" />
- follow my commands
- in the order I give them
- remember state
- these are the facts
- this is what I want
- I do not care how you do it
const Button = () => (
<button
style={{
fontSize: 16,
color: "black"
}}
>
Click Me!
</button>
);SELECT isbn,
title,
price,
price * 0.06 AS sales_tax
FROM Book
WHERE price > 100.00
ORDER BY title;- Encapsulation
- Inheritance
- Polymorphism
- Make the code easy to change and maintain.
- Properties to be hidden can be specified easily.
- MVC
- Components or Custom Hooks
- Reusability
- Code modification
- Extensibility
<CodeSurferColumns themes={[github, nightOwl]}>
<CodeSurferColumns themes={[github, nightOwl]}>
The big idea is "messaging".
Alan Kay
- keep your state to yourself
- receive my messages
- respond as you see fit
- S — Single Responsibility (單一職責原則)
- O — Open-Closed (開閉原則)
- L — Liskov Substitution (里氏替換原則)
- I — Interface Segregation
- D — Dependency Inversion
-
Single Responsibility (Separate behaviours)
-
Open-Closed (Extend behaviour without changing behaviour)
-
Liskov Substitution (Enforce consistency)
<CodeSurferColumns themes={[github, nightOwl]}>
<CodeSurferColumns themes={[github, nightOwl]}>
- Functions
Functions
- Pure functions
- Immutability
- Declarative programming
- Changing a variable, property, or data structure globally
- Changing the original value of a function’s argument
- Send network request
- Throwing an exception, unless it’s caught within the same function
- Printing to the screen or logging<CodeSurferColumns themes={[github, nightOwl]}>
- Pure functions
- Immutability
- Declarative programming
- mutable state is dangerous
- pure functions are safe
- data goes in data comes out
<CodeSurferColumns themes={[github, nightOwl]}>
- don’t fight your paradigm, embrace it
- paradigm is your tool, not your goal
References:




