Ep13 - OOP vs Functional vs Procedural Programming Explained!

Поділитися
Вставка
  • Опубліковано 25 гру 2024

КОМЕНТАРІ •

  • @herseem
    @herseem 2 роки тому +28

    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

    • @redpiller1099
      @redpiller1099 Рік тому +3

      Exactly my thoughts he complicated it by using different examples. Also it would have been nice to explain what a paradigm is.

    • @insidiousmaximus
      @insidiousmaximus 6 місяців тому +2

      @@redpiller1099 not all content is for beginners, this video is for programmers we do not need examples we know what he is talking about.

  • @angurishudesu
    @angurishudesu 2 роки тому +34

    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.

    • @MaipuruSyrup
      @MaipuruSyrup 2 роки тому +3

      Do you write all of your notes as video comments?

    • @angurishudesu
      @angurishudesu 2 роки тому +13

      @@MaipuruSyrup No no I use notion, but I put it here because I thought it might be useful for others

    • @passportbro904
      @passportbro904 2 роки тому +2

      Shane, as a newbie I wanna say thank you and I hope we all become bad asses at this 👊🏾

    • @tropicarls
      @tropicarls Рік тому +1

      @@angurishudesu based

    • @williammbollombassy1778
      @williammbollombassy1778 Рік тому

      So what difference between procedural and imperative programming

  • @charg1nmalaz0r51
    @charg1nmalaz0r51 Рік тому +6

    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

    • @pdd5793
      @pdd5793 6 місяців тому

      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.

  • @kaptenadhoc
    @kaptenadhoc 3 роки тому +6

    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.

  • @ayotomiwasalau6373
    @ayotomiwasalau6373 3 роки тому +6

    Awesome. Thanks for clear and concise explanation.

    • @Acadeaio
      @Acadeaio  3 роки тому

      You're welcome! Glad it was helpful

  • @kamogelokhumalo4792
    @kamogelokhumalo4792 3 роки тому +24

    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 :)

    • @Acadeaio
      @Acadeaio  3 роки тому +2

      Welcome aboard! Looking forward to seeing you around here. Here's the full playlist of this series: ua-cam.com/video/FNh2JCiFXIg/v-deo.html
      Hope you'll enjoy and any feedback is much appreciated!

    • @raconvid6521
      @raconvid6521 3 роки тому

      I little tooo perfect.

  • @wire_head10
    @wire_head10 3 роки тому +1

    Best explanation I've seen on YT!

    • @Acadeaio
      @Acadeaio  3 роки тому +1

      Thanks a lot Eli! Glad it helped!

  • @ryszardk2534
    @ryszardk2534 3 роки тому +4

    Very clearly explained, liked and subscribed!

    • @Acadeaio
      @Acadeaio  3 роки тому

      Thanks and welcome!

  • @lf00t
    @lf00t Рік тому +1

    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?

  • @chrisklest1238
    @chrisklest1238 Рік тому +3

    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)?

    • @grawss
      @grawss Рік тому +1

      Yep.
      Functions are the new "goto."
      Objects are "goto" with a dict.

  • @zeroskillgaming1203
    @zeroskillgaming1203 3 роки тому +12

    Procedural code contains functions and is usually much shorter that object orientated programming

    • @Acadeaio
      @Acadeaio  3 роки тому +2

      Good point, but shorter or not, it really depends on the developer and the design patterns/architecture

  • @phonesj3422
    @phonesj3422 2 роки тому +2

    Thank you !
    Those examples are really easy to know and to the point !

  • @unitydev457
    @unitydev457 Рік тому +1

    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?

  • @PixelOutlaw
    @PixelOutlaw 2 місяці тому

    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.

  • @atmanvisual190
    @atmanvisual190 3 роки тому +8

    Straight to the point. Thank you.

  • @fadhilh3931
    @fadhilh3931 3 роки тому +2

    Thank you for the explanation 👍🏻

    • @Acadeaio
      @Acadeaio  3 роки тому

      Glad it was helpful!

  • @oodeveloper4230
    @oodeveloper4230 3 роки тому +4

    Procedural is not writing code line by line, but is writing code as a procedure (functions), and I'm stopping here...

    • @Acadeaio
      @Acadeaio  3 роки тому

      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.

    • @oodeveloper4230
      @oodeveloper4230 3 роки тому +1

      @@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.)

    • @kaptenadhoc
      @kaptenadhoc 3 роки тому +2

      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.

  • @Jezy258
    @Jezy258 2 роки тому

    Great information! I had trouble seeing your screen however

    • @Acadeaio
      @Acadeaio  2 роки тому

      Oh no, sorry to hear that, was it too small for you?

  • @jyotiamkar2016
    @jyotiamkar2016 2 роки тому

    Now I am able to understand these paradigms. Thanks a lot brother ❤️❤️. Keep up the good work.

  • @hexerei02021
    @hexerei02021 2 роки тому +1

    Isn't everything in programming written as step by step instructions?

    • @Acadeaio
      @Acadeaio  2 роки тому

      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.

  • @compilerrun5516
    @compilerrun5516 3 роки тому +5

    I just found gold.

  • @ekkamailax
    @ekkamailax 3 роки тому +4

    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

    • @Acadeaio
      @Acadeaio  3 роки тому +2

      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.

    • @TanigaDanae
      @TanigaDanae 3 роки тому

      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.

    • @emreaka3965
      @emreaka3965 2 роки тому

      indeed

  • @Bhishma68
    @Bhishma68 3 роки тому +1

    i wish my university mam could teach like this

  • @rekan_98
    @rekan_98 2 роки тому

    is php and mysql Pop or OOP ?

  • @xiaolinghe4314
    @xiaolinghe4314 2 роки тому

    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.

    • @Chilli_Tea
      @Chilli_Tea 2 місяці тому

      Agree. Depends on the language. I have to code in Scala and I don't think that looks like English at all lmao

  • @alexkotusenko
    @alexkotusenko 3 місяці тому

    Amazing video thank you

  • @meditataor
    @meditataor 4 місяці тому

    nicely explained

  • @shakilthakur2674
    @shakilthakur2674 Рік тому

    amazing explanation.

  • @MrSpyTubes
    @MrSpyTubes 2 роки тому +2

    I believe that functional programming was invented before object oriented

  • @MahmudHasan-rc1rw
    @MahmudHasan-rc1rw Рік тому

    C programming language have functions, then why it isnt called a functional programming language?? or why it can not be used in functional way??

  • @gymgeek6833
    @gymgeek6833 3 роки тому

    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 🙏

    • @Acadeaio
      @Acadeaio  3 роки тому

      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!

  • @zyggzag4154
    @zyggzag4154 2 роки тому

    how do you type so fast????????????????? Please thats the most i want to know from this video!

  • @sandmann6851
    @sandmann6851 3 роки тому +1

    Wonderfull! Thank you!

  • @Jeetz
    @Jeetz 3 роки тому

    Well explained thank you

    • @Acadeaio
      @Acadeaio  3 роки тому

      Glad it was helpful!

  • @zeynepbetulkaya3645
    @zeynepbetulkaya3645 3 роки тому

    Thank you!

  • @darrenbreydsor5604
    @darrenbreydsor5604 9 місяців тому

    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.

  • @ivanshatrov3
    @ivanshatrov3 2 роки тому

    Console is not provided by JS. It's either provided by browser as WebAPI or by Nodejs.

  • @mirlamontano6640
    @mirlamontano6640 Рік тому

    good video

  • @sawilliams
    @sawilliams 2 роки тому

    the functional programing is using oop...array.map...

  • @tello9504
    @tello9504 3 роки тому

    Qué buen canal!!!

  • @malcorub
    @malcorub 3 роки тому

    Ewwww, durian fruit LOL

  • @alphayowakarindi
    @alphayowakarindi 2 роки тому

    Thank you!