Learning Functional Programming with JavaScript - Anjana Vakil - JSUnconf

แชร์
ฝัง
  • เผยแพร่เมื่อ 18 พ.ย. 2024

ความคิดเห็น • 951

  • @madwilliamflint
    @madwilliamflint 8 ปีที่แล้ว +2329

    I've been programming for almost 40 years. That's the best explanation of map/reduce I've ever seen.

    • @MADPURO
      @MADPURO 8 ปีที่แล้ว +12

      what are your main language(s)?

    • @80amnesia
      @80amnesia 8 ปีที่แล้ว +177

      Fortran, Cobol, Algol and Altair BASIC

    • @sammokkabasi8957
      @sammokkabasi8957 8 ปีที่แล้ว +11

      whoa.

    • @cwmoser
      @cwmoser 7 ปีที่แล้ว +1

      Tom Pitman's Tiny Basic ... along with Fortran, Cobol, PL/1, and Algol.

    • @ibuprofen303
      @ibuprofen303 7 ปีที่แล้ว +33

      I do Sinclair Spectrum basic. With a rubber keypad. I've just finished yet another "Breakout" game and I'm currently saving it to cassette.

  • @recursiveackermann9819
    @recursiveackermann9819 2 ปีที่แล้ว +44

    This is possibly one of the best 30 minutes of my life as a software engineer. Thank you.

  • @ToveriJuri
    @ToveriJuri 8 ปีที่แล้ว +442

    She does a very good job at introducing the very basic concept behind FP and she's easy to listen to. Excellent video.

    • @kierranpurden2150
      @kierranpurden2150 7 ปีที่แล้ว +7

      Agreed, she actually makes so much sense.

  • @Helvanic
    @Helvanic 8 ปีที่แล้ว +783

    As a programmer that already knows about those subjects, I wish somebody would have explained them to me that way the first time I looked into it. Great talk.

    • @howardlam6181
      @howardlam6181 4 ปีที่แล้ว +6

      I am now a tutor of a python course so seeing how the others present these kinds of topics should help me understand how to make it more approachable.

    • @valen8560
      @valen8560 4 ปีที่แล้ว +2

      true, have learnt all these already, but the hard way

    • @balanrouge1227
      @balanrouge1227 3 ปีที่แล้ว

      Hi, how would you describe the difference between a function and a method from the object oriented paradigm? Just trying to understand the functional programming mindset :) cheers

    • @punkgrl325
      @punkgrl325 3 ปีที่แล้ว +7

      @@balanrouge1227 So the way it works is, a method is a function that's declared within an object. I guess in Java, all the functions would be methods, because all the code in a program is contained within an object class. This isn't the case in Javascript though. In Javascript, you can have functions that are independent of objects, so they wouldn't be methods. The in-built functions in Javascript are technically methods though, as they're usually part of some type of core protoype object within the language itself ( string.concat(), array.push(), etc).
      In object-oriented Javascript, the functions would be methods following the object-oriented paradigm, but in functional programming, the functions are usually self-contained and return some sort of reusable code or instructions for the program (like how the functional components in React work). So for the most part, you can say methods are a type of function, but not all functions are methods. I hope that helps in some way :)

  • @vim6284
    @vim6284 7 ปีที่แล้ว +586

    She's not like a bunch of pedantic dudes who talk around and pretend as if they are intelligent, but she thoroughly understands the core and generously and effectively delivers her knowledge. I wish she was my professor.

    • @i3130002
      @i3130002 5 ปีที่แล้ว +8

      Honestly I waited for her to explain why to use mutable method, the reason is to be able to shallow compare objects so react for example, be able to detect object changes!

    • @balazsorosz6845
      @balazsorosz6845 4 ปีที่แล้ว

      soooooooooooo true

    • @RexGalilae
      @RexGalilae 4 ปีที่แล้ว +9

      I mean, she's at the stage where she's experienced enough to have formed an intuitive understanding yet too new to have formed a superiority complex over it

    • @jotang3694
      @jotang3694 4 ปีที่แล้ว

      I couldn't agree more

  • @euihyunan3768
    @euihyunan3768 4 ปีที่แล้ว +153

    This is why i like listening to students presentations. You actually learn more from the students because they understand what we probably had a hard time in.

  • @Eltramicst
    @Eltramicst 3 ปีที่แล้ว +147

    "About 6 months ago, I knew nothing about functional programming and very little about Javascript," she says while giving a talk about functional programming to an audience of programmers at a Javascript conference..
    That is insanely impressive.

    • @ДианаДиана-с1г
      @ДианаДиана-с1г 2 ปีที่แล้ว

      I've been learning JS for 4 months and now I am doubting my progress =(

    • @Chillycloth
      @Chillycloth ปีที่แล้ว

      @@ДианаДиана-с1г use it with HTML and CSS. Easier to learn it

    • @ゾカリクゾ
      @ゾカリクゾ หลายเดือนก่อน

      if its the first language you learn, take it easy, don't expect to be super quick. once you learn one language, learning others will be so much easier. ​@@ДианаДиана-с1г

  • @Rajdeep369
    @Rajdeep369 8 ปีที่แล้ว +2590

    she's a great communicator

    • @ajaymenon0
      @ajaymenon0 7 ปีที่แล้ว +203

      I think the background of being an English teacher really shows how she's so comfortable with her speech.

    • @stopthrm
      @stopthrm 7 ปีที่แล้ว +81

      yes she is. What's ironic is that I used to feel like I could write and communicate very clearly but after being a programmer for a few years, my written communication has slipped backwards.

    • @Natasha-to1mh
      @Natasha-to1mh 5 ปีที่แล้ว +24

      @@stopthrm programming requires you to have a more abstract/logical mindset sort of like whats needed in mathematics and engineering professions. I found myself switching a bit in personalities/values when I devote more time programming within a timeframe compared to when I devote more time in music.

    • @venvilhenrydsilva8354
      @venvilhenrydsilva8354 5 ปีที่แล้ว +9

      Well, she's a philosophy major! also an English teacher.

    • @florinteodorescu5493
      @florinteodorescu5493 4 ปีที่แล้ว +21

      She was an ESL teacher. If you're shy or boring, the students will eat you alive.

  • @Codetutor-DemystifyCoding
    @Codetutor-DemystifyCoding 4 ปีที่แล้ว +29

    I am a programmer, I know and use the concepts that she is talking about in my daily work. But I was still hooked to the way she was explaining these things. The fact that she doesn't come from typical programming back ground is something that makes her communication her USP. Very well explained!!!

  • @iamcisneros
    @iamcisneros 8 ปีที่แล้ว +547

    Completely cool at all aspects... how she explains, how she interacts with the audience, how she managed saying "i dont feel qualified to talk about non-blocking, promises..." and how she says "fight fight fight" haha the best :)

  • @02minutesvideography20
    @02minutesvideography20 7 ปีที่แล้ว +12

    Great wisdom ! She accept she don't know a lot but still confidently delivered what she know. Appreciated!

  • @paullikethesaint
    @paullikethesaint 7 ปีที่แล้ว +121

    Good talk. She's an excellent communicator which I'm sure has a lot to do with being other things prior to being a software engineer.

  • @pb9405
    @pb9405 2 ปีที่แล้ว +8

    Best explanation I've heard so far, an important advantage of FP that she didn't mention is that it becomes much easier to test your code (unit testing), because there is no shared state.

  • @pablofonseca8867
    @pablofonseca8867 4 ปีที่แล้ว +28

    Just a tip, in ECMAScript Standard you can use Object.freeze() to throw an error if someone tries to change the object, even if the object is a constant array and someone is trying to change the value of the memory address.

  • @JohnDavidHarbison
    @JohnDavidHarbison 8 ปีที่แล้ว +325

    Such a good job! I had no intention of watching the entire video - but here I am 30 mins later, and I would totally have watched more. Great intro that has me seriously considering these design patterns for my future JS programs!

    • @cyberprodigy
      @cyberprodigy 7 ปีที่แล้ว +1

      John David Harbison same happened to me. :)

  • @viditkothari9796
    @viditkothari9796 5 ปีที่แล้ว +20

    From the future: 2019
    This video is so much relevant today (if not more than ever), specially with React trending, these coding style, techniques are so widely used and benefitted from.
    Also, her explanation are so clear & concise. This is my 5th watch since 2016 :)

    • @chengwilliam9309
      @chengwilliam9309 5 ปีที่แล้ว

      follow your idea,I'm finishing first time!

  • @aduonye
    @aduonye 2 ปีที่แล้ว +4

    Wow! What a clear and concise explanation, she carried us along the entire discussion with her presentation, and now I get a hang of functional programming and understanding these buzz words like a pure function, mutability, closure, structural sharing, and more.

  • @lokeshbramhe9458
    @lokeshbramhe9458 4 ปีที่แล้ว +4

    She does a very good job at introducing the very basic concept behind FP and she's easy to listen to. Excellent video, she's a great communicator

  • @hiankun
    @hiankun 4 ปีที่แล้ว +6

    Never thought that one day I will get the concept of functional programming from a JS conference video. Great talk and explanation.

  • @vicsar
    @vicsar 7 ปีที่แล้ว +303

    21:07 - Tough crowd tonight... is this mic on? (She did a great job)

    • @ducamvinh4462
      @ducamvinh4462 4 ปีที่แล้ว +23

      yeah that's what i was thinking the whole time, what a dead crowd, she's amazing

    • @gpnryou
      @gpnryou 4 ปีที่แล้ว +3

      @@ducamvinh4462 Yes, she did a great job. But as I see it she seemed overexcited and that was evident to that specific audience

    • @LanguageSkillz
      @LanguageSkillz 4 ปีที่แล้ว +3

      Agreed, quieter audience but she raced into every highlight she loved. They're good ones! I so appreciate how she distinguished their rescue features, in a cauldron of bubbling object staging.

    • @darranoshea4824
      @darranoshea4824 3 ปีที่แล้ว +1

      @@LanguageSkillz You can't really see the audience's faces, but I'd like to think they all have pretty big smiles every time Anjana makes a joke!

  • @profmo
    @profmo 7 ปีที่แล้ว +3

    I appreciate that programmers are finally embracing the virtues of functional programming. Back in the 80s and 90s, functional programming was seen as esoteric. Now it is mainstream. I hope this means that within 20 years, programming using higher-order type theory will become main stream.

  • @tack3132
    @tack3132 8 ปีที่แล้ว +37

    The best explanation of what functional programming is that I have heard. Thanks a lot, Anjana.

  • @sleeplessdev7204
    @sleeplessdev7204 5 ปีที่แล้ว +2

    By teaching a subject you recently learned, it's more fresh in your mind, you have simpler examples and gotcha's to share, and you don't get bogged down in all the details and exceptions to the rule that an expert in the field might. I wish more things were taught this way.

  • @rorycawley
    @rorycawley 8 ปีที่แล้ว +91

    Best talk on functional programming I've yet seen. Great to see it on JS too!

  • @boxherold1177
    @boxherold1177 4 ปีที่แล้ว +1

    This was the best explanation I have ever seen on this. It’s nice to have someone actually explain things instead of trying to show off how much jargon they know

  • @NicholasEymann
    @NicholasEymann 8 ปีที่แล้ว +22

    This is one of the best intros to functional programming I have ever seen!

  • @김정영-j4d
    @김정영-j4d 4 ปีที่แล้ว +1

    I didn't search anything about javascript but I have luckily watched this video and it makes me deeper understanding of javascript. and also it so great presentation.

  • @michaelpritchard2350
    @michaelpritchard2350 8 ปีที่แล้ว +35

    This is great! I am learning JS, and the functional paradigm fits in exactly with what I want my code to do: Input-function-output. Perfect!

  • @djgreyjoy1495
    @djgreyjoy1495 11 หลายเดือนก่อน

    A philosophical step back to remind us what programming is really about. The objects don't allow us to see the forest. Nice done!

  • @Nachiketa_TheCutiePie
    @Nachiketa_TheCutiePie 4 ปีที่แล้ว +3

    She is so expressive and I understood things which I couldn't understand before.

  • @shaswatkumarparida6179
    @shaswatkumarparida6179 3 ปีที่แล้ว +2

    I am also a beginner to the advanced concepts of javascript. Such a comprehensive lecture.

  • @sunnyhours84
    @sunnyhours84 8 ปีที่แล้ว +93

    Wow, amazing sum up of all these techniques. You can tell she has been a teacher. Tough crowd though.

  • @zwdxff5493
    @zwdxff5493 7 ปีที่แล้ว +2

    I have done many researchers about functional programming in JS. She could explain concepts clearly. This one is the best. 1 function is everything. 2 side affect is really clear.

  • @dtsleite
    @dtsleite 7 ปีที่แล้ว +29

    I´m not an english native but I can understand each word she says! Great!

  • @hfontanez98
    @hfontanez98 5 ปีที่แล้ว

    She got my thumbs up the moment she started talking about the problems with mutability. You'll be surprised how many people still believe that immutability is bad instead of the other way around.

  • @EdwardVarner
    @EdwardVarner 8 ปีที่แล้ว +82

    Great into to FP and using it in JS! It's a shame the room was so dead, but she soldiered on anyway.

    • @wullxz
      @wullxz 7 ปีที่แล้ว +10

      She talked about face expressions of her audience. Maybe they were just too startled by her good communicative skills and by her amazing talk to laugh or say something ^^

    • @LuisGuillermoMoreno
      @LuisGuillermoMoreno 7 ปีที่แล้ว +8

      Edward Varner empty? I can see almost 600k attendants here

    • @jeffery_tang
      @jeffery_tang 3 ปีที่แล้ว

      The ending was pretty funny

  • @crossfitbilly
    @crossfitbilly 4 ปีที่แล้ว

    Anjana is an excellent speaker. SHe made several concepts quite easy to understand, that is a gift. She should do this more. I hope she does.

  • @KresnaPermana
    @KresnaPermana 8 ปีที่แล้ว +55

    She's pretty good as a speaker and sure it's well explained!
    thanks

  • @anvarsaidov8964
    @anvarsaidov8964 2 ปีที่แล้ว

    You feel like fish a pond in that audience. All discussed is still relative in 2022, seen them all used in my current project. It's been a pleasure to watch and learn from you.

  • @Perhelion1
    @Perhelion1 4 ปีที่แล้ว +16

    I've never seen a "programmer" talking so lequit and expressive.

  • @jvwdigital
    @jvwdigital 7 ปีที่แล้ว +1

    awesome awesome presentation. As a newbie, this was so insightful. Vakil's ability to communicate what she knows, along with her ability to know what she doesn't know, made her an extremely reliable authority on the subject of FP. I can't believe I watch the whole thing. Great presentation.

  • @aldinlapinig
    @aldinlapinig 8 ปีที่แล้ว +23

    wow... how did you manage to explain things in a very simplistic manner?? Great job on the presentation! Keep it up...

  • @pitpotputpet
    @pitpotputpet 3 ปีที่แล้ว +2

    Pretty sure she made it to the end without saying "functions are a 1st class citizen" once. Bravo 👏🏻

  • @viksam009
    @viksam009 7 ปีที่แล้ว +36

    She is so easy to listen to. Its like listening to a radio jockey.

  • @davidkim7410
    @davidkim7410 3 ปีที่แล้ว

    Can’t quite read all the comment, but I think people all find her easy to listen to. Although I did rewind and playback a few times while watching, speeded up 2 times faster in the rear, I did enjoy her presentation very much.

  • @bradv5982
    @bradv5982 7 ปีที่แล้ว +9

    I'm not a JS developer, but I still found this talk really enlightening, and can translate the methods in this talk into other languages without any problems.
    Now excuse me, I have the sudden urge to get a subway sandwich

  • @carolinec8084
    @carolinec8084 2 ปีที่แล้ว

    I could listen to Anjana speak all day, such an engaging speaker making JS FUN (dare I say?!)

  • @christerjohanzzon
    @christerjohanzzon 5 ปีที่แล้ว +3

    3 years later, this is still brilliant! A really good explanation that I am going to refer to.

    • @Killofamas
      @Killofamas ปีที่แล้ว

      6 years after, still is !

  • @mollymccarronproduct
    @mollymccarronproduct 5 ปีที่แล้ว +2

    I am new to JS and coming from an object oriented Ruby background I was struggling to understand the 'why' of functional programming. This video brought so much clarity! Thanks so much Anjana! Such an entertaining and easy to follow talk!

  • @Vaibik
    @Vaibik 7 ปีที่แล้ว +12

    I am glad I stumbled upon this video. I would watch it again. Informative and enjoyable at the same time. Personally a fan of FP more than OOP. She's a Great communicator! Should become a teacher. The audience seems to be on the opposite spectrum of the scale of sense of humour. Personally I liked more because I am also an Indian origin person (from the same sub-culture) and sometimes the young (and old) Indians outside India are not so great communicators. She is totally breaking that stereotype. I also connect with my audience like this and sometimes I face such tough crowd as well. :D

  • @gr5791
    @gr5791 ปีที่แล้ว

    Watching this video made me realize I've been doing functional programming all this time... Really great explanation and insight!

  • @elirane85
    @elirane85 7 ปีที่แล้ว +22

    Awesome video.
    I just wanted to add that it's kinda funny how Functional Programming is considered a "new" trend when in fact it existed way way before OOP.

  • @USONOFAV
    @USONOFAV 4 ปีที่แล้ว +2

    You can use OOP amd FP together in different granularity. Use OOP to identify boundaries in the architecture and use FP inside those boundaries.

  • @larryd9577
    @larryd9577 5 ปีที่แล้ว +10

    This auditorium felt so familiar the whole time... It is the one I sit every week in. 😂 It's the Geomatikum in Hamburg.

  • @diamond-iamthemaincharacter
    @diamond-iamthemaincharacter 2 ปีที่แล้ว

    Im from Japan. Although Im not used to hearing English presentation, I could fully understand the concept of FP because her explanation was amazing. Thanks a lot

  • @dmaMsk
    @dmaMsk 8 ปีที่แล้ว +13

    This is really just an introduction, but I couldn't like it since the presenter is super energetic and her manner to articulate and explain things just have captivated me :) Good talk! Way to go, Anjana Vakil!

  • @abnormalmindset
    @abnormalmindset 5 ปีที่แล้ว +2

    I remember watching her lecture about a year ago as a newbie to Functional Programming. Now that I have some knowledge in FP I really enjoyed her lecture.

  • @leeritenour
    @leeritenour 4 ปีที่แล้ว +95

    8:14 People say that she was once a Kungfu master.

  • @jewel.barman
    @jewel.barman 4 ปีที่แล้ว

    She's a god to all the coders who can't explain what they're doing even when they're doing the correct thing.

  • @PRINCE-XII-A
    @PRINCE-XII-A 2 ปีที่แล้ว +4

    Her voice is so good 😍

  • @joemoorhouse276
    @joemoorhouse276 7 ปีที่แล้ว +1

    as a junior developer fluent in ruby and beginning to learn javascript, this is an awesome video

  • @Ganesh-Shrestha
    @Ganesh-Shrestha 8 ปีที่แล้ว +7

    Awesome, nice presentation on intro to functional programming and a great transformation from English Teacher to Computational Linguist turn now as Software Developer. Great Job !!!

  • @ISHANKHANDELWALBCE
    @ISHANKHANDELWALBCE ปีที่แล้ว

    Great talk. The way she explained fp so elegantly makes me want to be her student.

  • @micjakes1
    @micjakes1 5 ปีที่แล้ว +14

    Thank you for defining a function. Takes the smart to make things simple.

    • @pierreafoutou7368
      @pierreafoutou7368 4 ปีที่แล้ว +2

      She has this ability to explain things very well 👌

  • @sashamc309
    @sashamc309 3 ปีที่แล้ว

    this presentation was a gem at the time. I didn't realize how important this was for my understanding of FP in JavaScript, along with many other articles and videos. Just learning about mutations, what is Array.prototype.reduce, what is Array.prototype .map - explaining these in simple language is tremendously helpful for people trying to get into modern functional JS.

  • @LanguageSkillz
    @LanguageSkillz 4 ปีที่แล้ว +5

    I very much appreciate Anjana's wonderment at Functional Programming approaches to organizing and executing JS code, and her explicit experiences implementing alternative strategies to for-looping. The relief was so apparent. 'Zaiste' has a nice Functional Programming overview as well, although it does not come up cohesively in TH-cam. His address of predicate functions, as boolean, as filter, as closure check, prepped me so kindly for this lecture, and her mention of the mori library sounds like a superb option after delving into some _lodash. JS presents a most-robust programming language, and Node (and/or its insights) seem to free it from much object-oriented mayhem it can fling. Happy to look up your work on Node since this, AV.
    Can't express enough how refreshing this has been, especially after regarding some D. Crockford highlights of features that've been outright forced or misapplied, perhaps due to programmers' depth of experiences with other languages and extents of ineptitude regarding how to play to JS strengths. Yet JS is now a most vast body of internet code and with such varied approaches having been validated by several rounds of practices/schools of thought already. Some can sprawl outright Loch ness tentacles, and coming across legacy code is ever a thing.
    The Functional JS approach is also a favorite of mine, extending that single lamda strength to center function-as-object and within a more amazing nodular mesh.

  • @helixobscura451
    @helixobscura451 7 ปีที่แล้ว +1

    Really engaging talk, she's able to make programming talks less of a bore.

  • @jsnadrian
    @jsnadrian 5 ปีที่แล้ว +6

    really cool talk - like how sincerely excited she is!
    im still pretty horrible at functional thinking, but that's on me.

  • @sunnysheikh1090
    @sunnysheikh1090 5 ปีที่แล้ว

    grate communicating power.....i m also a student and has started my career its very helpful special thanks to uniconf for providing her platform and allow us to hear her....and thank to anjana also

  • @karanpadda
    @karanpadda 8 ปีที่แล้ว +202

    i feel motivated, i think we need more women programmers for sure.

  • @fazalmehmood6802
    @fazalmehmood6802 4 ปีที่แล้ว

    As a full stack developer based in Norway, none of the concepts she explained were new to me but I did it anyways because she is such a great speaker. I wish I could meet her in real life and exchange ideas.

  • @agentsmidt3209
    @agentsmidt3209 8 ปีที่แล้ว +321

    Great speaker.

  • @BabyBearRudy
    @BabyBearRudy 5 ปีที่แล้ว

    She was really good at explaining this. Not many resources out there elaborate on these ideas and simplify them the way she did. Great job, you can tell she is an educator at heart.

  • @AmbuSreedharan
    @AmbuSreedharan 5 ปีที่แล้ว +3

    Your teaching experience really shines through the talk. Great stuff!

  • @luisluiscunha
    @luisluiscunha 3 ปีที่แล้ว

    Great presentation. I almost missed giving her a like, but than I saw the 1.6K envious people who wish they could do a presentation like hers.

  • @kasvith
    @kasvith 3 ปีที่แล้ว +15

    Damn I can watch this all the day

  • @shahhussain3134
    @shahhussain3134 3 ปีที่แล้ว

    i watched this video years ago during my graduation, and I fell in love with functional programming. ahh that sweet code!

  • @Roshambo3
    @Roshambo3 5 ปีที่แล้ว +59

    Amazing presentation. This gave me a ton of “ah-ha” moments. She explained it really well

  • @ajayhemanth
    @ajayhemanth 5 ปีที่แล้ว

    She was great !!! And also she was humble enough to say that she was not qualified to talk about certain topics, which made her even greater ...

  • @vim6284
    @vim6284 7 ปีที่แล้ว +9

    wow.. just... wow... I've seen a whole bunch of videos on youtube and subscribed all the channels related to programming but couldn't get a decent concept of this functional programming stuff. I was even thinking that, maybe these evil programmers intentionally manufactured this fake concept of FP, which means nothing in reality, in order to waste my time. After watching this video, however, it just blew my mind. I'll even say this video changed both my life and my future career as I'll set aside this OOP which gives me tons of headaches and eager to become a FP programmer from now on. Thank you so much, you just had a huge impact on one's life.

    • @lukasjost44
      @lukasjost44 4 ปีที่แล้ว

      I am very curious now. Has your life been changed? :D

  • @expertsconcepts6708
    @expertsconcepts6708 4 ปีที่แล้ว

    I don't think she is learned these in 6 months, as I am programmer for the last 1 decade and I may not deliver this knowledge in this way... !! simply awesome.

  • @zero11010
    @zero11010 2 ปีที่แล้ว +3

    12:09 I’ve seen this abused by front end engineers a lot. Map, filter, reduce and some others do a lot of work. In the right situation they’re great.
    Each is a full iterative loop. Each builds a new array.
    I’ve seen these chained to .map().filter().map.()reduce().map() results.
    When dealing with large amounts of data this is a whole lot of looping and a whole lot of extra arrays being created (which is essentially an extra action on each element (2N+ instead of 1N), plus the space it takes up).
    If you know it’s a small amount of data the inefficiency hardly matters. If the data can grow it’s really worthwhile to write something much more custom. These kinds of solutions can be many times faster.
    It’s like building an array and iterating with includes or find or whatever. If you could have built a set and had constant lookup that would have been the right answer. You don’t get a pat on the back for not looping with map or filter or forEach if the right solution is constant look up from a set.

    • @DryBones111
      @DryBones111 2 ปีที่แล้ว

      That's the issue with the built-in array prototypal implementations but typically in a well designed library (or an actual FP language) these operations are composed and recursed through once, applying the functions using thunks.

    • @ee-vk7is
      @ee-vk7is ปีที่แล้ว

      hey my english is not that good but im trying to understand this sentence : "You don’t get a pat on the back for not looping with map or filter or forEach if the right solution is constant look up from a set."
      "You dont get a praise if you are not using loop , if the solution is to use set ?"
      Shouldnt he get praise ? Or get a praise if he is not using loop ?

    • @zero11010
      @zero11010 ปีที่แล้ว

      @@ee-vk7is it means you don’t get praise for avoiding this kind of loop if the ideal solution was to avoid using an array in the first place.

    • @ee-vk7is
      @ee-vk7is ปีที่แล้ว

      @@zero11010 That means, "just do whatever solves the problem, but maybe try to achieve the ideal solution" ?

    • @zero11010
      @zero11010 ปีที่แล้ว

      @@ee-vk7is it means a solution that isn’t optimal isn’t very impressive.
      Praise comes from a more optimal solution. There are a million ways to write code that will accomplish a given task. A VERY small percentage of those are ideal (worthy of praise or recognition).
      I’m sure you’ve seen code like what I was originally speaking about. It takes up very few lines on the screen. It takes a thing and runs 4 or 5 separate array methods where many of those methods will separately create a new array and EACH is a separate loop over the data.
      It’s slow and lazy way to write code. Lots of people do it. Mostly because they don’t know better or aren’t held to higher standards.
      It’s MUCH more common with front end code because if you’re almost always dealing with small amounts of data then this kind of thing can be acceptable.
      If you have an array with 10 elements and you iterate over it 5 times and create 4 additional duplicate arrays that are just garbage … well, it doesn’t matter a ton. That’s a small amount of work and it’s all happening on the client side. That’s still hundreds of operations and 4N space you’re taking up. But, if N is small that’s not a big deal.
      It would still be better, in most situations, to write easy to read code that does the same work in 1N space and 1N time (instead of 4N space and 5N time in this example). Again … if N is equal to 10 … it hardly matters either way. But, if N becomes more considerable and if the code is filled with these inefficient patterns … things will add up quickly.

  • @adithyanow
    @adithyanow 7 ปีที่แล้ว

    i don't know anything about programming and i was watching the whole thing ..!!!!..........she is awesome

  • @adagas-caouchristian7875
    @adagas-caouchristian7875 5 ปีที่แล้ว +3

    Great talk. I'm a webdev rookie and since I'm used to functional programming in other languages I was wondering how one could use this paradigm properly in JS. Thanks a lot.

  • @andrewilliams1974
    @andrewilliams1974 4 ปีที่แล้ว +1

    Anjana definitely had my attention. I learned a lot from her and she is easy to listen to. Great communicator!

  • @wynwilliams6977
    @wynwilliams6977 8 ปีที่แล้ว +71

    Anjana Vakil a fucking awesome speaker, got my kid really into it

    • @nurudeenkarim994
      @nurudeenkarim994 8 ปีที่แล้ว +15

      you ruin everything with the F-word. But i agree. great speaker.

    • @wynwilliams6977
      @wynwilliams6977 8 ปีที่แล้ว +63

      Nurudeen Karim F-word? you mean 'fuck'? go on say it three times fast it will make you feel good ;)

    • @nurudeenkarim994
      @nurudeenkarim994 7 ปีที่แล้ว +10

      Wyn Williams
      LOL

  • @HaskellMadrid
    @HaskellMadrid 8 ปีที่แล้ว +2

    If you want to use functional programming you have big tools: Elm, Pure Script and Elixir and also you can compile Haskell code in JS through the Haste compiler. Those languages are really functional.

    • @carlosjhr64
      @carlosjhr64 7 ปีที่แล้ว

      Yes... If you really have to use JavaScript, use one of the "compiles to JavaScript" languages.

    • @lrhlpz
      @lrhlpz 6 ปีที่แล้ว

      or F# using Fable

  • @p.z.8355
    @p.z.8355 4 ปีที่แล้ว +5

    why is the hype about functional programming though ? why is persistency & immutability & pure functions good ?

  • @marconiiii
    @marconiiii 4 ปีที่แล้ว

    I just started getting a little more deep into programing and specially on Js, so I found this introduction to functional programming very very useful to really understand the structure of programing and not only just a bunch of tools or instructions that all can we learn here and there. she was very clear with all those examples. cool conference!

  • @amypellegrini1732
    @amypellegrini1732 8 ปีที่แล้ว +8

    Thanks to his talk I realised that I was already doing functional programming without knowing it.

  • @matomarkovic6765
    @matomarkovic6765 4 ปีที่แล้ว

    Difference between "I understand what im talking about" and "I know about that". She put some extra hours into this - and understood it. When you archive this, there are no limits anymore, since you broke the barrier that was holding you.

  • @aurelianspodarec2629
    @aurelianspodarec2629 7 ปีที่แล้ว +4

    Wow, she changed soo much

  • @cgoodwin2127
    @cgoodwin2127 5 ปีที่แล้ว

    Lucid. Concise. And can be played @ 2X without losing comprehension!

  • @xRJ
    @xRJ 8 ปีที่แล้ว +6

    good beginner's intro to fp.. wish I knew all this before starting react/redux

  • @ajayboro4514
    @ajayboro4514 3 ปีที่แล้ว

    I was conquering javascript functional programming on the freeCodeCamp curriculum and my mind stuck at it then I remember this video which I watched a couple of months ago however, I didn't understand then. Today I have watched it again and it makes sense to me what is functional programming is about. Thank you Anjana Vakil for this wonderfully simple explanation. It helped noobies like me.

    • @kartikkalia01
      @kartikkalia01 3 ปีที่แล้ว

      Hey I'm learning JS for web dev, I've previously solved some DSA problems on hackerank. So should I go for freecodecamp? Or anything else, please suggest.

  • @iocusdigital6534
    @iocusdigital6534 3 ปีที่แล้ว +5

    "I am just starting learning JS" -> speaking at JS Conf
    23:43 "I am here thanks to diversity ticket" -> meritocracy
    28:40 "Non-blocking concurrency and Promises are all things that I don't feel qualified to talk about right here. I would love to turn that question over to the audience. Anybody want to respond?" -> still meritocracy
    .... at this point everything is possible.
    I can go in a 3 michelin stars restaurant and teach them how i am learning to make apple pie.

  • @mskiptr
    @mskiptr 2 ปีที่แล้ว

    Fun fact:
    function hello() {
    return () => { console.log("Hello world!") }
    }
    is a pure function!
    You can compose and re-use it as you wish, since it won't do anything until you execute its result.

  • @blykgod
    @blykgod 8 ปีที่แล้ว +30

    Good speaker and good topic but I still dont see any advantages of functional programming over OOP

    • @Archus88
      @Archus88 8 ปีที่แล้ว +19

      Lemme give it a shot at explaining this with an example. Say I have an array of even integers and I ask you to write a function that returns the sum of the halves of the elements in the array. In classical style you would declare a variable such as 'sum', initialise it at zero, then loop through the array and increasing the value of sum by the half of each element
      function myFunction(elements){
      var i,sum = 0;
      for(i = 0; i < elements.length; i++)
      sum+= elements[i]/2;
      return sum;
      }
      with a functionnal approach, you see the problem as passing your array successively to two functions : the first function to map each element of the array to half its value, the second function to sum up the elements two by two and repeat the process until there's only one element left.
      function myFunction(elements){
      return elements.map(function(m){return m/2})
      .reduce(function(a,b){return a+b});
      }
      When your problem can be expressed as purely successive transformations of input, through a series of functions, then functionnal programming can save you a lot of time, lines of code and is really elegant.

    • @ktkdinesh
      @ktkdinesh 8 ปีที่แล้ว

      exactly my point.

    • @andreschannel
      @andreschannel 8 ปีที่แล้ว +5

      I just watched the first 10 minutes and what I see is just common sense good programming practicies that can be applied to any paradigm. But I also know that FP can be very interesting.

    • @zurvey
      @zurvey 8 ปีที่แล้ว +5

      People are asking questions that can't properly be answered in a small comment box. If you are serious about knowing, I recommend you search for and read two excellent essays on the subject.
      1. "Goodbye, Object Oriented Programming" by Charles Scalfani.
      In it he wrote:
      “It’s taken me years to realize how OO lied to me. I too was wide-eyed and inexperienced and trusting. And I got burned. Good-bye, Object Oriented Programming. Hello, Functional Programming. It’s been so nice to work with you over the past few years.”
      2. "Functional Killed the OOP Star" by Tom Pittman.
      He goes over 7 real-world reasons to give functional programming a chance:
      1. Better Software Quality
      2. Better Concurrency
      3. Improved Developer Velocity
      4. Lower Software Development Costs
      5. Improved Scaling
      6. Easier Team and Project Management
      7. Higher Programmer Happiness

    • @Xehanort94Ger
      @Xehanort94Ger 8 ปีที่แล้ว +5

      When doing functional programming you will probably be doing transformation of data. If that data itself is immutable, the whole algorithm will be easy to run concurrently. By having a algorithm that can easily run concurrently you can use it more versatilely. You could speed it up by parallelizing it (MapReduce), or run computation of data in a different thread so your GUI doesn't freeze in desktop applications. Also functional algorithms tend to be easier to reuse since you just push in data and get data back, without side-effects. That being said, you could also achieve all this using OOP, but FP restricts you in just the right places. That doesn't mean that FP is better tho, it just works well for transforming data. A lot of new languages will be object oriented at their core but provide you with some functional tools (like Java 8 streams). There are also hybrids that are functional at their core, but support the OO paradigm for things that are better solved using objects. For example you could take F# and easily embed it into a existing C# application. You would use C# to handle the UI, database, DDD, you name it - and use F# for data crunching, testing and what else floats your boat.

  • @TBaguette
    @TBaguette 4 ปีที่แล้ว

    I don't know anything about JS but I'm curious about the JS ecosystem, and I understood every single sentence. That's how clear she is.

  • @ashishjha9262
    @ashishjha9262 7 ปีที่แล้ว +18

    directly watch from 4:56 :)