Тёмный

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

gnbitcom
Подписаться 6 тыс.
Просмотров 327 тыс.
50% 1

Functional Programming

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

 

5 окт 2024

Поделиться:

Ссылка:

Скачать:

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

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 292   
@AlexandriaRohn
@AlexandriaRohn 8 лет назад
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 лет назад
+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 7 лет назад
Thank's mate. I love Uncle as much as the next guy, but I just like efficiency more.
@bugs1yb1ins
@bugs1yb1ins 3 года назад
6 years later, RU-vid 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 года назад
how would you have done it
@seekknowledge8034
@seekknowledge8034 3 года назад
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 года назад
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 года назад
@@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 года назад
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
@0pt618
@0pt618 7 лет назад
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.
@therealmicksa
@therealmicksa 9 лет назад
What a disappointment - not _once_ did he say "Inconceivable!".
@_skyyskater
@_skyyskater 4 года назад
hahaha yeah he really does sound like Vizzini
@FlashManinSpace
@FlashManinSpace 9 лет назад
That was the best talk on programming I've ever heard!
@PeterHeard
@PeterHeard 8 лет назад
+Flash Man yeah i said that a lot with ubm
@oniaiki
@oniaiki 9 лет назад
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 RU-vid. 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.
@sergeibatiuk3468
@sergeibatiuk3468 5 лет назад
It took me half a year to fully understand this video (and make learn Scala as well) :)
@joshuajurgensmeier4534
@joshuajurgensmeier4534 8 лет назад
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 лет назад
I turned it up to 2x speed. Amazing that at even then his speech sounds like 1x speed sometimes...
@PeterBanka
@PeterBanka 9 лет назад
Now I understand the need for functions programming. Thanks Uncle Bob.
@janjanusz8271
@janjanusz8271 5 лет назад
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.
@EricTViking
@EricTViking 6 лет назад
"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 лет назад
Richard Moore The fp world has a similar statement, “the more the generic the types, the more specific the implementation.”
@garychap8384
@garychap8384 7 лет назад
There are these beautiful moments where Robert sounds so much like George Carlin : )
@edwardmason119
@edwardmason119 2 года назад
He sounds more like a cross between Patton Oswald and Lewis Black to me.
@0xCAFEF00D
@0xCAFEF00D 8 лет назад
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.
@lunardust201
@lunardust201 8 лет назад
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
@dmytrosokhach2598
@dmytrosokhach2598 9 лет назад
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.
@enesayalp9707
@enesayalp9707 4 года назад
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 года назад
That is not equivalent to the stateful example. Your program will print the square of 20 first instead of last. His example was correct.
@codinginflow
@codinginflow 3 года назад
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 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 3 года назад
@@justinkendall5647 makes sense I guess
@avimehenwal
@avimehenwal 3 года назад
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
@salilsurendran
@salilsurendran 7 лет назад
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
@clarkd1955
@clarkd1955 4 года назад
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.
@jphedley
@jphedley 8 лет назад
The presentation I wish I seen first, when I was transitioning from stateful OOP to Functional.
@calebb831
@calebb831 4 года назад
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.
@unfa00
@unfa00 7 лет назад
It's early 2017, AMD's 8-core Ryzen 7 processors have hit the market.
@alexbuhl1316
@alexbuhl1316 5 лет назад
It is now mid-2019, AMD has left Intel in the dust.
@romsthe
@romsthe 8 лет назад
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 лет назад
+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 лет назад
+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 лет назад
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.
@benaloney
@benaloney 8 лет назад
He sounds like the T-Rex from toy story
@DonJon200
@DonJon200 7 лет назад
LOL
@realwizardry834
@realwizardry834 7 лет назад
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
@ShaunPatterson
@ShaunPatterson 8 лет назад
Structure and Interpretation of Computer Programs... geez. I remember that book. 10 years ago, CS1301
@thomasmarshall4472
@thomasmarshall4472 6 лет назад
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?
@porky1118
@porky1118 6 лет назад
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?
@scottnoel-hemming6750
@scottnoel-hemming6750 8 лет назад
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 лет назад
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.
@jope2
@jope2 7 лет назад
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).
@BryonLape
@BryonLape 5 лет назад
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.
@RoyRope
@RoyRope 6 лет назад
Structure and Interpretation of Computer Programs stil relevant and worth reading today?
@RoelPompen
@RoelPompen 4 года назад
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).
@RancidPolecat2
@RancidPolecat2 9 лет назад
Close your eyes and imagine Patton Oswalt delivering this presentation. You will never be able to un-hear it.
@JeremyAndersonBoise
@JeremyAndersonBoise 9 лет назад
+Trevor Exley You just ruined and/or improved Uncle Bob talks for me forever.
@rkcst6503
@rkcst6503 7 лет назад
"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 5 лет назад
"I don't care what all the complainers and whiners say" You cared about what one complainer and whiner said.
@TimTeatro
@TimTeatro 8 лет назад
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
@МаксимМарков-з7с
int x = 1; means x is a variable. and as name implies value of variable could be changed.
@garychap8384
@garychap8384 7 лет назад
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
@UberOcelot
@UberOcelot 6 лет назад
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.
@douglasmckinley-sr1507
@douglasmckinley-sr1507 3 года назад
Always fun to watch an older RU-vid 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.
@TheRedbeardster
@TheRedbeardster 9 лет назад
Uncle Bob rocks. Thank you.
@EvanZamir
@EvanZamir 9 лет назад
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 лет назад
+Christopher Cabanne Or just embrace pragmatism and learn Clojure ;)
@MaheshMoodley
@MaheshMoodley 7 лет назад
side effects are like the sith...always two there are....that killed me
@charliesimar7541
@charliesimar7541 7 лет назад
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 года назад
The size of the original Dollar bill was used, because the banking business already used tabulating machines for those :)
@2002budokan
@2002budokan 8 лет назад
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.
@rewtnode
@rewtnode 8 лет назад
It's interesting and sometimes funny, yet i wonder if this is a cult?
@MrGoatflakes
@MrGoatflakes 4 года назад
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 года назад
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 года назад
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.
@ClaymorePT
@ClaymorePT 9 лет назад
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 лет назад
***** 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 года назад
how do you feel 5 years on haha
@rictr7421
@rictr7421 3 года назад
Ryzen and M1 in 2021? Intel is no longer holding us back.
@byllgrim6045
@byllgrim6045 7 лет назад
He sounds like a mad preacher! Sound pretty good.
@amigalemming
@amigalemming 8 лет назад
Unfortunately, the number of cores in laptops don't seem to go up for 5 years now, too.
@alexusanin1632
@alexusanin1632 7 лет назад
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.
@colinrickels201
@colinrickels201 Год назад
Only a functional dev would claim a recursive function is more safe than a for loop
@kaktotak8267
@kaktotak8267 7 лет назад
Once again I see that the proponents of functional programming are ideologues who don't deal with real programming much.
@Suamere
@Suamere 7 лет назад
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.
@brianskog9947
@brianskog9947 7 лет назад
Anybody know if he presented the event sourcing section (the end that he skipped) in another presentation somewhere?
@JinnyjinnyJin
@JinnyjinnyJin 7 лет назад
Very nice. Thank you, Uncle
@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 лет назад
+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 лет назад
+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 лет назад
+Lorz Ronz Yes. And I think that's what Martin must mean too.
@mikael642
@mikael642 8 лет назад
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 лет назад
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.
@cwildsblog
@cwildsblog 5 лет назад
they should add a spoiler alert for the book he mentioned at 11:20
@Aki-to
@Aki-to 3 года назад
Loving the scientific introduction.
@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 16 дней назад
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...
@victornascimento8358
@victornascimento8358 4 года назад
1.25x speed sounds disturbingly normal
@hineko_
@hineko_ 6 лет назад
Intel i7-8700K has 12M of cache
@georgeshopov8504
@georgeshopov8504 7 лет назад
Memory may be cheap... access to memory however is not!
@romanscharkov
@romanscharkov 5 лет назад
so..?
@friederichhuepfenstolz4011
@friederichhuepfenstolz4011 7 лет назад
Lol, the oxygen released during photosynthesis comes from water not carbon dioxide. It's been shown using isotope markers.
@AlexeyIovchuk
@AlexeyIovchuk 5 лет назад
First examples change state of an output.
@MrGoatflakes
@MrGoatflakes 4 года назад
The slides skipped through at 55:12 make me think the best parts of this talk were skipped over ._.
@tobyhinloopen5541
@tobyhinloopen5541 8 лет назад
I'm living the Rails bubble :D
@davidmcdonald7506
@davidmcdonald7506 5 лет назад
still livin it
@Machin396
@Machin396 4 года назад
@@davidmcdonald7506 Nah it broke years ago.
@XAngelsLifeX
@XAngelsLifeX 8 лет назад
Спасибо за видео
@robertgeofroy5419
@robertgeofroy5419 7 лет назад
Excellent!
@sara-hc7wb
@sara-hc7wb 7 лет назад
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()"
@rickdeckard1075
@rickdeckard1075 7 лет назад
Why is there 'error'? wtf he talkin about
@llothar68
@llothar68 8 лет назад
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
@RaaynML
@RaaynML 8 лет назад
When he says memory, he means storage?
@pandapv
@pandapv 8 лет назад
+ShadowMassacr13 I think the implication there is that storage and RAM are quickly converging
@daniellindforsbernholm3682
@daniellindforsbernholm3682 8 лет назад
was going to post a long response about virtual memory. then I saw your response. lol
@Lpapadop
@Lpapadop 8 лет назад
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 7 лет назад
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.
@askarkalykov
@askarkalykov 4 года назад
Came back here in 6 years. Macs have 6 cores. Maybe they will have 8 in 6 more years :/
@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.'
@zdravost
@zdravost 6 лет назад
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 лет назад
Read the first word of that statement and ponder the literal definition of "define"
@Nellak2011
@Nellak2011 Год назад
What was the point of the oxygen tangent at the start?
@skepticmoderate5790
@skepticmoderate5790 5 лет назад
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.
@chovuse
@chovuse Год назад
Its too bad time ran out ! I was enjoying !
@Neverrisen
@Neverrisen Год назад
Mere humans should be allowed to change local variables.
@lepidoptera9337
@lepidoptera9337 16 дней назад
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.
@byllgrim6045
@byllgrim6045 7 лет назад
The state is still there, it's just moved into function parameters?
@jaimesangcap7227
@jaimesangcap7227 7 лет назад
interesting talk. too bad he wasn't able to finish it.
@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.
@junpeiiori4720
@junpeiiori4720 8 лет назад
what am i doing here
@zelphirkaltstahl461
@zelphirkaltstahl461 8 лет назад
Getting educated : )
@marshalcraft
@marshalcraft 8 лет назад
Most of you will sit through this, and try and understand a guy who doesn't know what he is talking about. That is the current state. For example he talks about the book talking about scheme and he said that it has no syntax? Obviously it must have a syntax. Did he mean semantics? Or does he even know, he is to busy blowing smoke because of not using an assignment statement, which is just fucking semantics.
@weyrei
@weyrei 8 лет назад
+marshalcraft It does hardly have any syntax. He is perfectly correct with this. There is an AMOUNT of syntax a language has. If you do not understand this, better not comment on talks about programming.
@marshalcraft
@marshalcraft 8 лет назад
Programming? Syntax is pure logic.
@miguelmf001
@miguelmf001 8 лет назад
+marshalcraft Hey, think about syntax as a tool, it's the language you need to learn to speak. Logic is Logic, you can take the logic to any language you wish. If you see the scheme sintax, like Reinhard said, you shall see that the amount of Keywords and reserved symbols is minimal in comparison with some languages you may be used to.
@VeejayRampay
@VeejayRampay 10 месяцев назад
1.25 speed is a must here
@MrBatraaf
@MrBatraaf Год назад
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.
@williamdavidwallace3904
@williamdavidwallace3904 7 лет назад
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?
@theschinkelfamily
@theschinkelfamily 4 года назад
don't forget to watch The S.O.L.I.D. Principles of OO and Agile Design - by Uncle Bob Martin ru-vid.com/video/%D0%B2%D0%B8%D0%B4%D0%B5%D0%BE-t86v3N4OshQ.html
@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.
@DerHerrIstMeineStärke
@DerHerrIstMeineStärke 8 лет назад
I don't get this guy, what is wrong with GC? I kinda like it. Try making an actually useful and functional program in functional programming language, i don't think anything substantial has ever been done in those languages.
@mikael642
@mikael642 8 лет назад
lol. dude thats just stupid. of course there has been. Do you think that all these functional languages are just some hobby projects? Facebook uses Haskell for spam checking. Ericsson developed the Erlang language for telephone switches. There are alot of examples. Usually when people write a desctop application they use a mainstream language, but thats mostly because it's the way it's always been. Not because it wouldn't be a good idea to make one in a functional language.
@zelphirkaltstahl461
@zelphirkaltstahl461 8 лет назад
I once read about a program on a satellite being debugged from earth using a LISP REPL. Not sure where I read that though. It is used for space exploration then.
@juansebastianpolaniaramire4530
If you got a hammer, everything looks like a nail. Functional programming is useful for some tasks and imperative or OO programming is useful for others. Whatsapp uses Erlang for their server side tasks, and twitter and LinkedIn used Scala, a programming language aimed to combine FP and OOP.
@sara-hc7wb
@sara-hc7wb 7 лет назад
I've never with my own eyes seen anyone using portuguese to convey any useful idea whatsoever, so I must assume that portuguese is a useless language that has no real-world applications. obviously it couldn't possibly be because I don't know any people from portugal or brazil or wherever.
@bocckoka
@bocckoka 7 лет назад
memory is cheap, unless you want to manufacture 20 million microcontrollers.
@ToadieBog
@ToadieBog 4 года назад
Listening to functional programming advocates feels like watching a flat earth video. Willfully blind to its obvious shortcomings. Functional programming isn't more popular because so many things suck about it from a human perspective.
@MehulKumar_m3huL
@MehulKumar_m3huL 8 лет назад
I'm convinced.. sort of ..
@avalon2199
@avalon2199 7 лет назад
I like the intro
@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.
@nomoredarts8918
@nomoredarts8918 Год назад
Lots of words, not much content
@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 года назад
@@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 года назад
@@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.
@stevenkjames
@stevenkjames 5 лет назад
Cool
@VladaJanosevic
@VladaJanosevic 9 лет назад
Rich Hickey videos: ru-vid.com?search_query=Rich+Hickey
@shipper66
@shipper66 9 лет назад
+Vlada Janošević People should first watch all of the Hickey videos indeed !
@justincharette6151
@justincharette6151 9 лет назад
Functional Programming? Inconceivable!
@buzzybuzz2906
@buzzybuzz2906 7 лет назад
Why doesn't he ever mention Erlang or Elixir?
@shoqed
@shoqed 7 лет назад
he did mention erlang tho
@cbrnerd
@cbrnerd 6 лет назад
And Elixir
@ECRandomBits
@ECRandomBits 3 года назад
Amazing how I got strong cult vibes by 21:00
@carlhopkinson
@carlhopkinson 9 лет назад
This is bullshit...the recursive version of print squares has an implicit state contained within the call stack during execution.
@PatrickTingen
@PatrickTingen 9 лет назад
+Carl Hopkinson Yes, that's exactly what Uncle Bob says....
@Parmigiano1
@Parmigiano1 9 лет назад
+Carl Hopkinson That slide should have "it's also silly" added to it
Далее
"Uncle" Bob Martin - "The Future of Programming"
1:18:21
skibidi toilet multiverse 042 Trailer
01:57
Просмотров 3,2 млн
Мои РОДИТЕЛИ - БОТАНЫ !
31:36
Просмотров 616 тыс.
Robert C Martin - Clean Architecture and Design
58:39
Просмотров 274 тыс.
Programming until I get an internship/job | 7
3:44:38
Robert C  Martin  - Professional Software Development
1:00:08
Robert C Martin - The Single Responsibility Principle
51:09
The Last Programming Language
53:17
Просмотров 278 тыс.
Object-Oriented Programming is Bad
44:35
Просмотров 2,3 млн
OO Considered Harmful - Phil Nash - CppCon 2020
57:39