Robert C Martin - Functional Programming; What? Why? When?

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

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

  • @AlexandriaRohn
    @AlexandriaRohn 9 ปีที่แล้ว +422

    4:07 "Functional Programming: What? When? Why?" -or- "The Failure of State"
    5:10 Rich Hickey is the author of Clojure. Listen to his talks.
    5:40 What is state? Variables.
    11:15 Structure and Interpretation of Computer Programs. This is a fascinating book.
    For the first 250 pages, the book uses no assignment statements.
    14:15 Here's how SICP's model of computing worked before they introduced an assignment statement. Simply replace a function call with its implementation.
    15:58 Once you introduce assignment. You can no longer replace a function call with its implementation. Why? Because the state of the system may have changed. An assignment statement introduces the concept of time.
    18:04 Side effect: an assignment statement. If there's no assignment, there's no side effect.
    20:22 What "hack" have we done to protect us from memory leaks? Garbage collection.
    31:46 Functional programming was invented in 1957 before OO and structured. But memory was too expensive to make it practical. But memory is cheap now.
    32:53 Should we change how we program? We should because: 1) Functional programs are simpler - which makes them easier to write and maintain 2) There's no temporal coupling - no worrying if some function was called before another function. 3) Fewer concurrency issues. In a purely functional program, there's no concurrency because there is no state. 4) No asking, "What's the state?"
    38:38 We're using multicore CPU's now because we can't increase clock rate anymore. And hardware makers are doing bizarre tradeoffs. They're making individual processors slower but putting more processors in. So individual cores slow down but the chip throughput goes up *if* you can take advantage of all the cores.
    42:00 How are you going to work with an abundance of cores? Maybe we need to walk away from the assignment statement.
    49:49 OO = procedure + state. OO is exposed procedure but hidden state (encapsulation). It's possible to write functional programs using an OO style. All of the objects become immutable.

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

      +Andrew Rohn Thank you :) Especially the first one was very helpful.

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

      +Andrew Rohn ,it's really very useful. Thank you.

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

      thanks a lot!

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

      Thank you, man!!

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

      Thank's mate. I love Uncle as much as the next guy, but I just like efficiency more.

  • @bugs1yb1ins
    @bugs1yb1ins 3 ปีที่แล้ว +49

    6 years later, TH-cam recommends this to me and functional programming still hasn't taken off. Mainstream languages are simply taking from fp what they like.

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

      how would you have done it

    • @seekknowledge8034
      @seekknowledge8034 3 ปีที่แล้ว +22

      I'm watched over 10 videos about FP. Not a single of them has shown practical real world examples.
      Programmers are difficult to adhere because you need to practically demonstrate. Why not side by side demonstration?

    • @shinsawai1
      @shinsawai1 3 ปีที่แล้ว +6

      Well they are not taking what they like but they are taking what will improve their mainstream language. Java is getting more functional programming features, C# had them for a while Ruby had them for a while. Functional programming languages such as Closure, Scala, Rust and Elixir are really taking off. Javascript was initially going to be a functional programming language if Java was not hyped at the moment Javascript was created. If Javascript would have been a fully functional programming language functional programming would have been mainstream at this moment.

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

      @@shinsawai1 I wouldn't say that. JavaScript has, from day one, fully supported functional programming. The only feature that was missing was tail call optimization, but that isn't necessary as it is trivial to convert a tail recursive function into an iterative one.
      There are any number of reasons I could offer you for why no one programs in a functional style in JavaScript. The most obvious being that most JavaScript programmers don't really know anything about the language. Less obvious are the same reasons functional programming never really took off -- the dirty little secret that Lispers and Schemers won't tell you -- functional programs, that do useful work, are harder to read and harder to write than their imperative equivalents.
      The way forward is to just take some of the more useful concepts from functional programming. First class functions and closures are at the top of the list, of course, as those two things alone completely eliminate the "need" for most of the design patterns that have plagued software for the last 20 years. When Greenspun quipped "Any sufficiently complicated C or Fortran program contains an ad hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp" He had no idea that the GoF book was going to make that the industry standard!

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

      @@recompile Haskell is easy to read and write if you care to make it so but it is hard to make it fast and use constantly little memory, and all the libraries keep changing and becoming incompatible with each other, and the complexity diagnostics break, and no one seems to know what's breaking, broken, about to break, etc. And all the modules have conflicting names, yet it's obvious that any expert in the language could have defined a self compatible and fuller suite of typeclasses. There are plenty of experts. So it looks like Haskell is a problem ON PURPOSE! I just don't know whose purpose.

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

    6 years on, at least from posting, and ThreadRipper is up to 64 cores.

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

      rome has even more
      but those are multi-die processors
      from what i remember at least, the 3990x has 8 dies, 8 cores each, plus one die for IO
      so 8 cores per die is still how many we can cram in there.
      transistor size can not easily go much lower, because atom dimensions
      chip dimensions can not easily go much larger because electric signal propagation velocity
      transistor count can not easily go down because boolean arithmetic
      it will be interesting

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

    It took me half a year to fully understand this video (and make learn Scala as well) :)

  • @oniaiki
    @oniaiki 9 ปีที่แล้ว +15

    It's a grea talk!
    I think a lot of people is missing a point here. And you should watch other of his talks on TH-cam. Besides of alll knowledge he can convey on his chats there is a Historical Big Picture point of view he wants to transmit. We tend to think there are many "new" things on programming, but we may have a short memory.
    Then someone like him let us find out that somebody already did it 40 years ago, with less resources.
    Why movie industry keep doing remakes and a mix up of other old times proposals. Because new generations will see those as "New". That way make sense to reinvent the wheel every iteration with more bells and whistles. The better and actual it looks, you get more ROI.
    I heard his talks, he has no problem working with other languages. But always tells the programmer keep your eyes open. Don't get caught inside a mindset. Remember what you have now has evolved from the past.

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

    The bowling example here is the bedrock of the motivation of using functional programming, but it could be much improved. For example, the `roll` serves completely different purposes in the functional approach and its imperative counterpart.

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

    The presentation I wish I seen first, when I was transitioning from stateful OOP to Functional.

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

    There are these beautiful moments where Robert sounds so much like George Carlin : )

    • @edwardmason119
      @edwardmason119 2 ปีที่แล้ว +1

      He sounds more like a cross between Patton Oswald and Lewis Black to me.

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

    Now I understand the need for functions programming. Thanks Uncle Bob.

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

    "As the tests get more specific, the code gets more generic..." - "As the tests get more specific, the code gets more generic..." - gotta love Uncle Bob!

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

      Richard Moore The fp world has a similar statement, “the more the generic the types, the more specific the implementation.”

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

    Structure and Interpretation of Computer Programs... geez. I remember that book. 10 years ago, CS1301

  • @FlashManinSpace
    @FlashManinSpace 9 ปีที่แล้ว +15

    That was the best talk on programming I've ever heard!

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

      +Flash Man yeah i said that a lot with ubm

  • @dmytrosokhach2598
    @dmytrosokhach2598 9 ปีที่แล้ว +15

    At the half of the video - and love it! So much fun! :-D I wish all the educational videos were that way.
    The topic is really good for OO-guys who doesn't yet understand the value of immutability and pure functions.

  • @therealmicksa
    @therealmicksa 9 ปีที่แล้ว +69

    What a disappointment - not _once_ did he say "Inconceivable!".

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

      hahaha yeah he really does sound like Vizzini

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

      😆

  • @douglasmckinley-sr1507
    @douglasmckinley-sr1507 3 ปีที่แล้ว

    Always fun to watch an older TH-cam video and have the benefit of hindsight.
    Moore's Laws -- 2014 -- 8/16 Gb Thumb Drive - 2021-- 1 Tb Memory Stick ($36) - TRUE
    FUNCTIONAL PROGRAMMING - Is the future?? Guess that is still TRUE as it has not happened yet.

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

      And with AMD about to give us 64/128MB L3 in mere months, with a mere 16 max desktop cores...what was that about removing cache for more cores? 😆
      LISP will always be the future. Been that way since 1958.

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

    It's early 2017, AMD's 8-core Ryzen 7 processors have hit the market.

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

      It is now mid-2019, AMD has left Intel in the dust.

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

    I like the preaching style. Yeah it's nice to have pure functions. Shame you also have to run code on computers where regardless of how 'free' memory is (it isn't really when you have lots of data to work with) it still takes time to access it.

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

    He sounds like the T-Rex from toy story

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

      LOL

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

      If the T-Rex was speaking at half his normal speed

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

      lol i never saw toy story so I checked it and the trex does sound like uncle bob

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

    Considerably better at 1.5x speed.

    • @韩光-j8z
      @韩光-j8z 8 ปีที่แล้ว

      +Joshua Jurgensmeier can't agree more LOL

    • @韩光-j8z
      @韩光-j8z 8 ปีที่แล้ว

      +Joshua Jurgensmeier can't agree more LOL

    • @jbweimar
      @jbweimar 6 ปีที่แล้ว +1

      I turned it up to 2x speed. Amazing that at even then his speech sounds like 1x speed sometimes...

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

    Yeah... functional programming is great for web back-end, while this is not the entire programming scope. I work in gamedev and here objects are pretty suitable. There are certain areas where keeping the state is quite important and having objects is helpfull.

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

    that squares I think isn't the greatest example anyway, because local variables are not the problem functional is meant to solve, it is more to allow escape from external variables being changed by a function directly (side effects) data within the function, all bets are off

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

    When Robert C Martin says assignment statement introduces the concept of time. Does he mean assignment to a variable within a function or assignment to a variable contained within an object. How is the assignment of a variable within a function like in a for loop dangerous? When the function completes running I don't care about any local variables that the function used but I will care about any external variables I modified? Similarly why will f(x) ever be not equal to f(x) if the function f never uses any external variables? I guess in the example of Bowling he explains it with an example of assignment to variables within the function and calls it quasi functional. Is that bad? I can clearly see how the example of Bowling with state can be problematic and break the AssertEquals(f(x), f(x)) rule

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

    At 21:30 he mentions how languages have introduced the hack of garbage collection to deal with side effects relating to memory. And here I'm programming in C++ with destructors to automatically deal with every kind of side-effect he mentioned, and no garbage collection ('cause C++ programmers don't write garbage).

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

    side effects are like the sith...always two there are....that killed me

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

    News flash: A statement in most computer languages is not a statement of fact like it would be in Math. x=x+1 says add 1 to the value at location “x”. Or you could say, calc the value of x+1 and then store the value to the location labelled “x”. A statement might look like a Mathematical formula (a statement of truth) but it is actually a calculation and then the storing of the answer so you can use it later. There is no problem with this computer interpretation of this syntax and it has worked for the last 70 years. The misunderstanding is that only Math notation is useful when provably that is not true.

  • @porky1118
    @porky1118 6 ปีที่แล้ว +2

    The language I'm using also does the function substitution thing in some cases depending on the constness of arguments.
    It also has no garbage collection.
    Even with functional programming, one could do compile time optimizations, so it won't even consume more memory.
    About the parenthesis number in lisp langauges: It's sometimes a bit more.
    Examples: Multiple parentheses at once (for example in CL `let` statement `(let ((x 1) (y 2) ...)`) or Simple math (`(+ (* fac a) (* (- 1 fac) b)`)
    But at least it uses less commas and semicolons.
    (The language I'm using also is a lisp, but with indention based syntax (like python), so it even has less parentheses than lisp and less syntax than python or c in general. (just a few predefined macros and read macros to simplify langauge)
    Also in some cases, state is almost required, for example for simulation of moving objects (like in most games). Making a copy for every acceleration may be pretty inefficient.
    And I even like to use other "bad" practices (at least function pointers rather than some complicated OO stuff, closures are fine, but are practically just like function pointers), or sometimes even goto is better than a loop (at least the c-loops, named let is also a powerful loop technique, similar to goto, and you have better control than with c-loops)

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

      which language is that?

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

    Since when were they supposed to be getting rid of speculative execution and pipelining? AFAIK Meltdown and Spectre are still active issues solutions have not been found to yet.

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

    Memory is cheap and fast to use when you have a very expensive PC or high-end ARM processor. When you use small microcontrollers, small amounts of internal memory are not that cheap, and external memory access are too slow to be really efficient. Computers and phones are not the only programmed devices we live with, they're even far from being the majority and it would be stupidly expensive to run everything on an ARM+Linux.
    This lecture's got the usual bias of PC only devs. The industry still needs programming languages with small memory imprint.

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

      +romsthe
      You are referring to embedded system.
      More powerful systems will eventually be pushing towards functional programming where memory is not important.
      Even laptops are getting to point were all the excess memory is not required unless running higher performance tasks.
      Some day embedded systems and micro controllers will be using high-end memory like lap tops today.

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

      +bighands69 If the 4-cores + 4G RAM ARMs processors ever get into the 1-2$ price range maybe. Otherwise, not gonna happen.

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

      I'm pretty sure you won't find anyone advocating using F# for programming microcontrollers. You're mixing oranges and apples here really. No one is claiming that low-level languages are dead or dying.

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

      Well I'm glad to hear, or read, though the lecture considers functional programming for any kind of fruit. I guess my real concern is I'd like to see more efforts in proposing new languages/concepts for embedded. I'd love to see a language with java/C# look, very loosely object (like function pointers in the struct for modifiable methods only), with minimal memory impact and NO freaking header files. But on that last point, I'm pretty sure many would agree.

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

      I'd be glad to see microprocessors that are tailored to the functional paradigm, like the Reduceron project.

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

    Very nice. Thank you, Uncle

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

    He sounds like a mad preacher! Sound pretty good.

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

    Actually, the answer to the both questions on the origin of Nitrogen and Oxygen is simply that they came about as fusion products during sopernova explosions. :P

  • @colinrickels201
    @colinrickels201 2 ปีที่แล้ว +1

    Only a functional dev would claim a recursive function is more safe than a for loop

  • @Aki-to
    @Aki-to 4 ปีที่แล้ว

    Loving the scientific introduction.

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

    Close your eyes and imagine Patton Oswalt delivering this presentation. You will never be able to un-hear it.

    • @JeremyAndersonBoise
      @JeremyAndersonBoise 9 ปีที่แล้ว +1

      +Trevor Exley You just ruined and/or improved Uncle Bob talks for me forever.

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

    Bob, with every conversation we've had over IM/email/usenet back in the day, I've always just instantly connected with the *why* of what you had to say.
    VERY good job. Just wish you had more time.

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

      Do you know uncle Bob?

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

    It is 5 years later and Intel processors still have cache in them. Maybe he's talking about AMD.

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

      Yeah and we hit faster speeds than 2.5Ghz, seems sort of poorly informed. Pipelining hasn't gone away either.

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

    It's interesting and sometimes funny, yet i wonder if this is a cult?

    • @MrGoatflakes
      @MrGoatflakes 5 ปีที่แล้ว +1

      That's not really much different from every other camp in computing or anything else for that matter. Pretending to be the answer to every problem or question is rife.
      If you aren't going to be swept up and be taken for a ride that might cost you have to dispassionately separate the wild hyperbole from the actual costs and benefits of the new discipline that is being imposed and think long and hard about where such an approach will benefit you.
      Building an easily replaceable tool, small utility or short backburner project is as always a good way to get your feet wet and see if it might be something you could commit more resources to.

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

      Only, "the new discipline that is being imposed" is actually the old discipline from the 60s that keeps being brought back because all the alternative shortcuts we have been trying since then keep failing on us.

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

      A cult asks you to believe in things without providing any logic or evidence... uncle bob lectures never ask you to take anything on faith... he provides reasoning and justification for everything.

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

    21:47 imho the roll()-method pushes an element to the rolls-Array, changes its length thereby and therefore is not pure. However it is true that no elements are mutated. But the whole list is beeing mutated.
    Another more general point I thought about: making value assignments to named identifiers mustn't be avoided at all costs. It has the purpose to add meaning to a value which you can comprehend when you read the code! This can significantly reduce complexity. But you should avoid globals and use local variables only in very close scopes. In JavaScript e.g. there is the new let-keywod which lets you define a variable only for the current block and not the child block. This is imho great!

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

      +Lorz Ronz I think there might be some confusion about declaration vs. assignment. Declaring values is ok in functional languages. Lisp has a let function too. You can do (let ((x 3) (y 4)) (+ x y))). The problem comes when you re-assign a new value to an existing value. So in a non-functional language, doing `int a = 10` is not violating immutability, but then doing `a = a + 2` is. Thus, you can have your descriptive value names.

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

      +Vectorh I think you cannot _declare_ a value. You can only declare an identifier which holds no value yet, like 'int NumberOfCoffeBreaks;' You declare the variable's type and its identifier so the compiler can work with it. After that you may assign/define a value to the variable like 'NumberOfCoffeBreaks = 30'. But using variables at all is forbidden in strict functional programming. You just work with return values of functions. That is what I got so far and it is imho a bit over the top...

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

      What I'm trying to say is your fears are unfounded. You can use named values in functional languages. But in non-functional ones, the closest you can get is using assignment *in the declaration* but not after. In such cases this must be acceptable in order to approximate functionalism.
      So to be clear, in Java it is ok to do 'int x = 10;' and your code can still be considered functional as long as you never modify the value of x after the *first* assignment. In fact, you should use 'final' to assert that cannot happen (and thus why 'final' is everywhere nowadays).

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

      +Vectorh ah! Now I see that you only mean reassignment!

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

      +Lorz Ronz Yes. And I think that's what Martin must mean too.

  • @TheRedbeardster
    @TheRedbeardster 9 ปีที่แล้ว +17

    Uncle Bob rocks. Thank you.

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

    "Side effects are like the Sith; Always two, there are."
    Oh my God that made my day hahahahahaha thank you.
    Excellent lecture. I don't care what all the complainers and whiners say, nor do I care to read people's comments about how one language is better than the other (come on guys, stfu lol), this is still an excellent lecture, functional programming is still a beautiful thing, and it will in no way make you understand LESS about computation. If it isn't useful to you, don't use it. :) It is useful to me because it is really deepening my understanding of computer systems and data representation/computation in general, which is why I say it is such a beautiful thing.
    And he made an awesome Star Wars reference which makes me happy.

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

      "I don't care what all the complainers and whiners say"
      You cared about what one complainer and whiner said.

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

    Its too bad time ran out ! I was enjoying !

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

    Wow! I haven't seen some of those components in 40 years! I learned programming on Hollerith cards.
    Fun question: Why are Hollerith cards sized the way they are?

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

      The size of the original Dollar bill was used, because the banking business already used tabulating machines for those :)

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

    Structure and Interpretation of Computer Programs stil relevant and worth reading today?

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

      Yes, absolutely. Especially if you'll be in the business for the coming decade(s). It will take a couple of years for the world to acknowledge this, but we're moving to functional languages built on top of Object Oriented VMs that provide smart composite data structures. One of those languages is the virtually syntax free Clojure. I've had many debates about the merits of Clojure when I was an employee, but no one ever wanted to challenge me in practice. Probably because I threw together parallel systems in minutes while I was talking. :) SICP is a great basis for learing to think functionally, which will help with languages of the future like Julia and Clojure(script).

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

    1.25x speed sounds disturbingly normal

  • @cwildsblog
    @cwildsblog 6 ปีที่แล้ว +1

    they should add a spoiler alert for the book he mentioned at 11:20

  • @EvanZamir
    @EvanZamir 9 ปีที่แล้ว +2

    Wondering about the statement "Only assignments have side effects." What about writing to a database? That is a side effect obviously, but doesn't necessarily involve any assignment or state *inside* the program. It's state *external* to the program, I suppose.

    • @JeremyAndersonBoise
      @JeremyAndersonBoise 9 ปีที่แล้ว

      +Evan Zamir Ultimately we have to have some side effects, a truly pure functional language would be useless, we need i/o at the least, writing to a db would be considered i/o generally.

    • @ChristopherCabanneWork
      @ChristopherCabanneWork 9 ปีที่แล้ว

      +Evan Zamir Yes, make it external with I/O monads: en.wikipedia.org/wiki/Monad_(functional_programming)#The_I.2FO_monad

    • @shipper66
      @shipper66 9 ปีที่แล้ว +1

      +Christopher Cabanne Or just embrace pragmatism and learn Clojure ;)

  • @VeejayRampay
    @VeejayRampay 11 หลายเดือนก่อน +1

    1.25 speed is a must here

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

    I'm living the Rails bubble :D

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

      still livin it

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

      @@davidmcdonald7506 Nah it broke years ago.

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

    Hi Uncle Bob,
    Regarding 9:10
    I prefer:
    private static void printSquares(int n)
    {
    if(n > 0)
    {
    int square = n*n;
    System.out.format("%d, \t%d
    ", n, square);
    printSquares(n-1);
    }
    }
    Why: The functions first intention is to calculate the square then print that square before handling the next lower number.

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

      That is not equivalent to the stateful example. Your program will print the square of 20 first instead of last. His example was correct.

  • @МаксимМарков-з7с
    @МаксимМарков-з7с 8 ปีที่แล้ว

    int x = 1; means x is a variable. and as name implies value of variable could be changed.

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

      Except where 'x=1' defines a constant ... y'know... because maybe you're using a functional declarative language, which *has no fucking variables or assignments!*
      BTW. Did you know that there is an hour long video associated with this comments section! No, really! You should try watching it. : )
      You're welcome XD

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

    Unfortunately, the number of cores in laptops don't seem to go up for 5 years now, too.

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

      Laptop is laptop, number of cores on servers where the "properly written software" is much needed can be quite different from your laptop.

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

      Today is 2019. We have Intel Core i9 (18 cores @ 4.4 GHz max) and AMD Ryzen Threadripper (32 cores @ 4.2 GHz max) . As for laptops the most powerful have 6 cores because it looks like you don't need more for laptop tasks.

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

    Great talk, but what is all this nonsense about hardware cache being ripped out? I've seen no evidence that it's going anywhere. I see no evidence that ISA's are now changing away from a load/store or register/memory architecture towards something that operates directly on memory with no intermediary cache. We'll still need a whole layer of hardware logic for memory virtualization anyways for our modern concurrent processes environments. Seemed like some hot air to me.

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

    Very informative for Functional Programming. You can follow the new trend with the same enthusiasm. if you can look at the world with the blinders. But do you know how many programming paradigms exist?
    en.wikipedia.org/wiki/Programming_paradigm
    So how can we choose a panacea? We should think pragmatic.

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

    Memory may be cheap... access to memory however is not!

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

    What was the point of the oxygen tangent at the start?

  • @scottnoel-hemming6750
    @scottnoel-hemming6750 8 ปีที่แล้ว +5

    Good luck running your app on disk memory and not in RAM. Maybe he assumes we'll all be using SSD's soon. Sure they're cheaper these days, but not ubiquitous. I'm not saying he's wrong, but he is transitioning between RAM and "Hard" disk storage as if they are the same and they're not.

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

      I think he is more about the "in principle" side of things, once some of the kinks like "slow I/O" are gone. He puts it in perspective at the beginning of the talk, naming it a train racing towards us, threatening to roll over us, if we don't adapt to these changes, for example by using the right tools for the job.

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

    Anybody know if he presented the event sourcing section (the end that he skipped) in another presentation somewhere?

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

    Excellent!

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

    Hardware caches are going away but we'll still have software caches? What is a software cache as an alternative to a hardware cache?

    • @lepidoptera9337
      @lepidoptera9337 2 หลายเดือนก่อน

      Who in the world told you that hardware cache is going away? No such thing is happening. I recently ran into my first cache coherence issue on a microcontroller! You can now get three dollar parts that have a Level 1 cache for data and instructions each...

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

    First examples change state of an output.

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

    I like the intro

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

    What did he mean when he said future processors won't have caches? Where can i find something that supports this? Sounds crazy.

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

      I dont know if i understood, but, If you have 64 parallel processors, the cost of knowing which data is better to be executed by one of those processors (1 cache per processor), would be nearly higher than the benefits of using cache (Or going to that road at least).
      However, you could have a common cache for all processors or groups, yeah. But that could dissapear too if RAM becomes so fucking small (physically) and cheap just to put it inside a microprocessor chip.

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

    Processors manufactureres are removing cache?? That's a new... Last time I checked, it was increasing and number of cores are stagnant... in fact, the newest 5th gen intel CPU's for laptopts, only have 2 cores... Cache is not reducing... it is increasing.
    Also, if you only have 2 or 4 cores, why creating lots of parallel jobs? Why increase the memory usage, when memory is so sloowww when compared to cache memory?
    Most programs don't even have multicore requirements because well.... they don't simply need it!

    • @ClaymorePT
      @ClaymorePT 9 ปีที่แล้ว

      *****
      I Agree. I have seen other talks which are much better.

    • @FreeScience
      @FreeScience 9 ปีที่แล้ว +1

      ***** I don't completely agree that he "mixes" them up. In computation theory there isn't really a distinction between them, but he could have clarified that. In practice there's quite a difference of course, not many computers pushes 100GB of memory.

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

      how do you feel 5 years on haha

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

      Ryzen and M1 in 2021? Intel is no longer holding us back.

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

    Why does he always start his talks with these unrelated interesting topics? I'm not complaining, just wondering, because they don't seem to be connected to the talk at all.

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

      I'd imagine it's to grab the audience's interest and engage them before getting them into the meat of the talk. If the audience is already primed to receive information, then they'll be able to follow the talk a lot better because they'll absorb the information immediately instead of having to play catch-up as their brain warms up. (Might be good to give stragglers a few minutes to get settled too.)

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

      @@justinkendall5647 makes sense I guess

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

      He generally does that in other videos I saw as well. Maybe its to grab the interest. Glad he does that. Gets to learn 2 topics in a single video :)

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

      It’s hilarious, my favorite part of his talk

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

    Came back here in 6 years. Macs have 6 cores. Maybe they will have 8 in 6 more years :/

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

    Lots of words, not much content

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

    The slides skipped through at 55:12 make me think the best parts of this talk were skipped over ._.

  • @hineko_
    @hineko_ 6 ปีที่แล้ว +1

    Intel i7-8700K has 12M of cache

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

    memory is cheap, unless you want to manufacture 20 million microcontrollers.

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

    I'm convinced.. sort of ..

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

    The first couple of seconds I feared that I had mistakenly clicked on a Jordan Peterson link, but it turned out to be well worth my time.

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

    Mere humans should be allowed to change local variables.

    • @lepidoptera9337
      @lepidoptera9337 2 หลายเดือนก่อน

      That is a complete fallacy. I am programming ALL of my state as global. Why? Because it allows for efficient communication between modules and everybody can see immediately (the globals are aptly named "globalSomething"!) when code modifies global state. If you are hiding the global state modification behind eighteen layers of function calls then you are still modifying global state, which can lead to the exact same problems as doing it directly, but it's virtually impossible to see in the code what really happened.

  • @justincharette6151
    @justincharette6151 9 ปีที่แล้ว

    Functional Programming? Inconceivable!

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

    Amazing how I got strong cult vibes by 21:00

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

    When he says memory, he means storage?

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

      +ShadowMassacr13 I think the implication there is that storage and RAM are quickly converging

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

      was going to post a long response about virtual memory. then I saw your response. lol

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

      there is volatile memory (RAM) and persistant memory (ROM). When a program runs the processor reads and writes to memory . It doesnt matter where this ends up wether is it ROM or RAM. ROM can become RAM through paging

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

      Maybe you can explain the difference between memory and storage? en.wikipedia.org/wiki/Computer_data_storage explains it pretty well.

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

      What's the difference? Both RAM and storage store information, that's all. For practical reasons they tend to be used to store different things, but fundamentally there is no difference.

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

    Unfortunately the world is functional.
    Functional programming is still not offering enough value in real life programs over imperative programming. What we need to boost programs are PCIe connected 16TB disks and 10GBit Ethernet on cheap hardware and 128GB RAM.
    Not more cores and functional shit

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

    Cool

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

    Once again I see that the proponents of functional programming are ideologues who don't deal with real programming much.

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

      Do you see that? Please point out particular people, because you surely aren't talking about the video. I'd like to see where your comment is going.

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

    Why is there 'error'? wtf he talkin about

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

    what am i doing here

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

    But how does anyone change anything in the real world (i.e. Writing to disk or outputting to the screen) without changing state? Maybe I just don't understand the concepts.

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

      Functional programs isolate the nonfunctional stuff to a small area. Instead of having lots of areas in your code writing to disk/network/etc, you design the vast majority of your code to return data structures or values. A different chunk of code, the impure part, will take that data and send it out to the system.

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

    interesting talk. too bad he wasn't able to finish it.

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

    But would functional program work for something like AI?

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

      The guy who coined the term Artificial Intelligence and set up the first AI labs at Stanford and MIT also invented the first functional programming language. I consider it a prerequisite.

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

    I was always told print statements can be side effects as well?

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

      I've heard that any I/O is considered a side effect

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

      not an expert but i guess this happens in c and not in java. just guessing

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

      @@trocchiettoski why would the language matter?

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

      @@trampflips101 a side effect comes out an assignment and in C you can use an assignment expression as a value

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

      @@trocchiettoski I still don't know what you mean. I was saying that a print statement inside a function is considered a side effect, regardless of which language you're using.

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

    don't forget to watch The S.O.L.I.D. Principles of OO and Agile Design - by Uncle Bob Martin th-cam.com/video/t86v3N4OshQ/w-d-xo.html

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

    17:05 nunit users are crippled
    Japanese DO NOT unit test, I think you need to redefine what you mean by 'crippled.'

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

    The beginning of this talk is terrifying. This was under four years ago at the time of this comment. There are now over 400 ppm CO2 in the atmosphere. I have kids. It's hard to think about functional programming, sometimes.

  • @zdravost
    @zdravost 6 ปีที่แล้ว +1

    I have read the same book. They discuss assignment as the very first thing in the book. Namely, the discuss statements like (define *pi* 3.14). If that is not an assignment statement, then I am not sure what is. Or perhaps R. Martin is being disingenuous.

    • @strictnonconformist7369
      @strictnonconformist7369 6 ปีที่แล้ว +2

      Read the first word of that statement and ponder the literal definition of "define"

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

    He sounds so much like the Grand Nagus lol

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

      +n Mixed with a bit of Lewis Black, I can see it.

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

      +n Oh my god that is so true. I cannot unhear it now :)

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

      hahahhaah omg he does.... Trex from Toy Story mixed with Vizzini from Princess Bride, mixed with George Carlin, mixed with Grand Nagus from DS9... lmao

  • @VladaJanosevic
    @VladaJanosevic 9 ปีที่แล้ว

    Rich Hickey videos:
    th-cam.com/users/results?search_query=Rich+Hickey

    • @shipper66
      @shipper66 9 ปีที่แล้ว

      +Vlada Janošević People should first watch all of the Hickey videos indeed !

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

    Oh no! a spoiler about the book hahaha

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

    The state is still there, it's just moved into function parameters?

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

    Hardware caches will go away lol

  • @АлександрМирошник-о7ч
    @АлександрМирошник-о7ч 8 ปีที่แล้ว

    Спасибо за видео

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

    I understand the issue of doing assignments to file or global static (class) variables but what is the issue for an assignment for a variable that is allocated in the stack frame?

  • @sara-hc7wb
    @sara-hc7wb 7 ปีที่แล้ว +1

    I kinda feel like this doesn't at all show FP. it glosses over a few of the points of it but doesn't show any. the bolwing program is built using 100 % imperative constructs like for-loops and assignments, making a "function" that is not composable and hides state inside an object. it's like the antithesis of FP. the only difference between that and the statemachine is that the statemachine is kinda overengineered, although it could very well be the right approach if you need more functionality.
    I just don't think you can show the actual advantages or indeed the very basics of FP using small programs that just process a list and outputs something. just how you can't show the ideas and points of OOP by making a Dog class and calling "bark()"

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

    He sounds little bit like young Samuel L Jackson

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

    Lol, the oxygen released during photosynthesis comes from water not carbon dioxide. It's been shown using isotope markers.

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

    Why bother with pure functional programming when mathematics is there? In reality, state is unavoidable. You dont have to wait for the multi cored future, we have had parallel programming for a long time. API's like opencl allow you to use the gpu as though it were are very multi cored cpu. The host program deals with state like the user interface, stored data from databases files etc and then you push functions to the gpu. The reality is a mixture of paradigms. OOP and procedural for host and functional for parallelism.

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

    STOP ASKING SO MANY QUESTIONS MR SPEAKER, WE KNOW YOU KNOW THE ANSWERS STOP TAUNTING EVERYONE!