Notes for myself: Procedura Programmingl: - Step by step instructions for tasks in sequential order. - Simple but has shortcomings; verbose, illegible, lengthy. - Hard to re-use the same code since you'd have to copy and paste. Object Oriented Programming: - Everything is based on objects, it delegates tasks into smaller chunks and put them into entities known as objects (this hides the logic in the objects); this concept known as encapsulation. - Easily reusable & maintainable since if something breaks, it's easier to find which object is breaking the program, as opposed to procedural where you'd have to find which line of code is breaking the program. - By hiding logic, we can abstract the complicated logic and only worry about how you interact with the objects, increasing readability. Functional Programming: - Functional programming DESCRIBES the logic using functions. To my understanding, the difference between OOP & FP is that OOP can abstract (hide) the logic, whereas FP presents the logic laid out as functions. - Everything relies on functions. It creates meaningful functions so that the code would be succinct, clearer and cleaner. - It's a very declaritive paradigm since it writes in pure functions; thus by reading the code you'll relatively easily understand the programmers intention Important notes: - An object is a collection of functions and data. A function is a collection of commands and data. - When a bunch of functions work together to perform a certain task we can call it an object.
At first I thought, "Hallelujah! He's actually going to give us some code examples of the differences". But then you spoiled it by not doing equivalents of exactly the same thing. It would have been much more helpful if you'd given the same real-world practical example in both procedural and object-oriented code, such as how to input the record of a new gym membership, for example
A better way to go about explaining this taxonomy would have been to say that procedural programming uses function calls rather than just doing everything inline (which would be referred to as an imperative style), and that functional programming expands on this by introducing concepts such as side effects, pure functions, higher-order functions etc. The two families at the top are imperative and procedural. Object oriented (not "orientated") and functional are offshoots from procedural. Purely imperative is not really a thing any more (luckily) and with a little luck we'll stop clinging to OO as well. For anyone who still clings to OO, I highly recommend Brian Wills videos on the topic.
I never get the idea between this stuff. Because for example in the functional example its still using the stuff you claimed to be OOP. And OOP is using procedural stuff. It always appers that there is no clear line between this stuff and people are essentially just being pedantic about things. Maybe i am wrong
short answer: OOP is about different objects communicating only necessary information with each other, while maintaining some privacy for themselves; FP is about being able to trace back everything that happens in the program by making functions that don't change anything outside of their scope with the exception of returning values; PP... I don't really know the major difference between PP and the other ones, just that it is basically the one concerned about the program itself lol.
So, is the difference just an added layer of abstraction? For instance, in procedural programming: for(a = 1; a < 5; a++){write-host a}. In functional programming, you encapsulate that loop in a function and make a function call - Increase(a), and in object-oriented languages, you take that same loop, and attach it as a method of an object, like DoLotsOfStuff.Increase(a)?
Wow that explanation was just too perfect for a beginner like me. Thank you. I have subscribed and I can't wait to learn more from your channel. Thank you once again :)
Welcome aboard! Looking forward to seeing you around here. Here's the full playlist of this series: ruclips.net/video/FNh2JCiFXIg/видео.html Hope you'll enjoy and any feedback is much appreciated!
I don't understand. In OOP you you call the log method inside the console object. "console.log()" Im FP you call the map() method which is inside the array object Where's the difference?
Thanks for pointing that out, for me procedural programming is similar to writing step by step instructions / procedures :) You're free to think of it as anything that you like, as long as it makes sense.
@@Acadeaio Also with OOP you write code step by step. With procedural you don't write code like assembler (your first example) but you use functions to wrap small tasks as you do in OOP as well where you use methods instead of functions (the are the same thing.)
Exactly. A better way to go about explaining would have been to say that procedural programming uses function calls rather than just doing everything inline (which could be referred to as an imperative style), and that functional programming expands on this by introducing concepts such as side effects, pure functions, higher-order functions etc. The two families at the top are imperative and procedural. Object oriented (not "orientated") and functional are offshoots from procedural. Purely imperative is not really a thing any more (luckily) and with a little luck we'll stop clinging to OO as well.
In your example of FP at the bottom, aren't you also showcasing the strengths of OOP? .map and .filter are encapsulating the same logic as your for loop method into some syntactic sugar. The same way you would hide that logic using OOP into either an ArrayFilter object or perhaps an extension method/utility class that extends the array datatype? This is part of why I find it hard to grasp why people often rally for FP and disparage OOP because in my mind they're both trying to solve the problem of encapsulating more complex logic and making more readable and easier to write code, no?
There are way more than three types of paradigm. You need some experience in different languages like Prolog, Forth, Smalltalk, Lisp, SQL and more. Procedural code didn't lead to object-oriented programming directly. It led to what was known as Structured Programming which addressed the issues inherent and Unstructured Programming. Procedural code is the opposite of Declarative code. And there are shades of gray in between. Object-oriented programming is such an overloaded term that is has lost almost all meaning. Different languages have very different object systems but you have to move out of the Java and C++ world to see it. CLOS in Lisp and Smalltalk's message passing would be good for you to experience. OOP doesn't require you to hide logic in objects. It simply requires that objects consist of attributes instead of working in something like parallel arrays with an index. JavaScript has elements of all of these because all of these things are styles to work within a programming language not things that define a programming language.
Good explanation. Question - doesn’t functional programming and OOP exist together? For example “fruits.map” uses OOP because “map” is a member function of the Array class. Also, Class methods can use functional style programming for their function bodies
Yes you are right. At the end of the day, FP and OOP are just programming styles/techniques. How your code will look like in the end is the one that makes the difference. Even though "map" is a (prototype) method of Array, it uses functional techniques and therefore we get the behaviour of functional programming. There is nothing wrong to use functional techniques in OOP/procedural and vice versa. In language like JS you will see a lot of overlapping areas between both styles. One thing to note here is JS is based on neither OOP nor FP nor procedural, it is a prototypical language, and it supports OOP and FP programming styles.
The map function is part of the JavaScript array and shortens the code. You could actually implement your own objectless "array := map(array, function)" function to make this more functional.
technically yes, but the notion it is about how the code reads at a high level. At the fundamental level, everything is written as step by step instructions.
The point of functional programming is not to have it "look like English"(Also personal opinion is functional code doesn't really look like English). It has characteristics that imperative programming doesn't have, for example values can't be modified, which is nice in a sense.
You’re a great teacher and you explain things in an extremely clear and easy to understand way. Thank you for your time. You deserve millions of views, millions of likes and millions of subscribers. Unfortunately the youth of today would rather watch pointless, braining numbing content. Instead of using their time constructively and learning a fun and powerful skill set, such as programming 🙏
The definition of Procedural Programming is wrong here: Writing or using an API to handle persistent objects / tables, and using functions are part of procedural. It only becomes non procedural when you introduce restrictions like only using instances of classes, or having no side effects. Everything else is procedural. Otherwise the linux kernal and all software before Java would contain no function definitions.
Notes for myself:
Procedura Programmingl:
- Step by step instructions for tasks in sequential order.
- Simple but has shortcomings; verbose, illegible, lengthy.
- Hard to re-use the same code since you'd have to copy and paste.
Object Oriented Programming:
- Everything is based on objects, it delegates tasks into smaller chunks and put them into entities known as objects (this hides the logic in the objects); this concept known as encapsulation.
- Easily reusable & maintainable since if something breaks, it's easier to find which object is breaking the program, as opposed to procedural where you'd have to find which line of code is breaking the program.
- By hiding logic, we can abstract the complicated logic and only worry about how you interact with the objects, increasing readability.
Functional Programming:
- Functional programming DESCRIBES the logic using functions. To my understanding, the difference between OOP & FP is that OOP can abstract (hide) the logic, whereas FP presents the logic laid out as functions.
- Everything relies on functions. It creates meaningful functions so that the code would be succinct, clearer and cleaner.
- It's a very declaritive paradigm since it writes in pure functions; thus by reading the code you'll relatively easily understand the programmers intention
Important notes:
- An object is a collection of functions and data. A function is a collection of commands and data.
- When a bunch of functions work together to perform a certain task we can call it an object.
Do you write all of your notes as video comments?
@@MaipuruSyrup No no I use notion, but I put it here because I thought it might be useful for others
Shane, as a newbie I wanna say thank you and I hope we all become bad asses at this 👊🏾
@@angurishudesu based
So what difference between procedural and imperative programming
At first I thought, "Hallelujah! He's actually going to give us some code examples of the differences". But then you spoiled it by not doing equivalents of exactly the same thing. It would have been much more helpful if you'd given the same real-world practical example in both procedural and object-oriented code, such as how to input the record of a new gym membership, for example
Exactly my thoughts he complicated it by using different examples. Also it would have been nice to explain what a paradigm is.
@@redpiller1099 not all content is for beginners, this video is for programmers we do not need examples we know what he is talking about.
A better way to go about explaining this taxonomy would have been to say that procedural programming uses function calls rather than just doing everything inline (which would be referred to as an imperative style), and that functional programming expands on this by introducing concepts such as side effects, pure functions, higher-order functions etc.
The two families at the top are imperative and procedural. Object oriented (not "orientated") and functional are offshoots from procedural. Purely imperative is not really a thing any more (luckily) and with a little luck we'll stop clinging to OO as well.
For anyone who still clings to OO, I highly recommend Brian Wills videos on the topic.
I never get the idea between this stuff. Because for example in the functional example its still using the stuff you claimed to be OOP. And OOP is using procedural stuff. It always appers that there is no clear line between this stuff and people are essentially just being pedantic about things. Maybe i am wrong
short answer: OOP is about different objects communicating only necessary information with each other, while maintaining some privacy for themselves; FP is about being able to trace back everything that happens in the program by making functions that don't change anything outside of their scope with the exception of returning values; PP... I don't really know the major difference between PP and the other ones, just that it is basically the one concerned about the program itself lol.
So, is the difference just an added layer of abstraction? For instance, in procedural programming: for(a = 1; a < 5; a++){write-host a}. In functional programming, you encapsulate that loop in a function and make a function call - Increase(a), and in object-oriented languages, you take that same loop, and attach it as a method of an object, like DoLotsOfStuff.Increase(a)?
Yep.
Functions are the new "goto."
Objects are "goto" with a dict.
Wow that explanation was just too perfect for a beginner like me. Thank you. I have subscribed and I can't wait to learn more from your channel. Thank you once again :)
Welcome aboard! Looking forward to seeing you around here. Here's the full playlist of this series: ruclips.net/video/FNh2JCiFXIg/видео.html
Hope you'll enjoy and any feedback is much appreciated!
I little tooo perfect.
Procedural code contains functions and is usually much shorter that object orientated programming
Good point, but shorter or not, it really depends on the developer and the design patterns/architecture
Best explanation I've seen on YT!
Thanks a lot Eli! Glad it helped!
I don't understand.
In OOP you you call the log method inside the console object. "console.log()"
Im FP you call the map() method which is inside the array object
Where's the difference?
Awesome. Thanks for clear and concise explanation.
You're welcome! Glad it was helpful
Very clearly explained, liked and subscribed!
Thanks and welcome!
Procedural is not writing code line by line, but is writing code as a procedure (functions), and I'm stopping here...
Thanks for pointing that out, for me procedural programming is similar to writing step by step instructions / procedures :) You're free to think of it as anything that you like, as long as it makes sense.
@@Acadeaio Also with OOP you write code step by step.
With procedural you don't write code like assembler (your first example) but you use functions to wrap small tasks as you do in OOP as well where you use methods instead of functions (the are the same thing.)
Exactly. A better way to go about explaining would have been to say that procedural programming uses function calls rather than just doing everything inline (which could be referred to as an imperative style), and that functional programming expands on this by introducing concepts such as side effects, pure functions, higher-order functions etc.
The two families at the top are imperative and procedural. Object oriented (not "orientated") and functional are offshoots from procedural. Purely imperative is not really a thing any more (luckily) and with a little luck we'll stop clinging to OO as well.
In your example of FP at the bottom, aren't you also showcasing the strengths of OOP? .map and .filter are encapsulating the same logic as your for loop method into some syntactic sugar. The same way you would hide that logic using OOP into either an ArrayFilter object or perhaps an extension method/utility class that extends the array datatype?
This is part of why I find it hard to grasp why people often rally for FP and disparage OOP because in my mind they're both trying to solve the problem of encapsulating more complex logic and making more readable and easier to write code, no?
Thank you !
Those examples are really easy to know and to the point !
There are way more than three types of paradigm. You need some experience in different languages like Prolog, Forth, Smalltalk, Lisp, SQL and more. Procedural code didn't lead to object-oriented programming directly. It led to what was known as Structured Programming which addressed the issues inherent and Unstructured Programming. Procedural code is the opposite of Declarative code. And there are shades of gray in between. Object-oriented programming is such an overloaded term that is has lost almost all meaning. Different languages have very different object systems but you have to move out of the Java and C++ world to see it. CLOS in Lisp and Smalltalk's message passing would be good for you to experience. OOP doesn't require you to hide logic in objects. It simply requires that objects consist of attributes instead of working in something like parallel arrays with an index. JavaScript has elements of all of these because all of these things are styles to work within a programming language not things that define a programming language.
Now I am able to understand these paradigms. Thanks a lot brother ❤️❤️. Keep up the good work.
Good explanation. Question - doesn’t functional programming and OOP exist together? For example “fruits.map” uses OOP because “map” is a member function of the Array class.
Also, Class methods can use functional style programming for their function bodies
Yes you are right. At the end of the day, FP and OOP are just programming styles/techniques. How your code will look like in the end is the one that makes the difference. Even though "map" is a (prototype) method of Array, it uses functional techniques and therefore we get the behaviour of functional programming. There is nothing wrong to use functional techniques in OOP/procedural and vice versa. In language like JS you will see a lot of overlapping areas between both styles. One thing to note here is JS is based on neither OOP nor FP nor procedural, it is a prototypical language, and it supports OOP and FP programming styles.
The map function is part of the JavaScript array and shortens the code. You could actually implement your own objectless "array := map(array, function)" function to make this more functional.
indeed
Great information! I had trouble seeing your screen however
Oh no, sorry to hear that, was it too small for you?
Isn't everything in programming written as step by step instructions?
technically yes, but the notion it is about how the code reads at a high level. At the fundamental level, everything is written as step by step instructions.
Straight to the point. Thank you.
i wish my university mam could teach like this
The point of functional programming is not to have it "look like English"(Also personal opinion is functional code doesn't really look like English). It has characteristics that imperative programming doesn't have, for example values can't be modified, which is nice in a sense.
Agree. Depends on the language. I have to code in Scala and I don't think that looks like English at all lmao
I believe that functional programming was invented before object oriented
I just found gold.
Thank you for the explanation 👍🏻
Glad it was helpful!
amazing explanation.
nicely explained
Amazing video thank you
is php and mysql Pop or OOP ?
You’re a great teacher and you explain things in an extremely clear and easy to understand way. Thank you for your time. You deserve millions of views, millions of likes and millions of subscribers. Unfortunately the youth of today would rather watch pointless, braining numbing content. Instead of using their time constructively and learning a fun and powerful skill set, such as programming 🙏
Thank you for the kind comment, it means a lot to me. I really do appreciate it! Please share my videos around if you can, it will really help me out!
C programming language have functions, then why it isnt called a functional programming language?? or why it can not be used in functional way??
how do you type so fast????????????????? Please thats the most i want to know from this video!
voodoo magic :D
Wonderfull! Thank you!
Thank you!
The definition of Procedural Programming is wrong here: Writing or using an API to handle persistent objects / tables, and using functions are part of procedural. It only becomes non procedural when you introduce restrictions like only using instances of classes, or having no side effects. Everything else is procedural. Otherwise the linux kernal and all software before Java would contain no function definitions.
good video
Well explained thank you
Glad it was helpful!
Console is not provided by JS. It's either provided by browser as WebAPI or by Nodejs.
That's correct :)
the functional programing is using oop...array.map...
Qué buen canal!!!
Ewwww, durian fruit LOL
love it!
Thank you!