Object Oriented Programming vs Functional Programming

  Рет қаралды 740,410

Continuous Delivery

Continuous Delivery

Күн бұрын

Object-Oriented Programming has been the dominant approach for the past couple of decades, but Functional programming languages are growing in popularity and influence. So is OO programming outdated? Is Functional programming a fashion that simply misses the point?
Many Functional programmes think that Object Oriented programming is bad. Many OO programmers think that Functional Programming is not scalable, what is the truth?
In this episode, Dave Farley explores the software engineering question of object-oriented vs functional programming. Where did these ideas come from, what do they mean and why do they matter. Also, are there other ideas that may be coming in future?
-------------------------------------------------------------------------------------
Also from Dave:
🎓 CD TRAINING COURSES
If you want to learn Continuous Delivery and DevOps skills, check out Dave Farley's courses
➡️ bit.ly/DFTraining
📧 Get a FREE guide "How to Organise Software Teams" by Dave Farley when you join our CD MAIL LIST 📧
The best way to keep in touch with the latest discussions, events and new training courses, get FREE guides and exclusive offers. ➡️ www.subscribepage.com/organis...
-------------------------------------------------------------------------------------
📚 BOOKS:
📖 Dave’s NEW BOOK "Modern Software Engineering" is now available on
Kindle ➡️ amzn.to/3DwdwT3
In this book, Dave brings together his ideas and proven techniques to describe a durable, coherent and foundational approach to effective software development, for programmers, managers and technical leads, at all levels of experience.
📖 "Continuous Delivery Pipelines" by Dave Farley
paperback ➡️ amzn.to/3gIULlA
ebook version ➡️ leanpub.com/cd-pipelines
📖 The original "Continuous Delivery" book by Dave Farley and Jez Humble
➡️ amzn.to/2WxRYmx
-------------------------------------------------------------------------------------
CHANNEL SPONSORS:
Equal Experts is a product software development consultancy with a network of over 1,000 experienced technology consultants globally. They increase the pace of innovation by using modern software engineering practices that embrace Continuous Delivery, Security, and Operability from the outset ➡️ bit.ly/3ASy8n0
Harness helps engineers and developers simplify and scale CI/CD, Feature Flags and Cloud Cost Management with an AI-powered platform for software delivery. ➡️ bit.ly/3Cfx3qI
Octopus are the makers of Octopus Deploy the single place for your team to manage releases, automate deployments, and automate the runbooks that keep your software operating. ➡️ octopus.com/
SpecFlow Behavior Driven Development for .NET SpecFlow helps teams bind automation to feature files and share the resulting examples as Living Documentation across the team and stakeholders. ➡️ go.specflow.org/dave_farley
-------------------------------------------------------------------------------------
REFERENCES
A History of Programming Languages ➡️ cs.brown.edu/~adf/programming...
“The Last Programming Language” Bob Martin ➡️ • The Last Programming L...
“GOTO statement considered harmful”, Edsger Dijkstra ➡️ homepages.cwi.nl/~storm/teach...
Edsger Dijkstra ➡️ en.wikipedia.org/wiki/Edsger_...
“The forgotten history of OOP”, Eric Eliot ➡️ / the-forgotten-history-...
"The Reactive Manifesto", Jonas Bonér, Dave Farley, Roland Kuhn, and Martin Thompson, ➡️ www.reactivemanifesto.org/

