Тёмный

What is functional programming | Easy way 

Hitesh Choudhary
Подписаться 946 тыс.
Просмотров 186 тыс.
50% 1

Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
All the learning resources such as code files, documentations, articles and community discussions are available on our website:
chaicode.com/
You can find our discord link, github link etc on the above website.
Twitter/X link: x.com/hiteshdo...
Discord link: hitesh.ai/discord
Learn React with 10 projects: • Let's learn react from...
Learn Docker: • A practical guide on D...
Learn Kubernetes: • Complete Kubernetes Co...
How does a browser works: • How does a browser wor...
How nodejs works: • How node JS works | En...
Learn Redux-toolkit: • Learn Redux Toolkit in...
Learn NextJS: • Nextjs Full stack course
Learn Typescript: • Why to learn Typescript
Learn Javascript: • Welcome to new JavaScr...
Learn React Native: • React Native Mastery: ...
Learn Zustand: • React state management...
Learn Golang: • How to get started wit...

Опубликовано:

 

29 сен 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 270   
@ankk98
@ankk98 2 года назад
1. Keep your data and function independent 2. avoid changing state of variables, instead declare others 3. accept function/reference as a param
@danielfrappier3378
@danielfrappier3378 Год назад
I don't get it at all. If you don't have any function that changes the data, how will the data gets changed? Unless you put everything in the main body but then it will grow to a nightmare of thousands of lines of code.
@ankk98
@ankk98 Год назад
@@danielfrappier3378 What they mean is to reduce the number of functions that changes state and keep as many functions pure as possible. Code should be broken down into logical functions and reused. Eg: 'sum' function should not take 2 objects but it should take only 2 integer object and return value should be a new integer object.
@danielfrappier3378
@danielfrappier3378 Год назад
Thanks for the clarification but I can't help notice that it is exactly what they were teaching for C when I started to program in the mid 80's. Old ideas being rediscovered ?
@anu8928
@anu8928 Год назад
4. We can store the function as a variable, pass the function as a parameter.
@WilmerSoriano-lp3ue
@WilmerSoriano-lp3ue 7 месяцев назад
for #1, that can be consider *Pure Function* , correct me if I'm wrong
@satsubatsu347
@satsubatsu347 2 года назад
Functional programming: Remove bloat by adding bloat.
@MuhammadAbdullahMirza
@MuhammadAbdullahMirza 4 года назад
I use OOP
@akashagarwal6390
@akashagarwal6390 4 года назад
Simple clean clear crisp to the point no bullshitting or beating around the bush appreciate it really for beginners good work keep it up sir
@aammssaamm
@aammssaamm 3 года назад
Then you will have no issue to explain the difference between 2 functions in the first example he did not explain.
@David-ws3rw
@David-ws3rw 4 года назад
I use C++, so I basically combine the three all together. OOP for the big components, procedural for the rest and sometimes functional.
@rogersmith5183
@rogersmith5183 3 года назад
I have been programming in many different languages since Microsoft DOS 1.0 came out in the early 1980s ... Assembler, Basic, Fortran, Cobol, Pascal, C, C++, Python, etc. My "style" has never changed despite many people bowing down to new programming fads like OOP and FP. In my opinion, the best programmer is one who: 1. Understands the Objective of the task at hand. 2. Writes the program with efficiency as a high priority. 3. Creatively can devise solutions to obstacles encountered. ... Each person may have a different "style" ... Good programming is more of a temperament than a style. Just live and let live.
@NishantTirpude
@NishantTirpude 4 года назад
Came here after the new ongoing JavaScript series. And yes, it was worth coming. Thanks for such a simple explanation :)
@uditkundu5883
@uditkundu5883 2 года назад
Me too bro but after 1 year I am seeing the js course
@SriHarshaChilakapati
@SriHarshaChilakapati 2 года назад
Just found this randomly in YT, and the very outline here is spot on! As someone who's working on pure FP for 4 years now, I feel there is a lot more to FP that most people say. There are two parts to FP, one is the concept of purity, and the second part is mathematical abstractions like Functors, Applicatives, Monoids, Monads, Transformers, Type Classes, types vs kinds, compile time row polymorphism etc. This is why there is a very high learning curve to get used to purely functional programming languages like Haskell and PureScript. Also in pure FP languages, a 'function' must take a single input and give a single output. And when a function is guaranteed to give the same output everytime it is called with same input, it is called as a pure function. These are often mathematical expressions. But we can't always guarantee that, like in case of writing to a file for example. Those are impure functions. Since calling an impure function makes the caller impure too, we wrap the function along with the required context in a box. Now this box, is called as a monad. Also, this is why pure FP languages doesn't allow you to declare variables directly, unless you keep them in a State monad. Linking one of the best articles I've ever read on pure FP if in case anyone finds it interesting: adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html Thanks for speaking about FP, Hitesh!
@augustyasharma9447
@augustyasharma9447 4 года назад
A difficult problem exist for beginners No one: Literally no one: Hitesh Sir: I will make it ridiculously easy
@Hsa008
@Hsa008 4 года назад
Teri maa bohot mast hai
@lepidoptera9337
@lepidoptera9337 3 года назад
Functional programming is when you are shoveling variables on and off the stack that could happily live on the heap without using any extra cycles and any extra memory.
@elbozo5723
@elbozo5723 3 года назад
so basically its just racism towards void functions and non constant variables
@johnneiberger7311
@johnneiberger7311 3 года назад
I've only known procedural and OO programming, so I tried to learn Clojure last year. Epic failure. I hated all the parentheses and inside-out logic, but also just couldn't grasp functional thinking. I'm now trying to learn Erlang, which is a lot less opaque but I still struggle with thinking functionally. Languages like this reduce side effects, but side effects are exactly what we need. Programs exist to do things, and to do things requires interacting with the outside world, taking input, producing output, tracking and updating state information, storing and retrieving data, etc. I still can't figure out how functional programming gets anything done. Something as simple as creating and updating a counter. How can you track state if variables are immutable? It just doesn't make any sense to me.
@danielt63
@danielt63 2 года назад
I was where you are when I first started learning functional programming. Of course programs need side effects. Think of it more like separation of concerns. When you write a function that both calculates some logic *and* updates the state of something, then the function is doing more than one thing. Your logic should be separate from the effects. By doing that, your logic will be easier to test.
@Djellowman
@Djellowman 2 года назад
2.5 minutes in & i haven't learned a thing. disliked
@christianrodier3381
@christianrodier3381 4 года назад
That was helpful. I am a little fuzzy about the last principle. Maybe you can elaborate a bit more later
@fusneicaalex6873
@fusneicaalex6873 4 года назад
Hey Hitesh, i follow a lot of courses online from various persons just to update myself, and i have to say that you sir are the best until now!!! You cover so many things that others avoid, which they shouldn't because these concepts are the most important to know about, to really understand how programming works. I will for sure advice any newbie out there to follow you!!! Ps. this is the first and only review i ever gave to anybody, just because you really impressed me!!! Keep up with the good work you're doing!!! I really hope all this gives you all the merit you diserve.
@subhambanerjee6334
@subhambanerjee6334 4 года назад
Please tell me what theme were you using in vscode
@suhasanimation6193
@suhasanimation6193 Год назад
No idea, "it just works. "Way of programming.
@suhasanimation6193
@suhasanimation6193 Год назад
Which is bad and I don't recommend.
@TheAbhidugar
@TheAbhidugar 3 года назад
At 7:45 you said it should be able to store functions into any variable. Does that mean variable to store return value from the function with the same type?
@AgarwalAnup95
@AgarwalAnup95 4 года назад
OOP and FP together
@shreemanarjun
@shreemanarjun 4 года назад
use Kotlin
@AgarwalAnup95
@AgarwalAnup95 4 года назад
@@shreemanarjun I'm learning native android now I'll definitely do that Thank you
@tectopic
@tectopic 3 года назад
Old fart here. Some background in structured programming and JSP. Thank you for this concise explanation of the gist of it all. I was looking for functional ideas to incorporate in my normal programming. Other videos always use F# or extra frameworks, that clutter the presentation. An elaboration on point 3 would be appreciated. Point 4 is obvious:)
@benzflynn
@benzflynn 4 месяца назад
This is a poor presentation on functional programming. Everything done in this video can be done in JavaScript as it is. There's much more to functional languages than this video says.
@sase1017
@sase1017 3 года назад
Disagree with the main point of this video, I think most people still be confused after this video, different style of writing code is superficial level understand of FP or least thing engineers need to concern about. The major difference of Functional Programming(FP) from OO: 1) Side Effect caused by changing state(external dependency like viable), so less errors when building large system due to state changes. (pure function means the return will only rely on inputs, so its more reliable and more stable, less bugs) inheritance and
@thebicycleman8062
@thebicycleman8062 Год назад
Another note: the way you pronounce beginners is NOT 'BEG-ners" your emphasis is landing on the wrong place. It should be pronounced as "Bih-Gih-NERS" should be THREE clear syllables, if you put your hand on your mouth and pronounce it you should feel THREE separate clear bursts of air. Thank you hope that helps, I only focus on words that you as a RU-vidr will be saying quite often so it's worth correcting. Thank you
@chandravardhan3725
@chandravardhan3725 4 года назад
08:30 this transition effect is Awesome. Reminds me about Mr. Robot
@ErastusK
@ErastusK 4 года назад
haha too funny
@TheDrunkenAlcoholic
@TheDrunkenAlcoholic Год назад
it amazes me how someone can use the word "constant" and "variable" when referencing the same thing, they are complete opposites, "variable" meaning it can change, "Constant" meaning it can not change. it is 2 English words that have been used in programming to describe what they do with the values stored in them, as in 1 changes values and the other doesn't.
@codingwithsam9194
@codingwithsam9194 4 года назад
Main work in mainstream gd, unreal engine.... anyway unreal uses c++ as its programming language and most work is o.o. damn the pointers we have to use in every freaking line
@euclid9492
@euclid9492 2 года назад
Tbh this feels extremely wasteful to me. Instead of appending a node to a list, I would need to create a new list that is a copy of the old with one extra node? This seems to trade off O(1) space and time complexity for O(n) space+time. Just so we don’t have to keep track of something changing? What’s so bad about changing a reference to an outside variable? Idk. Programming isn’t just math. It’s programming. I try to limit mutability too, but this seems a bit overkill to me.
@RoyaltyInTraining.
@RoyaltyInTraining. Год назад
You explain all the elements of functional programming, but not how to apply them. Kinda useless.
@rushikeshkavar6128
@rushikeshkavar6128 2 года назад
So, This video gave a rough idea of functional programming. This is not sufficient to understand all aspects. When we understand practical aspects of it by using some real life example then only it becomes clear. For academic purpose such videos will suffice but not for concrete understanding.
@RebelSouls
@RebelSouls 3 года назад
This, Functional programming is stupid. Declaring a new variable every time it changes? Nope. I'll skip.
@danre64
@danre64 2 года назад
Oh wow, I have always programmed in functional style without even knowing it because I am a variable hoarder.
@askiny6576
@askiny6576 4 года назад
so in other words: everything stays the way it was in C++ oder Python, but let's add some restrictions functional programming is a Scam!
@rahultandon9749
@rahultandon9749 2 года назад
oops say functional:- C# says EXPRESSION TREE and java says ...
@tuatarian6591
@tuatarian6591 4 года назад
I generally use procedural programming at the moment, mostly because gamedev requires code to run on a per frame basis
@dara_1989
@dara_1989 Год назад
func add(a, b) {return : a + b; } ... let c = add(1, 2); ... print c;
@mohdabbas8307
@mohdabbas8307 2 года назад
you are gonna live 45 years more in this Sinner World, thats why you often use 45..
@francogiulianopertile279
@francogiulianopertile279 2 года назад
As a Spanish speaker, Nice video, but the song at the end looks a bit off :P.
@afterstorys1254
@afterstorys1254 Год назад
one two buckle my shoe three four buckle some more 5 6 nike kicks that's so fire 🔥 🔥
@KethusNadroev
@KethusNadroev 3 года назад
So everything that wasn't mentioned here is OOP? Where is the line? Is it the moment I start using arrays?
@AndersonK55
@AndersonK55 2 года назад
Hahaha the final song was the best and unexpected. Nice video ! (Chicos recuerden no todo es trabajo la farra es necesaria)
@suvigyabajpai2770
@suvigyabajpai2770 2 года назад
The guy is not clear with his thoughts. His examples are not clear.
@vili12011
@vili12011 3 года назад
I subscribed only for that smooth af transition, made me chuckle, good job and thanks!
@Larock-wu1uu
@Larock-wu1uu 3 года назад
I don't get it... To me these principles just look like good practices
@TejasShelake
@TejasShelake 2 года назад
Always use 45 because of Rohit Sharma 6:54
@raeesurrehman5914
@raeesurrehman5914 Год назад
You use 45 all the time because your age is 45 and you are concerned about it 😀
@zuber3228
@zuber3228 3 года назад
first comment on you'r channel other wise don't have a time to comment
@reddot_22
@reddot_22 2 года назад
Programming + Regueton Latino Outro = Subscribed
@noumanmalik960
@noumanmalik960 4 года назад
Hitesh sir is best in explaining difficult terms and technologies, be it an Api, framework vs library etc. This man will make it easy for you.
@misterlelong
@misterlelong Год назад
Next paradigm, CRUD programming. :P
@aks4413
@aks4413 Год назад
you are using 45 because you are a HITMAN fan
@TonyStone31
@TonyStone31 2 года назад
Thanks for clearing things up for me. I do OOP programming in Free Pascal and use the Lazarus IDE. I have spent the past few days trying to understand what all this "functional programming" fluff is all about. I am gathering it is mostly about style... it is probably kind of how I currently program anyway... maybe. I am still a beginner here but I tend to refactor a lot of my code into functions. So, I am probably already half way doing functional programming even while Free Pascal and Lazarus may not have specific features built in yet for functional programming. (?) I was chatting in the #fpc IRC channel with the pascal developers and it sounds like they may implement some features for this at some point. I am following you here on YT now as you did make a great little video here! Thanks!
@dualwan
@dualwan 3 года назад
sad to say i am still procedural way of programming...
@elvicsolgb
@elvicsolgb 2 года назад
Ive programmed mostly in OO style using C++ & Java. Also in PHP even if the language doesn’t really enforce it. When I started to study Javascript, I always defaulted to the usual way of thinking that kind of limit the full potential of JS. And there’s this kind of weird feeling of uneasiness when I started to read others’ codes that utilize closures because it just feel un-natural to what I used to think in the OO paradigm. And it took some amount of racking my head before I would start to somehow feel I kind of getting it. Hitesh is right, this is actually just a simple concept. The barrier to understanding is not that it’s complicated but has more to do with how our brain works. It has more to do with our mental reflex to hold on to a mental map that’s easier & less taxing to our brain.
@Yume-x9v
@Yume-x9v 3 месяца назад
Point functional programming use formula f(x) = y = p ≒ x
@carsugarmodels
@carsugarmodels 2 года назад
Eventhough it is understandable that in order to be able to track state, one should redeclare the variable, but that is not a variable anymore, it is a constant :)
@crazyshala4571
@crazyshala4571 4 года назад
Please make video on destructing array and object in JavaScript and how to use with react
@der-lotse
@der-lotse 4 года назад
So bad. Almost everything wrong.
@XCRush_4488
@XCRush_4488 4 года назад
sir I am a new student my name is prithvi I am 10 years old
@anujrana15893
@anujrana15893 3 года назад
Can you also explain the benefits of using FP way
@suvojitpal4875
@suvojitpal4875 4 года назад
After watching this video I am very sir to refer your courses to my friends and also to me as well , I am seeing you are simplifying thing at very next level
@shreemanarjun
@shreemanarjun 4 года назад
I use both FP and OOP... Kotlin❤️
@WhatIsThisAllAbout
@WhatIsThisAllAbout 4 года назад
kotlin is DOA language
@MuhammadArfan-x4p
@MuhammadArfan-x4p Месяц назад
Functional Programming...
@oprabin
@oprabin 2 года назад
Hi Hitesh, As per the 4th important thing, do I need to press that subscribe button if I have already subscribed you? Asking for a friend, you know.
@rajat9302
@rajat9302 2 года назад
procedural way to write a program in python
@Mr__viral65
@Mr__viral65 10 дней назад
अबे भाई हिंदी में बोला करो यार
@gauravvishwakarma____3330
@gauravvishwakarma____3330 4 года назад
😁😁😁😁 informative video
@crazyshala4571
@crazyshala4571 4 года назад
Please make video on topic like clousers , hoisting and event loop's lot asked in Js interviews
@countofmontecristo8369
@countofmontecristo8369 2 года назад
First two minutes are unrequired filler.
@bidme786
@bidme786 3 года назад
I am confused on how to do the fourth point.
@subhtube
@subhtube 2 года назад
Very wll explained
@WonderinSoulPR
@WonderinSoulPR 2 года назад
I use object oriented so c# and java
@Kunal.Singh__01
@Kunal.Singh__01 2 года назад
I am currently using OOP.
@carlosmariohenaogonzalez9480
@carlosmariohenaogonzalez9480 3 года назад
Jajajaja if the ending it's Reggaeton... Why Reggaeton? 😂😂😂
@AxanLderE
@AxanLderE 3 года назад
Porque Reggaeton es de ptmr
@Mr__viral65
@Mr__viral65 10 дней назад
hindi language
@akshaykudale4762
@akshaykudale4762 3 года назад
Came here from js series. This is just amazing. Thank you!!
@TigranKheranyan-c1s
@TigranKheranyan-c1s 2 года назад
I am using functional programming.
@sebastianh4048
@sebastianh4048 2 года назад
ella quiere farra jajajaja. ... great video
@aakashjana6225
@aakashjana6225 4 года назад
Hey hitesh do you develop games I want to do game development in python 🤗
@gavintantleff
@gavintantleff 4 года назад
Aakash Jana Don’t do Game Development in Python. Check out a game engine like Unity. It uses C# but you will be so happy you didn’t try to make your own engine.
@stewiegriffin6503
@stewiegriffin6503 Год назад
buuuh
@robertforster8984
@robertforster8984 2 года назад
I use C and assembly. So procedural.
@kshirodpatel
@kshirodpatel 4 года назад
Hello Sir, Can you please tell us about prototype in JavaScript. How can we write a plug-in by using that?
@kemijarks
@kemijarks Год назад
this guy is so charismatic,
@nathancasados7391
@nathancasados7391 4 года назад
Yo man I'm using Elixir
@ashishacharya9015
@ashishacharya9015 4 года назад
Next video on OOP please!!
@BrianC1664
@BrianC1664 Год назад
Ha, it seems I've been doing functional programming in my scripts and apps all along... It makes so much more sense to me to pass in data to a universal function, rather than reusing variables in static functions (it's not like servers are running with only kilo/mega-bytes of RAM these days).
@surajmaity6194
@surajmaity6194 Год назад
the way you're explaining and you said that point no. 4 .. actually it was for subscribing ... I thing point 4 should be a vital point for functional programming ... Amazing ... I love this video ...
@richardqualis4780
@richardqualis4780 Год назад
Explained very well
@afterstorys1254
@afterstorys1254 Год назад
what's the app bruf
@thebicycleman8062
@thebicycleman8062 Год назад
@hitesh Amazing video! Also just a minor correction, it is grammatically incorrect to say "explain YOU" you should always add some form of connection like "explain TO you" or if speaking about an object then it will be "let me explain IT TO you" thanks for the video and hope you accept my feedback. Thank you :)
@blank3211
@blank3211 4 года назад
Which ide are u using .
@kunalmalpure3409
@kunalmalpure3409 3 месяца назад
object oriented
@SignumCode
@SignumCode Год назад
nothing got clear here
@ZeneGaVole-zd1gh
@ZeneGaVole-zd1gh Год назад
Finally I found man who know to teach others. This is my 7 video contect and there is expert people who know theres stuff but STUPID to teach other people. This indian man is so good at education I give you 5 star. Than you
@hilariouscoder7203
@hilariouscoder7203 4 года назад
Object-Oriented Way
@karihotakainen5210
@karihotakainen5210 3 года назад
I've noticed that programmers tend to explain, and perhaps even understand, things from the ground up. You start with examples and then work towards the general concept. I find this to be annoying and inefficient. In my opinion, it is better to introduce the general concept first and then give an example.
@Kristoph-69-69
@Kristoph-69-69 Год назад
New to programming. But I naturally using functional to code my small projects. I just did it. I didnt even know this was a programming paradigm.
@rey16382
@rey16382 3 года назад
Nice explanation!
@ankushladani496
@ankushladani496 Год назад
Thank you sir....
@bijayagiri5746
@bijayagiri5746 Год назад
nicely done sir.
@ankurranjan3218
@ankurranjan3218 3 года назад
Simple and Crisp
Далее
Functional programming - A general introduction
11:47
Просмотров 103 тыс.
Wordpress Open Source drama
15:46
Просмотров 24 тыс.
Se las dejo ahí.
00:10
Просмотров 2,8 млн
Dear Functional Bros
16:50
Просмотров 510 тыс.
What is the Java Job delusion?
12:23
Просмотров 123 тыс.
What is a Monad? - Computerphile
21:50
Просмотров 603 тыс.
IS Java Functional Programming? | What about Python?
11:41
Object Oriented Programming vs Functional Programming
18:55
Top Developer productivity tools in 2024
13:31
Просмотров 20 тыс.
The purest coding style, where bugs are near impossible
10:25
Programming Paradigms - Computerphile
10:44
Просмотров 683 тыс.