1
00:00:02,120 --> 00:00:04,490
So what are programming paradigms?

2
00:00:04,490 --> 00:00:07,020
That's of course important to understand.

3
00:00:07,040 --> 00:00:10,430
In the end you could say it's just a way of writing code,

4
00:00:10,430 --> 00:00:14,050
it's about how you write and organize your code.

5
00:00:14,060 --> 00:00:20,020
It's not a syntax feature, it's not a special feature exposed by the browser or anything like this,

6
00:00:20,030 --> 00:00:26,660
it's really just how you structure your code and how you reason about your program you're writing,

7
00:00:26,660 --> 00:00:32,390
so how your code is organized and in the end there are three paradigms you could follow.

8
00:00:32,390 --> 00:00:34,930
You have object oriented programming,

9
00:00:35,030 --> 00:00:39,140
you have procedural programming and you have functional programming.

10
00:00:39,140 --> 00:00:40,540
Now what does this mean?

11
00:00:40,820 --> 00:00:47,750
If you're writing your code in an object oriented style, it means that you organize your data and logic

12
00:00:47,870 --> 00:00:55,670
in objects or in classes and then in objects based on those classes, which means you store your data

13
00:00:55,700 --> 00:01:01,610
in properties of objects, you store your logic in methods of objects,

14
00:01:01,610 --> 00:01:04,990
that's how you typically think about your code here,

15
00:01:05,000 --> 00:01:12,080
everything in your application, in your project gets represented as a class and then in the end, as an

16
00:01:12,080 --> 00:01:13,140
object.

17
00:01:13,250 --> 00:01:20,700
So you organize who code in logical entities you could say, you kind of try to translate the application you're

18
00:01:20,720 --> 00:01:27,230
writing into the real world and you think about your application and the things that make up your application

19
00:01:27,560 --> 00:01:29,770
in real world terms.

20
00:01:29,810 --> 00:01:35,560
If you're building a shop application, you think about products and a shopping cart and so on,

21
00:01:35,570 --> 00:01:38,990
that's how you think about your code and how you organize it.

22
00:01:39,500 --> 00:01:45,710
Now when you're following a procedural style and that's probably the style with which you got started

23
00:01:45,740 --> 00:01:52,880
when work with Javascript, you simply write a sequential series of execution steps and tasks,

24
00:01:52,880 --> 00:01:58,850
so you have a top to bottom code execution you could say. Now you always have that in every style

25
00:01:58,910 --> 00:02:06,080
but here you simply list these different steps the engine in the end should execute and should perform,

26
00:02:06,110 --> 00:02:12,110
you don't organize your code in logical groups or in logical pieces of data,

27
00:02:12,110 --> 00:02:18,860
you don't use objects and entities to structure your code, in the end you just execute step after step.

28
00:02:19,250 --> 00:02:26,480
And then we have functional programming and there, we organize our code in, if possible, pure functions

29
00:02:26,630 --> 00:02:28,830
with clearly defined tasks.

30
00:02:28,850 --> 00:02:35,480
You get all the data a function needs as parameters and then this function often also return something

31
00:02:35,480 --> 00:02:35,840
new,

32
00:02:35,990 --> 00:02:42,690
so you pass data around with parameters and your functions are your way of organizing your code.

33
00:02:42,710 --> 00:02:48,110
You have many functions, probably more than you have in the other styles and your functions hold your

34
00:02:48,110 --> 00:02:51,370
logic, every function if possible works on its own

35
00:02:51,500 --> 00:02:53,870
and this is how you structure your code.

36
00:02:53,870 --> 00:02:55,160
Now that's the theory,

37
00:02:55,190 --> 00:02:59,560
it of course becomes way clearer if we see that on a real example.