Пікірлер: 2 400
@mikefromwa
@mikefromwa 2 жыл бұрын
"Let's be clear, you can write crap code in any paradigm" I see you're familiar with my work...
@fleetingfootnotes9133
@fleetingfootnotes9133 2 жыл бұрын
...sounds like you're setting yourself up for a couple of copyright infringement lawsuits. :P
@Dschinny2004
@Dschinny2004 2 жыл бұрын
shut up both of you. he meant MY work!
@oldcountryman2795
@oldcountryman2795 2 жыл бұрын
The only thing that determines the “quality” of your code is how much you (or your employer 😉) can get paid for it.
@thegamingdemon4788
@thegamingdemon4788 2 жыл бұрын
Shut up all of you, he's talking about MINE.
@tommornini2470
@tommornini2470 2 жыл бұрын
I’ve been telling people for years that I want this written on my headstone: “It’s equally easy to write shitty code in all languages.” - Tom Mornini, 1999
@ke5uq1we8h
@ke5uq1we8h 3 жыл бұрын
"It's not about objects, it's about sending a message" :-)
@irok1
@irok1 2 жыл бұрын
Lol, nice
@badradish2116
@badradish2116 2 жыл бұрын
omfg winning
@cosmic53
@cosmic53 2 жыл бұрын
I think this is especially clear in Objective C. Messages are not method calls. The language is C with a smalltalkish layer upon, totally orthogonal to the language.
@edincanada
@edincanada 2 жыл бұрын
Understanding that OO is actually not about inheritance is an awesome moment of enlightenment I hope all programmers cherish reaching.
@ivanmoen9982
@ivanmoen9982 2 жыл бұрын
@@edincanada I don't have a lot of experience with OO programming(or programming in general), but for me using inheritance adds extra complexity for little to none benefit.. The way I see OO is kind of like c structs with methods that can act upon the data.. not sure if this is a reasonable approach, guess it depends on the language to use..
@h4plugins334
@h4plugins334 2 жыл бұрын
"You can write crap code in ANY paradigm" - You been looking over my shoulder ? :)
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
🤣
@mike.hawk_
@mike.hawk_ 2 жыл бұрын
Non programmers: Oh programmers seem so smart, you have to be some kind of genius to understand code Programmers: Unga bunga OOP tribe sucks
@dexterantonio3070
@dexterantonio3070 2 жыл бұрын
Scala programmers: let’s make a functional programming language with four new styles of classes
@Megalomaniakaal
@Megalomaniakaal 2 жыл бұрын
@@dexterantonio3070 "Let us increase class struggle" Wait. Wrong topic, my bad...
@DudeWatIsThis
@DudeWatIsThis 2 жыл бұрын
Non-programmers: "I have 75 MBAs and get paid three billion dollars an hour. Scrum master, CEO, CEO, scrum master. What is a see-sharp? I am not concerned about the programming part, that gets itself done automatically. Sales are what matter." Programmers: "One more day driving to the office, where I will take it up the ass by someone with an IQ 20 points lower than myself, who gets paid 3 million times as much and takes my job for granted."
@janglestick
@janglestick 2 жыл бұрын
@@DudeWatIsThis C# is terrible only java is worse, but point taken
@janglestick
@janglestick 2 жыл бұрын
@@Megalomaniakaal lol Class struggle
@ducodarling
@ducodarling 2 жыл бұрын
I feel like I'm in programmer church, listening to a sermon
@TaylorIserman
@TaylorIserman 2 жыл бұрын
That’s super accurate actually
@davem.8681
@davem.8681 2 жыл бұрын
Duco Darling Speaking of sermons, I believe that object oriented programming is one of the great deceptions.
@vladimirljubopytnov5193
@vladimirljubopytnov5193 2 жыл бұрын
I felt a bit wtf when I heard the ironic "I rest my case" to that short, concise and totally beautiful sum definition :). How is FP bad for modelling here when most OO languages miss half of expressive power by not supporting union types? How are we not "guided in our analysis by the problem" in FP or how is this guidance only bestowed on OO guys? Recursion is very readable, because it closely models decomposition of a problem into smaller problems, thats why its in most books before any mention of OO. Moreover, it a bridge between FP and structured world. I don't think FP folks are motivated by some hatred of OO to point out its flaws, but I think it's no coincidence, that a lot of good practices in OO are also very much FP practices (composition over inheritance, SOLID). And I say that as an everyday java guy, so I'd like to stay out of any strict labelling.
@flightrisk7566
@flightrisk7566 2 жыл бұрын
@@vladimirljubopytnov5193 rebased edit: and f-pilled
@ironmagma
@ironmagma 2 жыл бұрын
@@flightrisk7566 f-pilled 😂😂😂😂😂😂 I'm going to start using that ASAP
@travis1240
@travis1240 2 жыл бұрын
As for any dogmatic approach to software engineering, I'm over it. The best paradigm is what gets the job done with the least cognitive load. When you get too dogmatic about it you can pat yourself on the back but you will end up with less readable, less maintainable code and your successor will curse you.
@rameynoodles152
@rameynoodles152 2 жыл бұрын
Yeah, I mean, here's an idea that nobody seems to be having. Mix paradigms in your code, don't use just one, use them all when they make the most sense to use them. I dislike Java because it forces OOP. You don't need singletons in C++ because you can just "encapsulate" functions into a namespace, so it syntactically looks like OOP, but it's actually structured. EDIT: I meant to say procedural.
@ecpgieicg
@ecpgieicg 2 жыл бұрын
The best approach is the one that makes future usage, development, and identification of errors simple. Cognitive load on one day is nothing compared the long term cost arising from the unnecessary demand to reduce cognitive load on that day.
@pauligrossinoz
@pauligrossinoz 2 жыл бұрын
Yep! It's best to write your code while keeping in mind the effort required to understand it by the next person who has to read it. The first time I was told to rewrite code to make it simpler for the maintenance coders, I was pretty pissed because my code bloody worked! _Why should I rewrite something that works???_ 😮 But I was also very young and naive. Now, decades later, I'm totally on board with writing simple code to make the lives of the code maintenance staff easier. The simple fact is: If the maintenance coders can't reliably change the code, the system is never updated, and then it's pretty quickly replaced with something that they can actually handle.
@RBLevin
@RBLevin 2 жыл бұрын
Exactly.
@w41g87
@w41g87 2 жыл бұрын
But how do you decide which paradigm will induce less cognitive load beforehand?
@Pedro5antos_
@Pedro5antos_ 2 жыл бұрын
10:54 "let's be clear, you can write crap code in any paradigm!"
@aloisxyz
@aloisxyz 2 жыл бұрын
but particularly in oo
@axea4554
@axea4554 2 жыл бұрын
Nice, then I can just pick any paradigm
@jamesgg9950
@jamesgg9950 2 жыл бұрын
But the real question is: is the number of paradigms in which one can write crap code equal to the number of paradigms in which one can write good code? And is that question best phrased in OOP or functional code?
@lyingcat9022
@lyingcat9022 2 жыл бұрын
I can confirm this statement.
@mohanbarman9890
@mohanbarman9890 2 жыл бұрын
I write crap code and I can confirm this.
@magiclover9346
@magiclover9346 2 жыл бұрын
Even with a few errors a very articulate argument and well presented. I often find myself borrowing from both philosophies. Especially the immutability approach of functional when dealing with multi threaded or async systems. Following functional guidelines can also help when designing slim micro services, which in the current landscape of cloud focused computing is a bonus. However I also like the encapsulation and polymorphism concepts of OO. When it comes to data persistence I've always found it easier to think of it from an OO stand point.
@Aegon1995
@Aegon1995 7 ай бұрын
👍🏿
@Mark73
@Mark73 2 жыл бұрын
"We've identified all the paradigms that there are to find" Reminds me of that legislator around 1900 that wanted to shut down the patent office because "everything has already been invented".
@dialecticalmonist3405
@dialecticalmonist3405 2 жыл бұрын
That's worse than saying, "We've identified all the patterns that there are to find." People don't give complexity enough credit.
@murraynatkie7490
@murraynatkie7490 2 жыл бұрын
That sounds like a story worth telling. Thanks for the rabbit hole. EDIT: oh, its a myth.
@ricosrealm
@ricosrealm 2 жыл бұрын
640kb is all the memory anyone would need
@imrematajz1624
@imrematajz1624 2 жыл бұрын
Good that they didn't, as Einstein would have not been hired and could have not been so bored that he started to wonder about why time was so relative...
@AtlantaTerry
@AtlantaTerry 2 жыл бұрын
@@imrematajz1624 Wrong patent office. Einstein worked in one in Europe. The one that was to be shut down was in Washington, DC.
@sryx
@sryx 2 жыл бұрын
I wrote software for years before finally starting to actually study coding paradigms. The personal breakthroughs in my journey really began once I read The Little Schemer. It made me go back and see how much complexity I had created because I didn't understand recursion. It also radically changed the way I wrote code in all kinds of languages.
@pawel7196
@pawel7196 2 жыл бұрын
I think coding for so long gave you understanding so that you can see where you can improve. I started learning JS and a few weeks later been introduced to OOP not having a proper base knowledge. This lead to confusion and a year after I still don't know if I'm functional or OOP programmer which is embarrassing.
@lamcho00
@lamcho00 2 жыл бұрын
@@pawel7196 JS is a prototyping language. Only it's recent version started supporting Classes and even now those classes are really prototypes underneath. Prototypes are very similar to Classes and objects (in OOP), you should read more about it. That said I still don't like programming in JS. Unless you follow some unwritten rules, the code you write is very hard to read and understand afterwards.
@rubiskelter
@rubiskelter 2 жыл бұрын
@@pawel7196 Javascript is a weird language, very malleable but weird indeed . You should go with typescript. And, what do you mean you're a functional or OOP programmer? as Iamcho00 pointed out, you can use prototyping to maskerade as classes. But, you've definitely never programmed anything under the functional paradigm. You're confusing things, maybe you should read about it. Languages like Lisp and Haskell, are functional. Haskell has the pure implementation of functional paradigm, or almost pure, if you don't include IO. You can program following functional paradigm practices, using javascript, but i can guarantee you that you didn't do that. Functional programming is all about not using changing-state and mutable data, which most programmers do using imperative or OOP paradigms.
@pmarreck
@pmarreck 2 жыл бұрын
wait… You wrote software for years without understanding recursion? Yeesh
@caseyhawthorne7138
@caseyhawthorne7138 2 жыл бұрын
@@pmarreck That was a bit loopy 🖖
@marcosdiez7263
@marcosdiez7263 Жыл бұрын
I coordinated a public Logo workshop in the early 90's that ran for 4 years with about 30k attendants, in which we tried to verify Seymour Pappert's theoretical approach. Logo was devised as a learning system in which the screen were used to reflect the way we think about the world around us and the problems we try to model and solve, bringing awareness of Jean Piaget's genetic epistemology (the process that generates our knowledge). The language was devised as a way to implement this learning/researching system, and a key concept for this was the "sintonicity" property: the language should be as closest as possible as the way you express your thoughts to minimize the interference of the translation effort between your own natural language and the computational one, hence one of its features was that the primitive instructions were translated to the final user's language (you had Logo in English, in Swedish, in Spanish, we even contributed to translate it to Quechua). Logo was a functional language, initially a LISP shell (you had lists to manage data and it heavily resourced on recursion). As to be allowed to proof Pappert's ideas that challenged Piaget's ones regarding the immutability of the order of concepts children learns at early ages to understand spatial concepts, the turtle was used, either a robot able to move drawing lines like a kid does following instructions a kid can formulate (move forward 10 steps, turn right 90 degrees) and reproduce, or a triangle drawing in the screen. The thing is, Logo succeeded in this "sintonicity" property when drawing graphics for the programmer could do by themselves exactly the same the turtle would and understand where their ideas on how to solve a problem divert from the reality, but then failed misserabily to provide a similar sintonicity to manage pure abstract data because lists and its operators weren't a natural way to think and arrange data. Now, there's an article in Scientific American from 1971 that described Smalltalk as an attempt to address this very issue and find a more "sintonic" way to deal with the data. Back then the language didn't implement inheritance (it would appear in Smalltalk '80), but just the idea of messages being sent back and forth between entities that "learned to do things" by following the same principles from Logo. The entities were initially turtles instantiated and addressable by a given name, which could "learn" about data. So you'd create a turtle called Paul and tell it (sending a message) to learn that "age" was "12", you would teach the turtle (a new function or method) how to do some math, and you could ask for the "age" or to do the taught math and return the answer. Eventually you'd create another turtle Susan and would teach it how to ask Paul for the "age" or for it math to do something more complex and either return or act accordingly to the answer. Hence the name "small talk". The concept has proven so sintonic that it evolved into OOP paradigm as seen nowadays: having turtles that managed data but didn't appear on screen to draw stuff didn't make sense, and addressing every entity as a turtle got in the way of the sintonicity, hence in Smalltalk '80 inheritance appeared defining a basic object from which other entities inherited its "knowledge" (of how to answer to certain messages) and the turtles became objects specialized in drawing stuff on screen. Hence, there was a path connecting functional languages (LISP and Logo) to OO ones (Smalltalk) with the explicit goal of allowing us to represent our ideas of the world "sintonically", e.g in our own terms instead of the ones sufficing the computer requirements, which in turn determine how "expressive" a language is to model certain kinds of ideas.
@ianollmann9393
@ianollmann9393 Жыл бұрын
Appreciate the experienced perspective. For those of us who cut our teeth on “anything goes” languages, it is more intuitive that different approaches work better for different problems, and a one-constraint-fits-all design ties your hands unnecessarily in very painful and unconstructive ways at times that do not benefit the end product.
@fburton8
@fburton8 2 жыл бұрын
The mistake is to believe a single paradigm is the best approach to solving all problems.
@vitalyromas6752
@vitalyromas6752 2 жыл бұрын
@@LegendLength Scratch?
@eduarddumitru1
@eduarddumitru1 2 жыл бұрын
@@LegendLength i worry about dealing with merge conflicts / viewing a diff between version A of such a visual creation and version B
@berylliosis5250
@berylliosis5250 2 жыл бұрын
I strongly disagree with a notion of a perfect language. There's just too much complexity. It's impossible to get everything you might want in a single language - in some cases, it's mathematically impossible. Also, please don't let it be a visual language. Those have all the design problems of regular languages, plus a million more introduced by the difficulty of mapping things to visual elements. There's a reason all existing visual language are either incredibly simple or "regular programming but you use unwieldy blocks instead of easy typing"
@digitig
@digitig 2 жыл бұрын
@@LegendLength I don't think there's an "ultimate" programming language, because all languages involve tradeoffs and different tasks require different tradeoffs. A real-time safety-critical system needs a language that is highly amenable to verification and validation and that supports a time-deterministic runtime (so no automatic garbage collection - and possibly no dynamic heap storage to *need* garbage collection). I usually see that done in a subset of Ada. But the program I needed to parse texts marked up in XML to determine linguistic characteristics of the text (in an academic context) had no such constraints; it didn't matter if it took a couple of minutes to produce results, testing gave adequate-for-the-purpose confidence in correctness, but I needed it soon, and cheap (in terms of my own time) so I used Python. I don't see how a language can enforce the constraints of the former and still allow the flexibility of the latter.
@digitig
@digitig 2 жыл бұрын
@@LegendLength If you depend on different back ends for GC and non-gc, you're getting into a world of pain with libraries - do they depend on GC or not? does the compiler protect you from calling a GC library from non-GC code? And do you have to go through all the detail of smart pointers, if it's going to be garbage collected anyway? Does the compiler protect you from using simple pointers if there's no GC? And other differences I mentioned - there's a reason bondage-and-discipline languages are preferred for safety-critical systems, because they force progammers to express their intent in more detail, which is known to reduce bugs. Do we enforce that on non-critical scripts, or do we make it a language feature that can be turned on and off? Hmm, it's starting to look like multiple languages, isn't it?
@rhbvkleef
@rhbvkleef 2 жыл бұрын
You essentially described Erlang with that message passing example.
@gregbigwood4532
@gregbigwood4532 2 жыл бұрын
yeah its the Actor model which is a great way to code. can be hard to debug what happened in your system though the performance gains are great.
@nwoDekaTsyawlA
@nwoDekaTsyawlA 2 жыл бұрын
I only managed to write a "hello world" example in Erlang, but I definitely got that vibe too.
@HansTheGeek
@HansTheGeek 2 жыл бұрын
@@nwoDekaTsyawlA Try elixir it is a “modern” erlang and it is great
@JohnDavidDunlap
@JohnDavidDunlap 2 жыл бұрын
Erlang/Elixir also fit his criticism about copying values to maintain immutability. It's not that it's bad per say but it does come at a cost.
@HansTheGeek
@HansTheGeek 2 жыл бұрын
@@JohnDavidDunlap that’s right. On the other hand how should the suggested system work without copying?
@donedgardo
@donedgardo Жыл бұрын
I agree with most of what your saying, and I believe that each OO and functional paradigms bring positives to any project. I've had a great experience using them both with the language Clojure. I don't think any other language lets you use these two paradigms in your own way.
@nathanarnold7661
@nathanarnold7661 2 жыл бұрын
I write with a mix of paradigms these days, where the deciding factor is usually readability. Most of the time, that's functional. I don't think the FP examples in this video were fairly chosen. Good functional code does not need to be so cryptic, but I do agree that it requires understanding some different concepts. I'd like to share and resonate the point that you can obtain the benefits of either paradigm in any language (or almost any) with some discipline, and this is why it's a good idea to learn both. I'm sure this extends to other paradigms as well.
@markdewey6788
@markdewey6788 Жыл бұрын
This is where I'm at as well. After spending the first half of my career deeply plumbing the depths of OOP and trying to be a purist there, I got a job where I spent a lot of time with Clojure. I can't overstate how much driving into the functional paradigm and writing with a functional language was a game changer. These days I mostly write in python where I do what Dave mentioned, I chose my constraints based on the problem. Some things are best done as objects, some in a functional style. Python lets me do both, but has more support for making classes and objects.
@breadman5048
@breadman5048 Жыл бұрын
@@markdewey6788 how long did it take for you to learn FP? And how long to really appreciate the concepts
@markdewey6788
@markdewey6788 Жыл бұрын
@@breadman5048 6 months to a year? It's not that different from learning a new language. You get proficient in just a few months of study and practice, then keep ramping up as you go.
@jeremiroivas1628
@jeremiroivas1628 Жыл бұрын
I find oo much easier to read, compnentdidmount is easier understand than usereffect... componentdidunmount is way easier to read than another usereffect... To me only more readable in functional is this. -writes. In functional you dont need to refer this.variable or function. How ever setting state is much more readable just write inside class: state = {yourAge: 36, yourStyle: blonde} where in functional you have to define each states by separate assignments. OO is way easier to read. Another topic is OO constructor but there is a way to simulate constructor in functional but again it looks like HACK and way much more harder to read.
@tullochgorum6323
@tullochgorum6323 Жыл бұрын
In particular I'd dispute his point that functional programming isn't suited to intuitive modelling. Reading Scott Wlaschin's excellent book Domain Driven Modelling Made Functional opened my eyes to the potential of powerful FP type systems for expressing practical line-of-business domains.
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
It looks like I am going to have to fire my extensive team of copy editors 🤣 I am afraid that I made several typos in this video, and then missed them in my review before release. So here are the corrections, and I promise to try and do better in future. 4:09 It is "Edsger Dijkstra" not "Esgar" 4:25 "Constrains" not "Contrains" then I copy-pasted the same typo to 6:44, 7:09, 7:15 and then 7:48 - Doh! Last but not least (maybe not even last?) is the biggy, I mistyped the Scala code example! I usually prefer to copy a screen-snapshot of code to avoid this dumb kind of mistake, but thought that I would try something different for these simple examples - Lesson learned! 13:56 The Scala example should read: val x = someCollection.foldLeft(0)((y,c) => y + c.size) not val x = someCollection.foldLeft(0)(y,c) => c.size) No wonder it wasn't the clearer representation! Very sorry for these mistakes, but I hope that they don't detract too much from the ideas in the video.
@jalvrus
@jalvrus 3 жыл бұрын
I once gave a presentation on why copy-paste is evil, so seeing "contrains" pop up over and over made me chuckle.
@michaelmiller237
@michaelmiller237 3 жыл бұрын
Not typos, undocumented features.
@mayabartolabac
@mayabartolabac 3 жыл бұрын
Another correction: Haskell's sum function should be: sum :: [Int] -> Int sum [] = [] sum (n : ns) = n + sum ns
@dtkedtyjrtyj
@dtkedtyjrtyj 3 жыл бұрын
@@mayabartolabac That gives my brain a TypeError, shouldn't it be sum :: [Int] -> Int sum [] = 0 sum (n : ns) = n + sum ns ?
@mayabartolabac
@mayabartolabac 3 жыл бұрын
@@dtkedtyjrtyj ooooohhhhh right thanks for letting me know
@rcrawford42
@rcrawford42 3 жыл бұрын
The hardest part of reactive programming is convincing management, especially those who were once developers.
@ZigzauerLT
@ZigzauerLT 3 жыл бұрын
and they are not always wrong :)
@parlor3115
@parlor3115 3 жыл бұрын
@@ZigzauerLT Management who were once developers are actually the worse because they think they know sh*t. Often times they weren't even good developers and even if they were, most of their knowledge is now outdated and/or misplaced.
@chudchadanstud
@chudchadanstud 3 жыл бұрын
@@parlor3115 lol but they're not wrong. You're young and have no experience. When I grew in my experience I'm discovering that they're more right than wrong.
@nikitaproit
@nikitaproit 2 жыл бұрын
on the frontend, the hardest part is convincing people that reactivity isn't always good =)
@brooksfire9580
@brooksfire9580 2 жыл бұрын
​@@parlor3115 You're a very naive grasshopper. Programming concepts have not changed much over the past 30 years. The names of things have changed, and many things have come full-circle. Functional programming was around long before OO. Kubernetes/Containers were around long ago, Agile programming books were around 25 years ago. A manager that still subscribes to the waterfall method has always been outdated and misplaced.
@sunshinelizard1
@sunshinelizard1 2 жыл бұрын
One plus of functional programming is the ease of writing tests against the functions. Work in Clojure for a while honed my attention to the testability of any code I write, so I got better at writing smaller functions.
@MP-mx9nf
@MP-mx9nf 7 ай бұрын
the ease of testing has nothing to do with the paradigm. oop or functional. but about the nature of the function. as long as your function is pure and I/O, testing it is simple. as soon as it has to interact with the outside world, things get more complicated. both in FP and OOP or whatever else paradigm you want to think of
@D4no00
@D4no00 3 ай бұрын
@@MP-mx9nf that is absolutely not true. Read about managed side effects feature that most of the functional languages and newer languages like rust have and you will understand why inherently writing tests in current OOP languages like java,c# will be harder and more error-prone.
@simonr7097
@simonr7097 2 жыл бұрын
For anyone interested in this discussion, I suggest reading the paper "Why functional programming matters" by John Hughes, who takes the view that we shouldn't focus on what FP *doesn't* allow (no side effects, no flow of control) but what it does enable (modularity, through higher-order functions and lazy evaluation).
@user-hk3ej4hk7m
@user-hk3ej4hk7m 3 жыл бұрын
The thing I envy about fp languages is the expressiveness of their type system. Function composition, partial application, mappings are all impossible to implement without abusing the type system with most programming languages, even though using these constructs is extremely easy to do: f(g(x)), f(a, b, c), out[i]=f(in[i]). This lack of expressiveness is really what makes me think "I really wish I could write this in Haskell".
@evanwilliams2048
@evanwilliams2048 2 жыл бұрын
Yeah, the niceness is like an optimisation that is possible because of the lack of side effects.
@TinBryn
@TinBryn 2 жыл бұрын
That paradigm you explained at the end about multiple modules sending data between each other and otherwise being single threaded is pretty much exactly Communicating Sequential Processes (CSP) as described by Tony Hoare in 1978, and published in a book in 1985.
@AdobadoFantastico
@AdobadoFantastico 2 жыл бұрын
Nothing new under the sun! I'll have to add it to my reading list, sounds interesting.
@TigercatDesigns
@TigercatDesigns Жыл бұрын
That's pretty much exactly what I do with socketpair(), fork(), exec() and select() on Posix systems. I hate threads for anything other than, say, matrix manipulation or other such tasks where no signals need to be sent other than start_thread and thread_ended. So why has CSP never been widely implemented, while threads seem to be everwhere? IMO it's because the dominant OS, Windows, makes launching new processes painful and expensive, and has poor inter-process communications.
@benjaminscherrey2479
@benjaminscherrey2479 Жыл бұрын
@@TigercatDesigns CSP is what go-lang uses. However, CSP is basically a somewhat broken version of the Actor model of concurrency. CSP is based on lambda calculus but Actor is based on physics in that it is capable of representing unbounded nondeterminism which lambda calculus cannot. Most famous example of the Actor model is Erlang which was designed to implement high availability high concurrency telephone switch operations. It's truly remarkable and about to undergo a Renaissance I think.
@TigercatDesigns
@TigercatDesigns Жыл бұрын
@@benjaminscherrey2479 Thanks for that! I've never come across the Actor model before in any of my design pattern books, although I have heard of Erlang. Looking at the Actor model stuff online, I agree it could/should undergo a Renaissance.
@onthecodeagain
@onthecodeagain 2 жыл бұрын
Keeping code readable + maintainable to me is the hardest part no matter if you're using oop / functional paradigm. Good and bad code can be written in either they just help you out in different areas :)
@sipanmohammed
@sipanmohammed Жыл бұрын
there are many problems: dead line , time to market ...etc.
@claudiubele4892
@claudiubele4892 Жыл бұрын
the more you do the more you learn because you are the one writing your own projects
@jonbezeau3124
@jonbezeau3124 Жыл бұрын
Human readers are terrible code interpreters. They can only track about 7 items at a time, values and program flow can go out of scope for no reason, etc. So it helps for coding style to target the weakest architecture that will read it, other coders, in order to at least maintain correctness.
@paulkanja
@paulkanja Жыл бұрын
"...part oo, part functional, part structured..." JavaScript: "Someone said my name?"
@kikoyz
@kikoyz Жыл бұрын
@@paulkanja the only thing 'functional' about javascript is it uses functions. 😁
@williamheymann8180
@williamheymann8180 2 жыл бұрын
Overall I prefer a Hybrid approach. In some things I just find that OO maps really well to a problem I am solving and in other parts I find that functional maps really well. Most languages commonly used today can freely switch between the two styles as needed. You can even use purely imperative approaches for some types of problem where you need mutable state for really high performance.
@AdobadoFantastico
@AdobadoFantastico 2 жыл бұрын
I just wish there was more info on FP. I am self taught and found that at least the problems I was dealing with were often better handled through FP. I had complained to some programmer friends that OOP is weirdly obtuse for the stuff I was doing and they kind of made me feel like I was a dumbass until I found that there's another paradigm. It made for TONS of friction and stress on my learning path. Even when I learned there was this FP thing it took me a while to grok anything about applying it because all the conversation is so saturated by ppl being dogmatic.
@V000idZer000
@V000idZer000 7 ай бұрын
I think, depending on the kind of the problem you are solving you need 90-99.9% FP and 10-0.1% OOP, most of which can be handled relatively well in pure FP languages too (monads, IO-functions, etc), but there is a small remainder, which is so much harder to do well in pure FP languages, still tend to stick with basically programing FP as much as possible inside OOP language and use the freedom to mutate exclusively where it really helps performance or simplicity against correctness. In simple cases that never change even inheritance can be the simplest and best solution. You need lots of discipline to do it right, but it pays off and rewards good things of both worlds.
@mattiasmartens9972
@mattiasmartens9972 2 жыл бұрын
I know that OOP encompasses a wide range of languages, so my initial reaction might be misplaced here. But you did mention Java, and it is striking to me just how much my experience with it was the opposite of "bringing me closer to the problem" as opposed to functional programming. The core idea of functional programming to me is composition. Because the functions are pure, you do not have to orchestrate them in a way that takes into account their side effects (as you would e.g. with imperatively creating a connection, imperatively committing it to a pool, imperatively checking if it is still open, imperatively disposing of it, etc). If a function does something in one context, you have a guarantee that it will do that exact same thing in any other context, which ultimately makes it cognitively cheaper to think on much higher levels of abstraction. Maybe Java wins in the loop-sum example, but looking at it gave me flashbacks to the nightmares I created in the early days, summing various quantities simultaneously in inner and outer loops and trying to keep them all in sync. The imperative approach is not clearer here. Had I learned to express what I was doing in a functional style, the odds are good that I would have escaped that quagmire much faster (and maybe even realized that what I was doing was not actually necessary for the program). I've heard it said before that object oriented programs let you use objects to model a problem. In my experience that has been a false promise. Objects create a layer in between you and the problem. Almost universally in programming, the problem is in the data: some input has to be turned into output. Functional programming is not short of ways to model that data and define transformations on it. What it avoids doing is handing the data off to a sovereign domain of control that might mutate it according to its own opaque rules. When functional programming works, it works because it links the program's input to its output in an unbroken chain. I have never seen anything comparable actually achieved in a Java program. When it comes to polymorphism, it seems like this potential strength of OOP is unavoidably tied to what I see as its greatest weakness, which is that objects are opaque to the caller of a method. If one is careful with side effects, I do see how polymorphism can help build reusable code. I'll just add that many functional programming languages use duck typing to accomplish the same thing. Instead of defining a class or interface that future implementations must extend, one defines the contract of a function in terms of what is true of its type. In this system, things can interoperate by virtue of their common traits, regardless of whether they share the same explicit interface or abstract class. Of course this idea does have its drawbacks as well.
@oliver_twistor
@oliver_twistor 2 жыл бұрын
Ideally, interfaces in OO languages such as Java shouldn't be huge lists of things that needs to be implemented. When I'm creating interfaces in Java, I try to make them as small as possible, preferably a single method. Since classes in Java can implement more than one interface, and by having very small interfaces, you can come close to duck typing. You don't have to worry that a particular interface is implemented together with 20 other interfaces in one class, you're only interested in a tiny portion of a class' implementation.
@thestemgamer3346
@thestemgamer3346 Жыл бұрын
You don't need duck typing to achieve polymorphism. Just generics and typeclasses.
@gustavoandrade58
@gustavoandrade58 Жыл бұрын
Oh man, this functional folks always use the bad examples of other things to show their point... It is PERFECTLY possible to work with composition using OO paradigm avoiding bloated inheritance. It is PERFECTLY possible to work with functional programming and OO at the same time. Just use the best of both worlds, it seems people have the NEED to be in a "club" and talk shit about other "clubs". I still remember the early Ruby days, where every Ruby programmer felt like they were in the higher ground, talking shit about java, php, etc... and that ruby was the best language. And now, is dying... Not because is bad but rather because competition is fierce and new generations have new tastes. So please, step down from that ivory tower because things change, and change fast.
@mattiasmartens9972
@mattiasmartens9972 Жыл бұрын
@@gustavoandrade58 I am a Typescript programmer.
@simonpettersson6788
@simonpettersson6788 Жыл бұрын
Polymorphism is widely used in functional languages too, i.e. type classes in Haskell and row polymorphism in Elm.
@royfu4971
@royfu4971 3 жыл бұрын
Awesome talk. The last piece in this talk on the "pure message sending" idea, actually reminds me more about Erlang&OTP rather than smaltalk or ruby.
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Thanks, yes, it is very like Erlang.
@TheDerwisch77
@TheDerwisch77 2 жыл бұрын
@@ContinuousDelivery Or if you want to go more mainstream with java or its more functional sister scala, you get this using akka. It's heavily inspired by Erlang and OTP.
@nerophon
@nerophon 2 жыл бұрын
Yes, I worked in Erlang for quite a while and I was thinking the same thing. It really does make coding complex distributed systems a lot easier. A feel that Go is a promising candidate for a fairly contemporary language which can do this, and also ticks a lot of other boxes in terms of the good parts of OO and functional.
@reilithion
@reilithion 2 жыл бұрын
It sounds to me very much like pi calculus. It's a bit like lambda calculus in how it's a mathematical model that keeps itself very simple in concept. But everything is passing messages. Computation itself is passing messages.
@wtrmute
@wtrmute 2 жыл бұрын
As far as I understood what he meant, I think he's talking about C. A. R. Hoare's [Communicating Sequential Processes](ora.ox.ac.uk/objects/uuid:e0143106-e414-4f02-bd3d-3f3f8db34e88/download_file?safe_filename=H77%252520-%252520Communicating.pdf&file_format=application%2Fpdf&type_of_work=General+item). And while I do agree with him that we are unlikely to have seen every programming paradigm that can ever be, we have certainly seen this one.
@carlosrijo3759
@carlosrijo3759 2 жыл бұрын
Hello Sir! I am unsure about the differences between Actor Model approach (like the one implemented in Erlang/Elixir, Akka, Vertx to name a few) and the paradigm you theorize at the end of your video. Could you please shed a light on this?
@llpBR
@llpBR 2 жыл бұрын
I do agree about everything said here. My only complain nowadays is the overcomplicated codes I find in OO around. Things you could easily solve with a script or a sql procedure are solved using a huge amount of things, using a lot of memory and processing.
@madhupramod
@madhupramod 3 жыл бұрын
Why don’t you like async await? I’d love to hear more of your thoughts on that
@KangJangkrik
@KangJangkrik 2 жыл бұрын
Yeah I want to know too! To be honest it's better than Kotlin's coroutine in term of syntax length
@AntonMochalin
@AntonMochalin 2 жыл бұрын
I think he meant that async/await ruins that constraint he was proposing - you write async code as synchronized with async/await and that's what he would like to avoid. Which means you basically hide concurrency from yourself by doing async/await. Good when there's no actual concurrency (e.g. when you await for database to return a query result), bad when there's actual concurrency happening. Not sure that "asynchronous only" constraint would lead to more readable code though. But definitely would make developers think about possible concurrency issues.
@gedw99
@gedw99 2 жыл бұрын
@@AntonMochalin I think the key was threading And him saying messaging passing by it’s nature does not rely on cpu tricks hiding the apparent multi threading from you like asynchronere wait. I agree with him and use events and message passing between modules . If you need to scale just start up many of the same modules and use a queue group to load balance each being given work to do . You can do this pattern inside a single binary of many processes or servers with no code change if you use good message passing patterns
@airman122469
@airman122469 2 жыл бұрын
Because it’s not deterministic, and can be memory unsafe.
@norpriest521
@norpriest521 2 жыл бұрын
@@airman122469 What the hell are you guys talking about? 😂 And why Arts student like me is in here?😂
@xenopheliac7202
@xenopheliac7202 3 жыл бұрын
As a fulltime C# developer, and spare-time Haskell developer, I must say, that the absolute elegance of 'sum = foldl (+) 0' was what won me over! There is a reason that mathematical notation is the way it is, and not like English. Once you know the symbols, it becomes hugely expressive.
@totalermist
@totalermist 3 жыл бұрын
Uh. Bad example. There is no such thing as standard mathematical notation. Maths papers usually carefully define the particular notation used throughout the paper for that reason. Without proper context, a mathematical statement can mean pretty much anything: |A| can be the magnitude of a vector A, or the determinant of a matrix A, or the absolute value of an integer A, or the absolute value (aka modulus, aka magnitude) a complex value A... C++ is guilty of this - an expression like auto x = y() tells you _nothing_ about the type of x or y and the operation performed. Could be anything from a ctor call, to a function call, to an operator call on a class instance. Horrible. It gets even worse if you add initializer lists when expressions like f({1, 2}) become impossible to decode without tooling or context ({1, 2} could be an initializer list, an implicit tuple, a std::pair, a ctor call to a class that accepts two arguments that can be implicitly converted from ints, etc.)... I don't want my programming language to be like that. IMHO, expressiveness is overrated. A developer spends far more time reading and contemplating code than writing code and clear code is always better than clever code when it comes to understanding.
@leandrog2785
@leandrog2785 3 жыл бұрын
Mathematical notation is a language. If you're not fluent in it at all, functional programming is hard. If you are, it's intuitive. Unfortunately, almost no one is fluent in it. Most people don't even realize there is something to be fluent in.
@oShinobu
@oShinobu 3 жыл бұрын
@@totalermist I agree with your last argument that clear code is better than clever code. However, I don't think code needs tons of boilerplate to be clear - in fact, I think boilerplate reduces the readability massively. In functional programming languages like Haskell, there are also clear ways vs. clever ways to implement something. I think the example he gave with "sum" is very clear to someone who is familiar with FP. It basically comes down to this: Do we want something that is accessible or something that is elegant? I for one do not want to settle for the lowest common denominator. But that's just my take.
@totalermist
@totalermist 3 жыл бұрын
@@oShinobu Clear code doesn't have to mean lots of boilerplate either. There are quite a few languages that strike a nice balance, such as Python, C# (though that suffered from feature creep as well), F#, Swift and even TypeScript or Ruby and Kotlin. It's nice that you personally don't want to settle for less, but the vast majority of developers deal with rather mundane tasks and line of business apps. Employers want to be able to hire staff that don't have a Master's degree or a PhD and would get bored rather quickly with LOB apps, UIs for interfacing databases and maintaining vast existing code bases written in "boring" languages like Java. That's why Go was created and its success seems to support this observation. (not that I personally like or endorse Go, but I understand why it exists)
@teeesen
@teeesen 3 жыл бұрын
@@totalermist He did say “mathematical notation” rather than “standard mathematical notation” . Haskell has its own standard and any Haskell programmer will roughly know what foldl means. If they don’t, this definition of sum is a good motivation to learn. But I think foldl is a good example of where Haskell takes good ideas too far. The default definition of foldl is ` foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z`, where t is some foldable object. This is not easy for beginners to grasp and leads to some really confusing error messages when you make a type error. The good idea is type classes. It’s a wonderful idea. The problem is it’s such a good idea that there is no clear line which should not be crossed in applying it. I think they crossed a line, but I’m not sure where. Perhaps `foldl f z t = foldl f z . toList t` would have been a better default. Who’s to say?
@javaguy5783
@javaguy5783 2 жыл бұрын
Great Video, love to hear more on this topic !
@mc.ivanov
@mc.ivanov 2 жыл бұрын
I think most programmers find functional programming because they never had to deal with it's constraints. Their brains are wired to write a different kind of code and that's why it looks harder. If you want to compare the sum example, I think a better comparison would be a "map" vs a "for". Which one will be easier for someone that has never coded before? Regarding the asynchronous modules that send messages to one another, that's what Erlang and Elixir do for many years and yes, this is really powerful and for me it seemed a lot easier to understand in a shorter amount of time than Python, JavaScript and C++ code in a professional setting.
@dojohansen123
@dojohansen123 4 ай бұрын
Agreed, except I would say that is why it *is* harder - when you're used to a different paradigm. It's not about it being __inherently__ more difficult. Then again, many people say math is hard, and I think that too is mostly a misunderstanding. (Although there is very advanced mathematics that truly is hard, but I think this is true of basically any subject that has been studied much by mankind...)
@D4no00
@D4no00 3 ай бұрын
This is absolutely true, I have worked with elixir in the professional scene for about 6 years now. If we talk about developer efficiency, maintenance and overall product quality, beating elixir or erlang in the field of distributed, highly concurrent applications is something you will not be able to do with one of the alternative languages currently on the market be it go,java or python. Immutable code is easier to reason about, is thread safe by design, pure functions are easy to reason about in a big and complex codebase, easy to test and debug and inherently have less bugs by design. It is argued that you can write functional code in most languages however that is not entirely true, languages like java were not designed for optimization of immutable structures, can't handle concurrency race-free on immutable structures, there are no managed side-effects. These things cannot be implemented as libraries, they need to be at the core of the language and runtime and impact directly the performance of the designed system. The way concurrency and OO concepts were implemented in erlang are superior by years to any languages I've seen nowadays. I could literally show you 45 minute presentation on how concurrency works in the runtime and even a kid will understand it, as it doesn't involve any low-level crap like mutexes, threads, race conditions, locks as the runtime and language abstracts everything for you, providing you great abstractions to get things done, not to reinvent the wheel on how to handle concurrency. I've not even mentioned to this point about fault-tolerance, a killer feature exclusive to erlang, that takes the combination of all these concepts to the next level and allows parts of the system to fail and self-heal with zero downtimes.
@foxoninetails_
@foxoninetails_ 2 жыл бұрын
I think you've hit the nail on the head with your constraint-based definitions. In my experience, the thing that a lot of "paradigm essentialists" (if you will) miss most often is that these paradigms are most powerful, and most useful, when you mix them. Over-applying any one constraint to your entire system leads to all sorts of workarounds, messiness, and general nonsense, as you try to fill the holes created by using that paradigm outside of its comfort zone. It's when you apply constraints carefully and thoughtfully in the places they're most needed that they really shine. For example, I tend to structure most of my programs with an object-oriented interface - anyone interacting with my code from the outside, myself included, will typically see it as a collection of objects and structures that offer specific sets of functionality for different use cases. Using that constraint helps me keep my code organized and modular, by allowing me to encapsulate specific concepts as "entities" within my system, and define rules about how they interact, as well as making it easy for others to conceptualize and understand at a high level. But a lot of my internal code, the implementation behind how those objects interact, is based on functional principles - breaking their operation down into pure or semi-pure functions, and reducing the code space to stringing together well known high-level operations. Using that constraint helps me ensure that I can quickly and easily reason about how things are functioning internally, and be confident that the smaller building blocks I've created work properly as I string them together into larger and more complex pieces. By mixing the two constraints to fulfill different needs, rather than sticking religiously to only one or the other, I achieve a greater whole in the long run. That view of mixing paradigms reflects how I try to treat everything in programming - as a tool. Far too many people seem to get religiously attached to an idea, a paradigm, a framework, a formatting style, what have you, rather than seeing each individual piece as a means to an end. They get too attached to their hammer, and everything starts to look like a nail. It's when you take a step back, let go of those attachments, and pick the right tools for the job that you can really start to do great work.
@leftaroundabout
@leftaroundabout 2 жыл бұрын
True. On the other hand, a certain amount of _consistency_ is definitely needed for all the paradigms, to actually reap the benefits. No doubt one of the reasons for Java's success is that it was the first mainstream language which had enough OO-constraining built in _enforced_ so even teams of largely unexperienced programmers would produce quite robust applications in it. (That is, what-Java-calls-OO constraining.) I personally find that quite annoying when I have to write Java - but then again, you can of course employ other paradigms in it, only, this can require some verbose wrappers which make it obvious. That has the downside of feeling slow & clunky to develop compared with, say, Python, but the advantage that it's less likely that the project will devolve into a mess of incompatible conventions. Likewise, even though Haskell is purely functional, it is quite possible to write imperative code in it - really imperative with in-place memory updates! - it just needs to be made explicit with a suitable monad. That way, you can again mix paradigms, but avoid bugs where one developer expects foo to be purely functional, but another decides to give it a side-effect that was not considered and breaks code elsewhere.
@livb4139
@livb4139 2 жыл бұрын
Word
@SimonWoodburyForget
@SimonWoodburyForget 2 жыл бұрын
You're missing the point of a paradigm though. The idea with ensuring you stick to a paradigm, is to allow the human brain to function efficiently. A code base is like a honeycomb structure for brains: you've seen one part of it, and you can easily keep repeating the same patterns for other parts of it, and it has nothing to do with solving problems faster, but purely about being capable meshing things together in such a way that they just work. The problem with jumping between OO and FP is that you fall into a pattern of switching between potentially incompatible patterns. If you play around too much with the paradigms (have your cake and eat it), you're going to confuse everyone who comes into the code base, so sticking to a small subset of either paradigms is extremely useful (if not absolutely required). For the same reason you don't build a house out of random objects you find on the street, you're not going to build a code base out of random paradigms you've found on Reddit. The larger number of paradigms you follow, the higher the complexity of your code base, and this is why people like to stick to either OO or FP, as those are the current high level seperations, and so it's the typical rough barrier of abstraction. You might *want* to treat paradigms as a "tool" but they're not a "tool"... they're a religion. The style of code base you go with isn't going to be based on scientific assumptions. It's not going to be scientifically proven to be the best way to go about things. You probably haven't even run double blind studies to figure out which pattern is best. This is what seperates art from science, or religion as you have it. The paradigm is in of itself simply a philosophy, so thinking of it like a "religion" isn't even incorrect in the slightest, because we pretty much are just making it up as we go.... I mean other then the fact that it's totally not a religion.
@klausehrhardt4481
@klausehrhardt4481 Жыл бұрын
Sounds good, specially if you work solo on projects, like I do. MCU firmware programer here - I know only the native assembler of two midrange family of MCU and a couple of directives native to vendor compilers mainly used to control data and code allocation. What I would like to know: is this war on paradigms not a direct result of a clash of diferent company cultures inherited by programers working for them? I feel it is. And that is why I liked the vid above and your remarks so much. Most people working in institutions have their mindset made up by those same institutions. The bigger, the stronger. They seem not to have the freedom to try a new thing. As a final sociological remark: people in big institutions seldom know the ends they work towards. The means they are allowed to come by seem also over-normalised. Megachurch stuff, I bet. Let me know your remarks.
@foxoninetails_
@foxoninetails_ Жыл бұрын
​@@SimonWoodburyForget I think our disagreement here can be summed up quite succinctly around your assertion that "the larger number of paradigms you follow, the higher the complexity of your code base". In general, this is true; it's easy to go too far in the other direction and jump between paradigms too much, creating issues and mess for yourself and your coworkers. However, you miss a key bit of nuance in that statement - there are times when forcing yourself to stick to the same paradigm, even in the face of a problem which that paradigm does not solve well, increases complexity as well. Not everything is easiest to think about in the same way! Switching paradigms is a tradeoff to be considered, not a sin to be avoided at all costs. Take Haskell, for example. Haskell is _excellent_ at creating and connecting tiny functional building blocks that can be easily reasoned about in isolation, so you can build a larger whole more easily. It's terrible, however, at anything outside of that specific focus area - any time you need to touch the outside world of messy IO and unpredictable inputs, it becomes an absolute nightmare. The language restricts you, quite forcibly, to a single paradigm, and while that is in many respects a benefit, it is also a detriment in others. Were you able to switch paradigms away from that strict, purely functional dogma and the hacks and workarounds needed to break outside of it and do real work, in favor of a paradigm better suited for that environment, your code would benefit greatly from momentarily stepping beyond a restriction that, while beneficial in other areas, is doing you no favors in that one. Programming is not a religious endeavor. There is no benefit to sticking so closely to a specific dogma that you refuse to part from it even for a moment. It's about _solving problems_, and preferably in a way that you can understand, replicate, extend, and maintain easily. When switching tools, like paradigms for example, makes things work more smoothly, the only thing you gain by refusing to do so is frustration.
@_indrid_cold_
@_indrid_cold_ 3 жыл бұрын
12:30 Absolutely agree and see this as a powerful argument for the functional approach. It forces me to understand what I’m trying to achieve with greater clarity and resolution. What a well thought out piece - thank you!
@otarshavadze9178
@otarshavadze9178 3 жыл бұрын
Few times I wrote code with "fancy" and short way. It worked for that moment, but after some time I had trouble and it take more time understand "what I tried here to do?" So i prefer bit longer, but more readable and understandable code.
@maddmethod5880
@maddmethod5880 2 жыл бұрын
The "limiting synchronicity" idea you described sounds a lot like Observables in the rxjs world. what would be interesting is if that were more common in desktop use cases, and if an observable response could be sent along a separate thread than it was initiated from
@macpmilo2020
@macpmilo2020 2 жыл бұрын
As a relatively newb to programming, this was really Insightful to me. I'm sure it'll allow me insights into the way I'm coding in the future. Thanks!
@imadetheuniverse4fun
@imadetheuniverse4fun 2 жыл бұрын
My introduction to programming in Python was mostly using the numpy library, so I inadvertently learned to code in more of a "functional paradigm" than not. When I started to look into Haskell I was struggling to find the difference between how to code in Haskell and how I was already coding in Python, funnily enough. Thankfully I think I learned in a way that exposed me to the best and the worst of both paradigms at the same time. It's really nice not having to subscribe to one "side" or the other, just use whatever makes the most sense for that use-case.
@supercheetah778
@supercheetah778 2 жыл бұрын
I'd be interested to get your take on Rust that takes little bits of inspiration from all different kinds paradigms, including both OO and functional, but eschews embracing any particular one wholly, such as implementing polymorphism, closures, and immutability by default, but purposefully leaving out inheritance.
@meanmole3212
@meanmole3212 Жыл бұрын
Rust is my number one programming language to develop with at the moment, but I wish they'd add an option for strict aliased types. The reason being that the borrow restriction almost always leads to structuring and manipulating your data by having bunch of structs inside a vector and another vector of usize values that has index values pointing to the real data vector. When your algorithms grow more complex, it becomes hard to make sense which usize value points to which vector of data. With strict aliased types you could alias the usize to have specific label for each specific data vector, and while doing so the compiler would prohibit you from using the wrong aliased type at wrong context. At the moment if you make a function that accepts aliased usize as its argument, you can pass any aliased usize type to that function as well as a regular usize value. There should be way to make this more strict. You can achieve this in theory by creating a new struct that has only 1 usize member, but it adds too much friction since you need to name that usize and access it every time with the dot operator.
@marshalsea000
@marshalsea000 2 жыл бұрын
Brilliantly presented, you have a new subscriber. The end comment of a new language paradigm is broadly described by mixing Event Driven and MicroService Architectures. This is now for a lot of developers, and an encouraged approach by AWS, Azure, GCP. For anyone interested in this, you need to be looking at Kafka (or other Stream oriented systems), and investigating Akka as this will give you a crash course in this area and cover a lot of the sub-architectural principals you need to understand (Event Sourcing, CRQS, Worker pattern). Also, the number of OO developers (and very senior ones at that) I've interviewed that do not understand polymorphism is painful. There's a reason there's an awful lot of bad OO code in the world - uneducated developers. Don't blame the language for stupid implementation.
@h4plugins334
@h4plugins334 2 жыл бұрын
Wow, I'm glad I warched to the end, the "message-passing" style is something I have just spent 3 months back-porting to my opus magnum (General-pupose all-singing ESP8266 / ESP32 asynchronous programming frame work - 10,000 lines C/C++) I call them "events" but thats EXACTLY how they work to overcome the sync / async timing boundary. The first training example app is called "EverythingIsAnEvent" to coax users gently into eaccepting that their own code becomes little more than a switch statement and a handful of small callbacks. I thought I had invented something quite clever ....after watching your vid, it turns out I have! It made my day :) PS Internally to that its a mix of 50/50 ish OO and functional, I use a LOT of C++ lambdas :)
@StefaanHimpe
@StefaanHimpe 3 жыл бұрын
A very interesting book in this context (in my opinion) is "Concepts, techniques, and models of computer programming" by Peter Van Roy.
@tommornini2470
@tommornini2470 2 жыл бұрын
The methodology described at the end of asynchronous message passing between modules is very nicely implemented in go(lang). Alan Kay’s description of object orientation was very much described as asynchronous objects that process messages received and likely generate new asynchronous messages of their own. His objects were much closer to Actors in today’s parlance: objects that do things rather than objects that are things…
@deathx0r
@deathx0r 8 ай бұрын
Also in OTP directly from erlang or through elixir.
@TheIst0NE
@TheIst0NE 2 жыл бұрын
Watched this a few weeks ago, and let it sink. Then watched it again now, paused at many points and took some notes. Organised the arguments and key points, wrote them down in an .md file and put it among my personal notes and studies. This is a brilliantly formatted line of thoughts one can bring up on a lecture, interview, or in a pub! Thank you very much, 10/10, would watch again, will seek out your other videos as well!
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Thanks, I am pleased that you liked it.
@dm9910
@dm9910 Жыл бұрын
I tried out functional programming but I think I like it more for what it taught me than for what it actually offered. The theory behind functional programming, particularly the idea of pure methods, has definitely made me think differently about the way I write OO code. But in the end, I still find it quicker and easier to read and write code in C#.
@hardryv3719
@hardryv3719 7 ай бұрын
Look to SOLID
@V000idZer000
@V000idZer000 7 ай бұрын
I think this is the best way to deal with it too. My two cents: OOP languages are still better supported all over the board and have more/better libraries and allow sometimes more control, even if doing the right thing requires a lot more discipline and some more code in most cases. I would always keep things as pure as possible and leave the part that needs mutability/IO centralized on the outside of the application (debug/log code is an exception here), but have the ability open the Pandora's box in these rare cases where it makes sense, eg. to use purpose specific pooling and custom memory/resource management. But if so, then only with a lot of care and caution taken. The little extra time invested to build such architecture, very soon starts to save time over the entire lifecycle.
@pedrobotsaris2036
@pedrobotsaris2036 3 жыл бұрын
In the end off the video you got close to describing Erlang which is a functional language
@TomislavJakopanec
@TomislavJakopanec 3 жыл бұрын
Was just thinking that also :-P
@JustHeathen
@JustHeathen 2 жыл бұрын
Exactly, Erlang and/or Elixir, pretty close description :)
@AustinSalonen
@AustinSalonen 2 жыл бұрын
Combined with OTP, which is a lot like Alan Kay's vision of OOP, you get a very powerful system (and one that's very fun to code in).
@gedw99
@gedw99 2 жыл бұрын
I used erlang but now use golang with nats . Very similar patterns
@HansTheGeek
@HansTheGeek 2 жыл бұрын
What makes elixir so flexible are macros. That’s another dimension not mentioned in the Video. Code that generates code.
@kguentube
@kguentube 3 жыл бұрын
great video! alternative paradigm mentioned on last minutes sounds me like erlang/elixir :)
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Yes I think that it is at least very similar. It is a form of Actor model, when my team 'invented' a version of it for the exchange that we built, we did this at an architectural level, rather than a language level, but the ideas certainly hold. The other system that is like this is Akka from Lightbend.
@kguentube
@kguentube 3 жыл бұрын
@@ContinuousDelivery Don't you think that, in a way, actor models or erlang are closer to Alan Kay's OO than Java or C++ ?
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
@@kguentube Yes, I think that they might be.
@richardhasting6046
@richardhasting6046 Жыл бұрын
Nicely done, simply explained. I would love to hear a conversation about how Java is moving towards functional concepts and creating something of a hybrid system.
@dan9948
@dan9948 2 жыл бұрын
The argument about constraints is a nice refreshing view!
@willful759
@willful759 2 жыл бұрын
"... functional is the new kid in the block" considering that lisp is inspired by lambda calculus, which is equivalent and contemporary to turing machines, the basis of computing, you can argue that in some sense functional programming came _before_ computers and programming, so yeah, thinking about functional as the new kid in the block is quite a mistake
@javierflores09
@javierflores09 2 жыл бұрын
how did we go from "we can argue that" to "you're wrong"? I think it isn't wrong to think of functional programming as rather new considering its popularity among new languages in the recent years, sure, it may have existed before but it was never a standard in the programming world as OO is, until now.
@JohnJohnson-ox3uc
@JohnJohnson-ox3uc 2 жыл бұрын
Fun fact: Lisp influenced the first OO languages.
@willful759
@willful759 2 жыл бұрын
@ཀཱ yeah, I didn't mean to say he was wrong, I was just adding to that statement
@ubercorey
@ubercorey 2 жыл бұрын
Good lord, this is the most cogent explanation of programming ive heard since ive been learning the subject the last 6 months.
@mehtubbhai9709
@mehtubbhai9709 Жыл бұрын
Hi Dave! Great talk as usual. Would definitely like to hear more abt constraining synchronicity. James Coplien worked on something called Trygve that is more closely aligned with Alan Kay's view of the OO paradigm.
@Twisol
@Twisol 2 жыл бұрын
Dave, as someone who strongly prefers functional programming, I really appreciate your balanced perspective here. I am curious if you're familiar with material on modeling in FP, such as Scott Wlaschin's "Domain Modeling Made Functional" -- I feel that I model early and deeply in FP, so it's a little hard to agree that OO is "more" focused on modeling; it seems orthogonal to choice of paradigm. That said, I mix and match OO and FP based on need (inasmuch as I try to limit and centralize mutable state as much as I can), so maybe I'm an outlier?
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Thanks, I tend to use a mix of OO and FP too, though mine is certainly OO with bits of FP rather than the other way around. I was trying to play this with a straight bat. I try to highlight the points where I am aware that my own prejudice may be involved. Thanks for the reference to the Domain Modeling in FP stuff, that sounds like something I will enjoy.
@ajibolaoki5064
@ajibolaoki5064 3 жыл бұрын
only just realised I'm a functional programmer after watching this video. Keep it up!
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Thanks
@PanduPoluan
@PanduPoluan 2 жыл бұрын
I do agree with the sentiment that "paradigms" are just "tools" to "help" programmers make good, maintainable code. Good habits learnt during mastery of a paradigm is actually applicable across lots of programming languages.
@pm1783
@pm1783 2 жыл бұрын
Why the quotes?? Lol…
@thefakepie1126
@thefakepie1126 2 жыл бұрын
your quotes makes it sound like an inuendo, yeah those """paradigms""" really are just """"tools"""" to really """""help""""" programmers
@AdobadoFantastico
@AdobadoFantastico 2 жыл бұрын
@@thefakepie1126 maybe they're instructions for an esoteric language like RockstarLang, but you code everything through ambiguous sarcasm.
@geoffwaddington4216
@geoffwaddington4216 Жыл бұрын
Agree on almost all points. I've programmed for the last 4 decades or so in everything from assembly to typescript and back again :) Years ago I thought I loved Smalltalk because it was pure OO, then I discovered functional and realized Smalltalk Blocks are just closures, so yeah, mixed paradigm is the ticket.
@joshbosworth6207
@joshbosworth6207 Жыл бұрын
Very interesting discussion. I'll add that I've encountered big issues onboarding teams of imperative style engineers with functional codebases. We've spent lots of time and money unwinding and rewriting code for this reason. In my experience, oo / imperative design is just more accessible, as you say, better aligns with human reasoning. I like a lot of what fp has to offer and _actively_ incorporate concepts, but it's often been an impediment to my work.
@larryculver4375
@larryculver4375 2 жыл бұрын
In college I spent some time learning how to unfold recursion. Now we are trying to fold it back together again.
@sourcake1294
@sourcake1294 2 жыл бұрын
I write in C, and i've also started thinking more in terms of limiting side-effects of procedures, after learning of functional programming. This is a very good video. Thanks.
@siyaram2855
@siyaram2855 2 жыл бұрын
Namaskar, What a wonderful video. This is regarding the last part of tge video. What do you think of ErLang? Alan said it implements all what he thought of OO should be. I would be glad if you can elaborate on the last part of where you shared your own idea of a concurrency model. 🙏
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Yes, Erlang is certainly very close, if not the same, idea. I have had it on my list of things to learn for some time. I talk about my version of that approach in more detail in this video: kzbin.info/www/bejne/m4PbfZmLfrJ9rc0
@NullLabs
@NullLabs 2 жыл бұрын
Want to say I really appreciate your video and am going to be promoting your video on my channel! awesome discourse on the subject! Keep up the awesome work!
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Thank you for your support!
@austinabro2027
@austinabro2027 3 жыл бұрын
You should definitely go more in depth on your idea at the end in future videos!
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Will do, thanks.
@blitzkr1egg
@blitzkr1egg 3 жыл бұрын
Maybe something about Sending async messages = actors
@viniciusgarcia3452
@viniciusgarcia3452 3 жыл бұрын
Also maybe worth mentioning is that there are at least two languages that I know of that are working with interesting paradigms for sending messages between asynchronous modules: Golang and Elixir
@viniciusgarcia3452
@viniciusgarcia3452 3 жыл бұрын
And about this same subject of concurrency and paradigms, there is one very interest article I read recently that compares the conditions that lead to the advent structured programming with the current way we work with concurrency. And proposes an interesting way of restricting the creation of new threads in order to make the code more predictable and provable: vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/
@davefarley77
@davefarley77 3 жыл бұрын
@@viniciusgarcia3452 yes, and Erlang, though that is nearly the same thing as Elixir as I understand it.
@peterpodgorski
@peterpodgorski 3 жыл бұрын
Great and informative as always! What I find funny is that while I'm not a functional programmer by any stretch, I do try to write my code as declarative as possible and actually find the functional examples in the video *a lot* easier to read :)
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Yes, I was surprised by some of them, though many examples that I looked through took a while to pore over to unpick. Good code is readable whatever the paradigm and bad code is not.
@DavidAguileraMoncusi
@DavidAguileraMoncusi 3 жыл бұрын
@@ContinuousDelivery Functional programming can be extremely abstract, but a "basic" example is actually easier to understand for a beginner who doesn't know anything about any programming language. Consider your "sum" example. In functional programming, the code is pretty close to natural language: if there aren't any numbers, the sum is 0. If there are, the sum is the first number plus the sum of the rest. In imperative programming, the code is more complicated. First you declare a counter and set it to zero, because you haven't added anything yet. Then, using a "for" loop, you need a counter to keep track of the index of the element you need to add next (it starts in zero, it's valid until you reach the number of elements in the array, and you add 1 to this index counter at each step). Think of it as your "finger" pointing to the list. Wow, okay... Then you need to access the value that it's in the list using its index and accumulate said value to the result counter you first initialized. Then return the value. Sure, the imperative approach improves massively if you use a "foreach" loop, and it also resembles natural language: foreach element in the list, add it to the accumulator. So what about sorting a list? Haskell's approach to this problem always blows my mind :-)
@darrengrant8598
@darrengrant8598 2 жыл бұрын
@@ContinuousDelivery One thing I am periodically and unexpectedly sidelined by is how what is readable changes, especially when working on teams with members who span generations or disciplines. I have had project managers be surprised when explaining that, no, just because we are all programmers doesn't mean we can somehow understand each other automatically.
@PrimalCoder
@PrimalCoder 2 жыл бұрын
First time watching one of your videos, and it is an instant like. Thank you for taking the time to share your experience and understanding.
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Thanks and welcome
@purdysanchez
@purdysanchez Жыл бұрын
Great video. Thank you for sharing your wisdom and experience with the community. I like both functional and OOP and think they work well for different types of tasks. C# embraced both styles and Java followed suit with later vesrions.
@tomcowell9653
@tomcowell9653 3 жыл бұрын
Thank you for this. I haven't done much software development, but I have done an awful lot of maintenance, mainly of a complex C++ project started in the 90s by some Fortran programmers who got to page of 4 of their C++ book and said "well, we don't know what we're trying to achieve, but we definitely need a big ol' class hierarchy". Later, when I had a medium-sized project of my very own, I went for: A lean class hierarchy, concise interfaces, minimal use of new, passing by const reference wherever possible, and RAII wherever appropriate. And it worked pretty well. After watching this video, I think that perhaps I had faint notions of a functional programming style. Which is nice.
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
I love your description of "well, we don't know what we're trying to achieve, but we definitely need a big ol' class hierarchy" that resonates 🤣
@adrianperez8695
@adrianperez8695 3 жыл бұрын
I think one of the strengths of an imperative style is also it's weakness. I can look at an imperative block of code and navigate through it, line by line "executing" it in my mind to figure out what it does. It allows me to figure things out bit by bit. This is also a weakness though; if I don't execute the code with different inputs, and if I don't execute it completely (i.e. I just skim through the code) I won't truly understand this. Never mind the fact that any time there is a branching statement, I have more execution paths to consider. More functional code allows me to abstract away imperative logic to somewhere else. A sub-procedure means I don't have to concern myself with the details of a procedure, just what it's arguments are and it's return. In a pure functional style, I can rest assured that even if I don't understand the function fully, it won't mess with the state of anything else so I am less likely to get strange behavior in other parts of my program. However, and I think this is to your point, I NEED to understand whatever my function is doing right up front. I cannot execute and reason my way through the code. I either know what a "map().filter().reduce()" does, or I don't. Given the nature of how abstract those functions are, it can also be difficult as a beginner to fully grasp. As a side note, I slightly disagree that the core concept of OO paradigms are polymorphism. Or rather I should say, I think a MORE core concept of OO is encapsulation. I often find closures and dynamic typing to be much more polymorphic than what the more strict OO languages provide.
@hieverybody4246
@hieverybody4246 3 жыл бұрын
The strength of the imperative style is that it's close to the hardware.
@sandipanumbc
@sandipanumbc 3 жыл бұрын
I think it's about the trade-off between the specification and the execution gaps of a programming language... Closer to hardware meaning easier to translate the program to machine-executable instructions hence lesser execution gap, whereas ease of translating a problem to a program in the language refers to the specification gap
@tobiasbergkvist4520
@tobiasbergkvist4520 3 жыл бұрын
Meaning that any language that allows for inheritance is not really a true OO-language, since inheritance also makes you inherit all the private fields/internal data. Inheritance as a concept is more similar to using patch-files to describe modifications of code than anything else. Rust is a more object-oriented language than Java, because it uses traits (which actually preserves encapsulation) and doesn't allow inheritance.
@hieverybody4246
@hieverybody4246 3 жыл бұрын
@@tobiasbergkvist4520 That's nonsense. You inherit an implementation, but you don't inherit the private data unless you use reflection to poke at them, which you explicitly aren't supposed to do.
@tobiasbergkvist4520
@tobiasbergkvist4520 3 жыл бұрын
@@hieverybody4246 What I mean is that you inherit the knowledge that these private fields exist, and get the ability to modify them. This means that it can be dangerous to change the implementation details of a class in the future, in case someone that inherited from it relies on something that is not part of the public interface.
@moczikgabor
@moczikgabor 2 жыл бұрын
When you brought up synchronous processing with the addItem(x) message, my first thought was it also copies the data in memory to be safe, passing by reference does not really work here. And my second thought were, is there any language which uses copy-on-write variable management? For example the caller of additem allocates x, then passes the reference, then the receiver could use it as needed. Whichever thread is going to run, can access the same memory as long as it won't write it. The one who first does, it (the runtime subsystem) makes a new copy, then the other still references his old copy. Then the runtime could release (GC) those copies that are ran out of scope. So it is passing by reference in nature, it is as fast, but behaves like pass by value if by any chance accessed concurrently. It is undeterministic, maybe to much overhead, and I don't know, whether would it even have more practical use case than preventing an inherently badly designed system to fail.
@leonardopsantos
@leonardopsantos Жыл бұрын
This video is so great! I've been programming for over 30 years, and I pretty much agree 100 % with the video. The idea of writing code with the least amount of side effects jumps to the face of anyone who uses test-driven development (or at least has a large base of unit tests). We want to test for the public interface of functions or methods, so a method that has no obvious output and only changes an object's internal state (like a plain old setter) is very hard to test in isolation. Using the functional paradigm that every function has to produce an output makes testing much easier, thus helping (IMHO) to develop better, more correct systems.
@DeanPickersgill
@DeanPickersgill 2 жыл бұрын
Excellent lecture, I'll show this to my students as a way of backing up my 'chaotic paradigm switching' theories - I always tell 'em to switch freely and happily between the methods that work best.
@vicsteiner
@vicsteiner Жыл бұрын
I like the focus on constraints. In a sense it is close to a way of thinking mathematically. I just think that computer science is beautiful and I simply enjoy learning it and working with it. I do feel sometimes people dislike something because you can not understand it immediately or without using more maths or logic. But many times once you learnt those things they become pretty simple and obvious (and readable!).
@prometheus9096
@prometheus9096 10 ай бұрын
To be hones't i think people have a hard time understanding functional is just because they mostly started learning in oop. I teached programming to a few people (with python) and introducing them to oop concepts was the last thing i did. They mostly where more confused by oop than by functional programming. All the side effects, encapsulation, inheritances etc. was overwhelming to them. While functional is relatively straight forward, there is your "box" -> "data" goes in -> new "data" comes out.
@L1da77
@L1da77 2 жыл бұрын
I love these kind of discussions. Not only claiming which is better but actually comparing and pointing at good and bad. Love it!
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Thanks for the positive feedback!
@TsuruchiBrian
@TsuruchiBrian 2 жыл бұрын
Is the concept you talk about at the end of your video basically what Qt signals and slots are doing?
@danieljensen2626
@danieljensen2626 2 жыл бұрын
I like the idea of taking the best bits from each, I think that probably makes more sense than going completely one way or the other.
@JeffreyRennie
@JeffreyRennie 3 жыл бұрын
Erlang very closely matches what you described in your reactive manifesto.
@AnupDhakalSharma
@AnupDhakalSharma 3 жыл бұрын
Yeap! And I was thinking of Elixir.
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Yes, it does.
@openroomxyz
@openroomxyz 3 жыл бұрын
Do you know any source where I could learn how to make the thing in C#?
@insertoyouroemail
@insertoyouroemail 3 жыл бұрын
@@openroomxyz you can do erlang style programming in C# with Akka.NET and reactive programming with Rx.NET
@Qrzychu92
@Qrzychu92 3 жыл бұрын
@@AnupDhakalSharma but Elixir sucks because it is dynamicaly typed...
@improvisedchaos8904
@improvisedchaos8904 Жыл бұрын
It's not everyday I subscribe to a random channel after watching a video a few minutes in. Great speaker , great presentation, I can follow along without even looking at the screen- sign of a king.
@ContinuousDelivery
@ContinuousDelivery Жыл бұрын
Thank you! Glad you have joined us. 🙏
@nomanhanafi9551
@nomanhanafi9551 2 жыл бұрын
I highly appreciate your versus series
@cornelmasson4610
@cornelmasson4610 2 жыл бұрын
From another grey-headed programmer, well done. There is no silver bullet, just pragmatics.
@felixlipski3956
@felixlipski3956 2 жыл бұрын
14:00 - FP looks convoluted in an OO language with functional features tacked on, what a surprise. 14:45 - you missed a " :: " between the name and the type signature. Were any functional programmers even involved in making this video?
@kcabra115
@kcabra115 2 жыл бұрын
clearly, no.
@mtnygard
@mtnygard 2 жыл бұрын
Dave, the framing around paradigms as constraint is really good. Regarding constraining synchronicity, your description sounded close to the actor model.
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Yes it is very close, if not the same, as actor.
@MoldovaStandsWithUkraine
@MoldovaStandsWithUkraine Жыл бұрын
Thanks I am attending a Functional Programming course after a Object Oriented one And your comparison and explanations widen my understanding of the basic concepts behind them
@ContinuousDelivery
@ContinuousDelivery Жыл бұрын
Glad it was helpful!
@MaxHaydenChiz
@MaxHaydenChiz 2 жыл бұрын
Several of things: 1. In my experience, the breakdown between functional vs OO is a matter of the problem domains a developer is used to dealing with. Some domains map more naturally to one or the other. If you haven't worked on a problem where the paradigm you like *doesn't* work, then you don't really understand the paradigm. And it seems like you just haven't had occasion to work on a problem where OO was a horrible fit and FP just flowed naturally. 2. What counts as "OO" differs widely depending on whether you are talking to someone who works in Java or Python or C++. You have a similar thing on the functional side between dynamically vs statically typed. But the difference is that the functional people have come up with a lot of careful terminology to communicate the specific intent behind the exact version of the paradigm they are using in any given library or system. I'm unaware of any comparably rigorous terminology on the OO side of the equation. 3. As others have mentioned, what you are talking about at the end is Erlang. What they left out is that this is how most soft-realtime systems are designed in practice regardless of language. For our purposes however, the important thing is that this design choice *forces* Erlang to be a dynamically typed pure functional language. That's the relevant mapping of the problem it is dealing with. 4. In any event, thinking in terms of paradigms obscures the real issue. A professional is going to use the paradigm that best fits the problem. But, however you are designing your code, the goal is do it in a way that lets your tooling automate as much of the work as possible and allows you to systematically rule out categories of behavior so that you can reduce your cognitive burden for the code you do have to write by hand. You *can* use any paradigm in any language, but what matters is the level of support you get from the language in actually doing it. It's a matter of "which tool is the best fit for my problem domain". The business case needs to be about productivity and cost, not about ideology and fads. We've been doing this long enough that we should be able to attach hard numbers to this stuff. The people in the comments complaining about managers not understanding need to learn how to make a business case for their preferences. Communicating effectively is at least half the job. 5. Math isn't exclusive to FP. Plenty of OO devs use dependently typed proof systems to validate their API designs before transcribing the proven code into a normal language as the basis for their API. You can do some amazingly advanced refactorings this way. 6. Finally, when it comes to the ease of understanding imperative vs functional code, you are just factually wrong. We've both been programming long enough that the imperative code *seems* natural to us. But we suffer from the curse of knowledge. People have done studies on what non-programmers find easier to understand and and experiments on what students find easier to learn. The evidence is very strongly in favor of functional code, to the point that the 2nd edition of _How to Design Programs_ dropped the chapter on imperative programming entirely (with the expectation that a subsequent class on OO would deal with it). Beyond that research, there are lots of additional intuitive data points. The most widely used programming language on the planet is Microsoft Excel -- a functional reactive programming system. Similarly, functional programming languages are overwhelmingly popular in cases where you have a design requirement that managers with no programming background must be able to do code review and audits. Non-programmers (and less experienced developers) do find functional code to be easier to understand. That doesn't mean it's the right approach for any given problem. But it does mean that experienced devs like you and I have a blind spot to this design consideration that we need to be aware of and factor into our decision making.
@Orlandofurioso95
@Orlandofurioso95 2 жыл бұрын
A well-thought, well-written, relevant comment that offers valuable insight and provides a counterpoint to the video? What has happened to the KZbin I know?
@jakistam1000
@jakistam1000 2 жыл бұрын
@@Orlandofurioso95 (Serious answer to non-serious question) Actually, that's not really an exception anymore, on educational channels. A lot od intelligent and qualified people write resopnses and additions inder well-made videos like this one. You can actually learn a lot from YT comments - though I still would only treat it as a tarting point, not real source.
@jakistam1000
@jakistam1000 2 жыл бұрын
@Max Hayden Chiz What fraction of people using Excel actually use it as a programming language? In my experience, it's almost always just adding columns together, if that. And yeah, maybe you could say that's programming... but I'm sceptical. But I don't really have any data, that's why I'm asking.
@Orlandofurioso95
@Orlandofurioso95 2 жыл бұрын
@@jakistam1000 I am currently writing my thesis for a Mathematics degree, and despite knowing C, Python, Zig, F#, Haskell and Matlab, half of my work is done in OpenOffice - it's just faster to shuffle data around and debug. Only the more hardcore computations are done in Matlab, where I have 100 lines of code to import a couple CSV exports of the Excel files, and three lines to solve a couple linear systems.
@woobilicious.
@woobilicious. 2 жыл бұрын
The holy grail is a typed Excel (And I kinda wish I was joking), it would definitely solve the MARCH1 issue.
@dmitryplatonov
@dmitryplatonov 2 жыл бұрын
Prevalence of OO thinking is by large the marketing Sun did with Java. It pushed it hard, schools and universities adopted it, and we are having what we are having now.
@acasualviewer5861
@acasualviewer5861 Жыл бұрын
I think you're too young then. We were pushed OO in the early 90s with C++. Late 80s Objective-C came out as well with NextStep (now known as MacOS). OO was a huge push in things like CORBA. Java just came along and simplified it.
@sis1296
@sis1296 Жыл бұрын
Did C++ way before Java/C# came along.
@dmitryplatonov
@dmitryplatonov Жыл бұрын
@@sis1296 yes, but that time it was not prevalent paradigm.
@acasualviewer5861
@acasualviewer5861 Жыл бұрын
@@dmitryplatonov of course it was.. back then Windows programming was the big thing and C++ was the language to use for it along with the MFC framework.
@dmitryplatonov
@dmitryplatonov Жыл бұрын
@@acasualviewer5861 well, it was major paradigm for UI. But I feel that Java did try to cram everything, business logic specifically, into class hierarchy model. And they sponsored teaching generation of programmers how to do so.
@rickwalters8553
@rickwalters8553 2 жыл бұрын
Great talk. I don’t agree with everything, but that’s not a bug that’s a feature! Very thought provoking. I have done a reasonable amount of work in OO, FP, and Actor Model (Erlang/Elixir, which you allude to at the end) and would say that the cross-pollination of concepts and constraints is really eye-opening… but also add that no one paradigm is optimal for solving every kind of problem in every domain
@manuel-rubio
@manuel-rubio 2 жыл бұрын
I completely agree when you say it's a fashion. Both have their pros and cons and both are useful. Even, when you show the code: var x = 0; for (c size(elements, 0) size([_|elements], x) -> size(elements, x+1) size([], x) -> x But as I said, both are great. You only need to write to make sense and it works as expected.
@j-r-hill
@j-r-hill 3 жыл бұрын
I find your last points about OO being about modeling and FP being more mathy interesting. I've definitely done more OO than FP for work, but I find the FP paradigm far more intuitive, and to lead to better modeling than OO tends to. Yes in the trivial cases, OO makes for a nice `new Dog.bark()` experience, but anything complex leads to Factories and Providers and "Utility classes." I don't think those are good ways to model problems. We just need to get someone that can come up with better names and explanations for Monads and Functors and Applicatives etc. They are "mathy" in name, but I don't think they are in practice
@insertoyouroemail
@insertoyouroemail 3 жыл бұрын
Interesting. You may be right. What's really neat about a "semigroup" or a "functor" for example is that it's unambigous what laws it must obey. It's just a word at the end of the day. I think a lot of programmers (including me) get insecure and intimidated when we hear strange terms. As someone who doesn't like naming variables and procedures and systems and even hates discussion around naming, I celebrate the opportunity to expand my vocabulary with exact definitions.
@j-r-hill
@j-r-hill 3 жыл бұрын
There also just is not material out there to help an average programmer be successful in Haskell (for example). You have to have time to focus, and either know enough math jargon to digest academic literature, or be obsessively motivated. Compared to the wealth of accessible literature you can find on Java, Python, JavaScript, etc., there's almost nothing for functional languages
@insertoyouroemail
@insertoyouroemail 3 жыл бұрын
@@j-r-hill yes, you are completely right about that
@____uncompetative
@____uncompetative 3 жыл бұрын
Every single paradigm is wrong.
@sendyofindia
@sendyofindia 2 жыл бұрын
you mentioned that you hate async/await :) Please make a video for us regarding that
@dorinp007
@dorinp007 2 жыл бұрын
Yes, we DO like to know more about these! :) Thank you!
@hyperhero8345
@hyperhero8345 8 ай бұрын
Could you elaborate on what restrictions you placed on yourself while writing assembly and also what paradigm they belong to?
@ContinuousDelivery
@ContinuousDelivery 8 ай бұрын
They don't really belong to any paradigm, you have the freedom, and the challenge, to choose. I used to write fairly OO style things sometimes. For example I wrote a small framework for building "Sprite based games" "Sprites" were true objects, data and logic that represented game elements. Quite OO in concept. Quite a lot was pretty functional, but the majority of my assembler code, at least, was procedural. Most of my professional work in assembler was fairly early in my career, and so my views on design have evolved since then, but the main thing was still, with hind-sight, trying to proceed in small steps, because it is VERY easy to loose way in assembler programming. One of the things that I like about it is that demands a laser-focus, it is hard to return to after interruptions for example.
@dealloc
@dealloc 3 жыл бұрын
The last part of the video sounds like Erlang and Elixir (which is also based on Erlang and runs on Erlang VM).
@caseyhawthorne7138
@caseyhawthorne7138 2 жыл бұрын
Yes, you can write good code in any language The issue is, whether others can READ your code 🖖
@PierredeCur
@PierredeCur 2 жыл бұрын
As a retired programmer who has gone trailblazing through all these paradigms - beginning with assembler too -, I completely agree with you about the *constraints* and their vital importance. Not only that, but, being also a poet of the kind who writes mainly sonnets in alexandrines according to the rule of classical poetry (in French), it's also under the strictest constraints that the best verses have been made. In C, I always worked under a shell of constraints, some general, but most built ad hoc for each project, that took me so much time that it was often criticized because I would never be on time, but I never failed a deadline and my team always ended its job before the rest.
@ContinuousDelivery
@ContinuousDelivery 2 жыл бұрын
Yes I think in very open languages like assembler and C, we invented our own constraints from self-defense. I certainly had common approaches in both for certain types of problems.
@PierredeCur
@PierredeCur 2 жыл бұрын
@@ContinuousDelivery it's funny how I often receive as a poet the same kind of criticism as a coder, be it for the "freedom" of the free verses or of the goto... :-) But I see the constraints of my code as I see those of the sonnets and alexandrines, not as chains that limit me, but like a frame, a foundation on which to pose my words or code. :-)
@mattgraves3709
@mattgraves3709 2 жыл бұрын
I really enjoy your videos. Thank you for sharing your experience I find value in these ideas. I will be a little critical and say I really don't care for the boxing ring bell sound. Just my 2 c. and who am I?...another guy with an oppinion I guess. Love the content, and the quality is good. thanks again.
@acobster
@acobster 2 жыл бұрын
9:41 polymorphism is not an exclusively OO idea. Most OO (in the "Object" sense) languages just happen to conflate polymorphism with inheritance, which is exclusive to that style.
@Gnidel
@Gnidel 2 жыл бұрын
You can do polymorphism without inheritance. Reflection is using that.
@fat_pigeon
@fat_pigeon 2 жыл бұрын
For example, Haskell implements polymorphism using type classes, which constitute a very different approach from OO.
@bartoszdolewski4915
@bartoszdolewski4915 3 жыл бұрын
When I put my functional programmer's hat I have to think more about data types. I'm thinking about sum (enums) and product (structures) type to model things as close as possible to given domain. I try to work by the same idea when I write OO code which is more than 50% of my code being produced. However it's easier for me to think about objects as things that are data + behaviors while in FP world functions are things (which is weird to me). I am mobile developer so I deal with lots of OO frameworks but due to asynchronous nature of EVERYTHING - it's easier for me to model things in FP style (not to mention reactive twist to FP). I may be biased here but OO was invented in times where multithreading, concurrency was not a thing for desktop computers. Try to write thread-safe code in OO though...
@BarrySlisk
@BarrySlisk 2 жыл бұрын
"Try to write thread-safe code in OO though" Why is that especially a problem in OO?
@bartoszdolewski4915
@bartoszdolewski4915 2 жыл бұрын
@@BarrySlisk When you have class where variables and functions and put together, then the variables (properties) of that class are "shared" with class methods. You can run some method A on 1 thread and then method B on thread 2 but they will modify the property "amount" or "jsonData" or whatever. It's very easy to do mistakes like that in OO. In (pure) FP languages there are no shared variables which also bends your mind because it's not easy concept for developers to tackle.
@pateastwood
@pateastwood 2 жыл бұрын
When Allan Kay emphasized the concept of messaging, was he not talking about the messaging concept as represented in the actor model? I think that the actor model truly embodies the concept of messaging between entities since it is the only mean of communication between actors. In OO, objects communicate through method calls, which is not equivalent to message passing in my opinion (it's kind of like REST calls vs event driven communication at the application level). Also, about that paradigm you talked at the end of the video, wouldn't the actor model fit? Each actor process one message at time and process it asynchronously.
@rumble1925
@rumble1925 2 жыл бұрын
The haskell sum can be expressed in javascript as const sum = (list) => list.reduce(add, 0); I think this concept is definitely more readable when you use a familiar syntax
@isaacamezcua2315
@isaacamezcua2315 3 жыл бұрын
Excellent video! I personally prefer languages that mixes both, OO and FP such as Scala. I am feeling that the more I gain expertise from each paradigm, the better I am coding using both approaches at the same time.
@ContinuousDelivery
@ContinuousDelivery 3 жыл бұрын
Yes, I agree, this shouldn't be about waring camps, ultimately it is about haveing access to a selection of tools that we can apply, as appropriate, to the job in-hand.
@teeesen
@teeesen 3 жыл бұрын
More and more I’m doing OO with immutable objects. Scala is perfect for this, but it can be done in any OO language.
@defeqel6537
@defeqel6537 2 жыл бұрын
@@teeesen my dearest hope is for C/C++ compatible language which would basically be C++, but with better defaults (e.g. mutable instead of const, for both variables and methods, and for both definitions and call sites)
@teeesen
@teeesen 2 жыл бұрын
@@defeqel6537 One of Ric Holt’s language design principles is “usage shortens form”; for example in Turing it is easier to write an output statement that puts an newline at the end than one that doesn’t because the former is the more commonly used case. But there is a related principle “shortness forms usage”; make it easier to write correct code than incorrect.
@fat_pigeon
@fat_pigeon 2 жыл бұрын
@@defeqel6537 The problem is that C++ has deeper design flaws that can't be fixed by flipping defaults and similar superficial changes. For example, argument-dependent lookup is an incoherent hack, but enough of the rest of language depends on it that replacing it with sane namespace semantics would break compatibility.
@bloblife
@bloblife 2 жыл бұрын
Doood... I soooo appreciated this talk. As a quarter-century dev, I've grown so tired of the "Holy Wars". And I really appreciate this more balanced, logical approach to programming paradigms. Thank you for this.
@ShadCollins
@ShadCollins 2 жыл бұрын
It is always frustrating when you talk to young programmers and they are like we are doing it the modern way! All the ways software was written before weren't right. You just don't get it. I laugh because decades of perfectly functional software have been written before they were born.
@JulieanGalak
@JulieanGalak Жыл бұрын
Why not both? In college, in one of my Computer Science classes, we used Dylan, an object-oriented functional language (loosely based on Scheme). I found it to be a very elegant and enjoyable language to program in. Sadly, it's not a language that's much in use outside some academic and personal projects... :) Great video!
@MrX-nc8cm
@MrX-nc8cm Жыл бұрын
I love these talks sir. Im glad I found your channel, thanks!
@ContinuousDelivery
@ContinuousDelivery Жыл бұрын
Glad you like them!
Rockstar Developers Are THE WORST Developers
17:26
Continuous Delivery
Рет қаралды 101 М.
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
He wasn't having fun 🫢 #shorts
00:13
Маджит Сулейманов
Рет қаралды 4,4 МЛН
ОПЯТЬ СИРЕНА ВКЛЮЧАЕТСЯ!?😲😲😲
00:56
Chapitosiki
Рет қаралды 37 МЛН
🤯 24 часа в моей итальянской семье @nastyawhere
00:39
FP vs OOP | For Dummies
8:43
BasicOverflow
Рет қаралды 170 М.
Uncle Bob LOVES Functional Programming | Prime Reacts
22:59
ThePrimeTime
Рет қаралды 103 М.
Avoid These Common Mistakes Junior Developers Make!
17:54
Continuous Delivery
Рет қаралды 156 М.
Functional Programming in 40 Minutes • Russ Olsen • GOTO 2018
41:35
GOTO Conferences
Рет қаралды 799 М.
Object Oriented Programming is not what I thought - Talk by Anjana Vakil
38:51
Why Pull Requests Are A BAD IDEA
19:13
Continuous Delivery
Рет қаралды 222 М.
Object Oriented Programming is Good | Prime Reacts
31:30
ThePrimeTime
Рет қаралды 271 М.
Functional Programming & Haskell - Computerphile
9:19
Computerphile
Рет қаралды 652 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Continuous Integration vs Feature Branch Workflow
17:31
Continuous Delivery
Рет қаралды 183 М.
iPhone 19?
0:16
ARGEN
Рет қаралды 2,6 МЛН
Broken Flex Repair #technology #mobilerepair
0:55
ideal institute aligarh
Рет қаралды 7 МЛН