Basics On Programming Paradigms
- The ideas that programs are a sense of functions
- Goes from top to bottom
- Relies heavily on global state, but any line can change the global state
- C being a procedural language
- "Imperative" execution
- Easy to write, difficult to maintain
- Prone to difficult bugs
- Based around a Primitive: object
- Objects have well defined interfaces
- Localised behaviour
- Objects control state
- Code is still imperative - pro AND con! - Still telling the computer EXACTLY what to do.
- Can be more verbose
- Describing what you want to happen, but not telling the computer how to do it
- Eg. SQL, Regex, HTML
- Data is self-describing
- As powerful as the interpreter allows
- As limiting as the interpreter allows - You want build a game in SQL etc.
- What we want to happen but not how
- Little state
- Few side effects
- Easy to reason about
- Works great with OO
- Basis in higher math
- Cons to think differently
- Not always the best choice
- No loops, no control logic - Just telling it what we want to happen
- Primitive: Observable
- Instead of describing data in terms of other data, we describe it in terms of streams of events - From this, we create a pipeline such that we certain data changes, a lot is processed and changed - Example: spreadsheets!
- Data flows unidirectionally
- Tough to think differently
- Subscriptions help change the data
1,200+ PEOPLE ALREADY JOINED ❤️️
Get fresh posts + news direct to your inbox.
No spam. We only send you relevant content.