Ep13 - OOP vs Functional vs Procedural Programming Explained!

preview_player
Показать описание

There are 3 main programming paradigms: Functional, Procedural and Object Orientated. Let's talk about the differences between them.

------------
Source code for this lesson:


** Affiliated links
Use the legendary Git GUI for FREE! You are seriously missing out if you are not using it.

Beautiful designs created instantly to wow your social networks!

A simple and scalable cloud hosting platform for all developer needs.


Outro Music:
Рекомендации по теме
Комментарии
Автор

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

chargnmalazr
Автор

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.

angurishudesu
Автор

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?

lft
Автор

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.

kaptenadhoc
Автор

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

chrisklest
Автор

Awesome. Thanks for clear and concise explanation.

ayotomiwasalau
Автор

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

zeroskillgaming
Автор

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.

PixelOutlaw
Автор

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

oodeveloper
Автор

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

phonesj
Автор

Best explanation I've seen on YT!

wire_head
Автор

Very clearly explained, liked and subscribed!

ryszardk
Автор

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

jyotiamkar
Автор

i wish my university mam could teach like this

Bhishma
Автор

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

hexerei
Автор

I believe that functional programming was invented before object oriented

MrSpyTubes
Автор

Great information! I had trouble seeing your screen however

Jezy
Автор

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

MahmudHasan-rcrw
Автор

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

ekkamailax
Автор

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.

xiaolinghe
welcome to shbcf.ru