Skip to content

Commit 9ef86d0

Browse files
committed
Add talk about Programming Accross Paradigms
1 parent cee1a79 commit 9ef86d0

File tree

2 files changed

+124
-0
lines changed

2 files changed

+124
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ If you are interested in the books I read, [follow me in Goodreads](https://www.
3939
* [How to Make a Sandwich](talks/how-to-make-a-sandwich.md) by **Dan North**, 2016.
4040
* [Mastering Chaos: A Netflix Guide to Microservices](talks/mastering-chaos-a-netflix-guide-to-microservices.md) by **Josh Evans**, 2017.
4141
* [Probabilistic Data Structures](talks/probabilistic-data-structures.md) by **James Stanier**, 2016.
42+
* [Programming Across Paradigms](talks/programming-accross-paradigms.md) by **Anjana Vakil**, 2017.
4243
* [Refactoring, from good to great](talks/refactoring-from-good-to-great.md) by **Ben Orenstein**, 2012.
4344
* [Rethinking the developer career path](talks/rethinking-the-developer-career-path.md) by **Randall Koutnik**, 2017.
4445
* [TDD, where did it all go wrong](talks/tdd-where-did-it-all-go-wrong.md) by **Ian Cooper**, 2013.
Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,123 @@
1+
# [Programming Across Paradigms](https://www.youtube.com/watch?v=Pg3UeB-5FdA)
2+
3+
The paradigms of Programming, Robert W. Floyd Stanford University Turing Award Lecture
4+
5+
> I believe the chance we have to improve the general practice programming is to attend our paradigms – Robert W. Floyd
6+
7+
## What is a paradigm?
8+
9+
Philosophy, "The Structure of Scientific Revolutions". A paradigm is a worldview, how do we observe the universe, a model. A paradigm enables progress. **Unless we agree onto something is very difficult to progress as a community.**
10+
11+
> In learning a paradigm the scientists acquires theory, methods, and standards together, usually in an inextricable mixture – Tomas S. Kuhn
12+
13+
What entities make up the universe how they behave and interact. What makes up a program? Which problems are worth solving which solutions are legitimate. Which problems we need to define as programmers? Which programs are the good ones?
14+
15+
> All models are wrong – George E. P. Box
16+
17+
`paradigm -> anomaly -> crisis -> shift -> paradigm...`
18+
19+
Ptolomeo model on the universe (earth at the center) was superseeded with Copernicus model (sun at the center) which was superseeded by the Newton model, and then Albert Einstein, etc.
20+
21+
## Major paradigms?
22+
23+
### Imperative programming
24+
25+
**Follow my commands, in the order I give them. Remember state.**
26+
27+
_It's like a complex clock, you need lots of precision._
28+
29+
This paradigm requires so much precision that a single issue can bring the entire thing down.
30+
31+
### Object-Oriented programming
32+
33+
**Keep your state to yourself. Receive messages. Respond as you see fit.**
34+
35+
It is still imperative, but at least these are handled in smaller chunks. Objects have little pieces of state. Everything is about the messages and relationships between them.
36+
37+
_It's like biological stem cells in a body. A cell in a larger tissue. Every stell have their own organs and pieces. They have receptors in the membrane, receiving messages from the outside_
38+
39+
40+
### Functional programing
41+
42+
The solution to the problem with rigidity of imperative programming.
43+
44+
**Mutable state is dangerous. Pure functions are safe. Data goes in, data comes out.**
45+
46+
_This is like a factory. Where we have like an assembly line were we transform materials into different stages until we get a car._
47+
48+
### Declarative programming
49+
50+
Functional programming falls under a broader umbrella called Declarative Programming.
51+
52+
**These are the facts. This is what I want. I don't care how you do it.**
53+
54+
_This is like a puzzle, a sudoku, where you have these rules about the game. It doesn't matter how you place numbers in it._
55+
56+
SQL is a declarative language. A subparadigm of declarative programing is Logic Programming and Prolog for example.
57+
58+
## What do they have in common?
59+
60+
It looks like there is massive rivalry between Object-Oriented Programming and Fucntional programming? Is there anything in common?
61+
62+
They are both trying to solve the rigidity and the complexity of imperative style programming. They try to tackle shared mutable state. Functional programming just removes the problem by making data immutable, OOP solved it creating small chunks of data.
63+
64+
> I'm sorry that I long ago coined the term "objects" for this topic because it gets many people to focus on the lesser idea. The big idea is "messaging" – Alan Kay
65+
66+
`thing.do(some, stuff)`
67+
68+
`thing` is the recipient
69+
70+
`do` is the message with `some` and `stuff` as arguments.
71+
72+
73+
```python
74+
buddy.is_friend_of('guy')
75+
76+
buddy.send('is_friend_of', 'guy')
77+
78+
buddy('is_friend_of', 'guy')
79+
```
80+
81+
We can do this with closures instead of Classes so it becomes functional. So we will have the same behaviour than with OOP. Is it fuctional or object-oriented? Depends on your worldview or mindset!
82+
83+
## Which paradigm is the best?
84+
85+
> All models are wrong **but some are useful** – George E. P. Box
86+
87+
Paradigms are useful in different ways. Newton model still works and Albert Einstein also works for other things.
88+
89+
> Each paradigm supports a set of concepts that makes it the best for a certain kind of problem – Peter Van Roy
90+
91+
Maybe we can match our problem with the best paradigm to solve it.
92+
93+
> We shouldn't ask if the model is **true**, but more on if the model is **illuminating and useful** – George E. P. Box
94+
95+
Maybe changing a paradigm will make our problem easier to solve.
96+
97+
## What can a paradigm teach me?
98+
99+
**Imperative programing**: Be explicit, understand the implementation. Forces you to think how to optimise these little details.
100+
101+
**Declarative programming**: Be abstract, understand the domain. To think in the big picture ideas, and not how to implement them. We can change the implementation but the big picture remains the same.
102+
103+
**Object Oriented Programming and Functional Programming**: Encapsulate and communicate. Sometimes we can take advantage of Object Oriented Programming to encapsualte behaviour.
104+
105+
**Functional Programming**: Specialise, transform data. Functional programming can make a convoluted situation an easy task to solve.
106+
107+
---
108+
109+
**No paradigm is best absolutely, each is best for a certain case.**
110+
111+
A set concepts that match very well with a set of problems.
112+
113+
> If the advancement of the general art of programming requires the continuing invention and elaboration of paradigms, advancement of the art of the individual programmer requires that they expand their repertory of paradigms – Robert W. Floyd
114+
115+
As individuals we need to get comfortable with as many paradigms as possible, to have more tools in our toolbox.
116+
117+
**Learn new paradadigms, try multi-paradigm languages.**
118+
119+
## What's the point?
120+
121+
Paradigms enable programming, as they paradigms enable scientific progress. Not only about the entities that defines the problems, but also the problems we can solve.
122+
123+
Don't fight your paradigm, embrace it. Be often to shift when anomalies arise. Attend to your paradigms.

0 commit comments

Comments
 (0)