Object-Oriented Programming is Bad

  Рет қаралды 2,390,019

Brian Will

Brian Will

Күн бұрын

Пікірлер: 9 300
@miloszivkovic6256
@miloszivkovic6256 4 жыл бұрын
"There are only two kinds of languages: the ones people complain about and the ones nobody uses." - Bjarne Stroustrup
@cruelplatypus67
@cruelplatypus67 4 жыл бұрын
@@gl3nda96 so you did the deed?
@geeshta
@geeshta 4 жыл бұрын
- every video or post about programming languages anywhere on the internet
@geeshta
@geeshta 4 жыл бұрын
Neither being used, nor being complained about make any language good.
@brantran3754
@brantran3754 4 жыл бұрын
It's just another way to say the set of all languages is distinct from the empty set. Every language has it's flaws and so there will be complaints about every language. Even if there was a perfect language people would still have different opinions on it. So basically what you posted is a true statement with no use.
@rosek6585
@rosek6585 4 жыл бұрын
I still never met a person who uses C and complains about C.
@trashpanda2481
@trashpanda2481 5 жыл бұрын
The irony of this video is most people watching it are just going to be better at OOP by the end of it.
@parmakSS
@parmakSS 5 жыл бұрын
that is because Brian Will understands OOP. to criticize something you first have to understand it. and if you believe he know OOP better than most of us and also procedural, why is there so much disbelieve in his statement that procedural is better? the way Java does OOP is just a special case of procedural programming. it forbids a lot and what it does not is called OOP in Java.
@TheSimoc
@TheSimoc 3 жыл бұрын
Yes, and for yet another level of irony, this was at least as boring and confusing as are the tutorial lessons and especially those advocat-preaching speeches of OOP. Well, literally couldn't agree more - only the limits of understanding make barrier for agreeing. This proves that to the limit of understanding and beyond, OOP sucks!
@modernNeanderthal800
@modernNeanderthal800 3 жыл бұрын
The objective was to get better not perfect
@75hilmar
@75hilmar 3 жыл бұрын
I understood maybe one third of the video but between the lines it seemed to make a pretty solid case for OOP.
@youuuuuuuuuuutube
@youuuuuuuuuuutube 3 жыл бұрын
@@75hilmar I understood all of it and I can say that if you understood the other 2/3rds, you wouldn't say that. He's really destroying OOP.
@Vgamer311
@Vgamer311 5 жыл бұрын
Hm, yes, this video has definitively shown me that I don’t actually know enough about programming to properly understand this video.
@ClysmiC11
@ClysmiC11 5 жыл бұрын
Just give it a bit of time and one or two serious/professional projects and you will know the problem firsthand!
@GuerreroMisterioso95
@GuerreroMisterioso95 5 жыл бұрын
After two years in university you will understand it.
@avatar098
@avatar098 5 жыл бұрын
@@GuerreroMisterioso95 Give him 1-2 years in industry and he will definitely understand it if not already
@clementcazaud8040
@clementcazaud8040 5 жыл бұрын
No worry, you have nothing worthy to understand from this video. Better read Gang of 4, Martin Fowler, Robert Martin and other references. His whole argumentation, especially about encapsulation (eg from: 23:04) , is extremely biased and perverse. His arguments are based on object graph examples which are badly designed in first place. If you respect reasonably SOLID and general OOP principles, you should NEVER get that kind of spaghetti object graph in first place. Then the code would be encapsulated already (SRP, DIP, ISP, LSP, demeter law, and so on...). Then you wouldn't need to encapsulate non existing spaghettis such as he's attempting to, to make his point about how "OOP is bad". And about his statement: "Abstraction = simplified complextity; abstract = hard to understand". Well why abstraction simplifies complexity is because we do NOT have to understand what is abstracted if it's abstracted, so again a perverse argument... Furthermore, abstraction is not more related to OOP than to procedural or any other paradigm. "Mistery why industry tends by far toward OOP"... Did you try developping then maintaining complex enterprise applications (changing often) in procedural, compared to OO? That wouldn't be a mistery anymore for you then... "Procedural languages are more polymorphic than OO languages", lol, special mention for that collector one... And the same goes for a lot of his arguments... That guy is a clickbait sophist misleading least experimented people...
@comicsans1689
@comicsans1689 5 жыл бұрын
@Clément Cazaud Have you seen the guy's video where he breaks down four real OOP examples from proponents of OOP and how they could be rewritten in procedural form? I think one of the examples in that video was from Uncle Bob (Robert Martin). To be clear, I really respect Uncle Bob and I've bought and read his Clean Code book (his chapters about comments, naming things, and code rot really convinced me to kick some bad habits while programming), but I think the guy's video brings up an interesting point on how one example of Uncle Bob's code being convoluted because it was written in OOP fashion. I'm still relatively new to programming, so my opinion probably isn't really worth much at this point.
@atalhlla
@atalhlla Жыл бұрын
“Better to start with a free form structure than to eagerly create one that turns out to be wrong.” I learned that lesson the hard way.
@life_score
@life_score 2 ай бұрын
As long as you don’t abandon structuring in lieu of working code later on 😐
@atalhlla
@atalhlla 2 ай бұрын
@@life_score Indeed. That’s why it’s “Start with a free form structure” and not “Only use a free form structure”.
@life_score
@life_score 2 ай бұрын
@@atalhlla yeah, but that usually ends up being a trap. Most people don’t take time to improve code once it’s in working condition!
@wayhip
@wayhip 2 ай бұрын
given that requirements are always changing, a free form approach is more appropriate. If you start out with a rigid plan/structure you are in fact doing waterfall.
@QuipyGirbo
@QuipyGirbo 3 жыл бұрын
The biggest takeaway I get from this, is that this man really, really hates jumping around. He wants to read the function in one place. I can respect it.
@googleuser2016
@googleuser2016 3 жыл бұрын
Well and I don't want to read the function at all when using it in a smaller context somewhere else, what I don't have to if it is on e well named, well abstracted and I know it's tested.
@ldw821
@ldw821 3 жыл бұрын
@@googleuser2016 This exactly. The author of the video would have you believe that readability is just about aesthetics, while in reality it's arguably one of the most important things and we spend a lot more time reading existing code than writing it.
@s0mbres
@s0mbres 3 жыл бұрын
Jumping around makes debugging other people's code an abysmal experience
@rndszrvaltas
@rndszrvaltas 3 жыл бұрын
@@s0mbres Could you elaborate on that? I work with (old-ish C-based) rail control systems with dozens of processes and as you can consequently imagine, hundreds of source files and thousands of functions all around. Nothing makes me feel more thankful than coming across a function that doesn't try to do everything. Core dumps are easier to analyze if the stack isn't completely flat, it's easier to set breakpoints, etc.
@shawn576
@shawn576 2 жыл бұрын
@@rndszrvaltas It probably depends on how the code is done. Good code would be lots of small functions that do their own thing, they work, and you can ignore the ones that work. A true nightmare would be lots of small functions that are all interlinked in some bizarre way where X relies on Y, Y relies on X, both of them call Z, Z sometimes calls X or Y, etc. It's lots of possible issues and you're never really sure which one is fucking up, so you end up jumping back and forth just to figure out wtf is going on and how it's supposed to work.
@logangraham2956
@logangraham2956 5 жыл бұрын
i do a different coding style . its called "what ever gets the job done"
@pnaixe
@pnaixe 5 жыл бұрын
right? like there's no silver bullet, there's a lot of these "oop bad functional good" or vice versa bullshit on every forums and it always strikes me as biased. there's soo many different kinds of weird real world problems that one coding style isn't enough.
@muzikdude1188
@muzikdude1188 5 жыл бұрын
Seems like too many developers have lost sight of this. The end user doesn't give two shyts about whether you used functional or OOP programming in your coding. They only care that it works...and as long as it does what difference does it make? Code it the way you are comfortable coding it instead of constantly chasing after what's in vogue right now.
@johnlong9786
@johnlong9786 5 жыл бұрын
Define “the job”. If it’s anything other than “make it work this week and then delete it”, these kinds of discussions are vital to the long term flexibility and maintainability of the code you write.
@dupersuper1000
@dupersuper1000 5 жыл бұрын
Transparent “working code” may be working, but it still falls on various spectrums of maintainability, flexibility to change, complexity, performance, etc. I’m tired of people using “different tools for different jobs” as a hand-wavy excuse to use shitty tools just because they feel familiar. Sure, don’t go chasing fads, but it’s worth considering whether programming really IS that difficult, or whether we just make it that way out of ignorance and inertia.
@josefaschwanden1502
@josefaschwanden1502 5 жыл бұрын
Sounds like an indian to me
@MrCmon113
@MrCmon113 5 жыл бұрын
I spent too much time asking myself whether a specific function should be in the ControllerAdapterFactory class or the FactoryAdapterController class.
@williamdrum9899
@williamdrum9899 3 жыл бұрын
This sounds like a Monty Python joke
@danielgould5530
@danielgould5530 3 жыл бұрын
I spent too much time searching Google with "should I..." questions instead of "how do I..." questions.
@GodsAperture
@GodsAperture 3 жыл бұрын
May God help you! BANISH THE DEMON THAT HAUNTS YOU!!! (Get rid of that evil naming convention you have)
@onatkorucu842
@onatkorucu842 3 жыл бұрын
When in doupt, put it in ControllerFactoryAdapter.
@matthewparker9276
@matthewparker9276 3 жыл бұрын
Sounds like poorly defined clasess to me. Do you really need both of them?
@ControlAltPete
@ControlAltPete Жыл бұрын
At company after company I have dealt with confusing messes of deep inheritance hierarchies, sometimes 10-15 levels deep, where each subclass adds just a couple of lines of code. The prime consideration was keeping the classification pure in a philosophical way, like we were inventorying the animal kingdom. A good portion of the developer efforts were targeted towards dealing with the structure of these classifications and not getting any actual features done. Factories that make factories. Singletons with pages of boilerplate to do one simple thing, no object ever necessary in the first place.
@omicronx94
@omicronx94 Жыл бұрын
Spot on. Anyone who writes lots of JavaScript, Python, Ruby or Go and then dips into the C# or Java world knows exactly what this nonsense feels like. It's developers scratching their own itches of systems level thinking, trying to create the ultimate "system" to solve code complexity. Like a mini-game where they're trying to create an encyclopedia for the world. But by trying to systemamitize away complexity they create even more of it. Now you need your devs to understand dozens of different "design patterns" that supposedly decouple your program and make the codebase easier to work with. Why then are they so complex, require constant abstract thinking and make the codebase even more complicated to work with? Why does every design pattern come with the disclaimer that it doesn't actually fully decouple anything and that it's just a different form of coupling? The coupling comes from needing the cross cutting code. There is nothing we can do about that problem other than make it easier to understand for our developers. Creating all sorts of wacky service locators, inversion of control containers, factories, dependency injectors doesn't decouple anything.
@Vitorruy1
@Vitorruy1 Жыл бұрын
Generic interfaces with only one implementation, factories that just pass the value back to the constructor, subjects and observers that only ever get called once, Massive mutators receiving several different strategies do to the same thing an if/else already does. In general web dev, a lot of "problems" we solve are so simple, and well supported by the base features of the language, that any attempt to show off how smart you are by "using patterns" is guaranteed to generate bloat.
@ddoumeche
@ddoumeche Жыл бұрын
your companies need architects, and start writing some baselines before writing code
@lizizhu1843
@lizizhu1843 Жыл бұрын
Yes. Some senior developers take pride in turning everything into layers and layers of inheritance.
@Christobanistan
@Christobanistan Жыл бұрын
I've known some very narcissistic programmers who write this kind of code for huge organizations like banks. Usually they have zero experience outside their language of choice from 15 years ago and think "standards" and "good practices" are gospel. They usually have zero creativity and think things like "you should use DateTime to store a year value because it's made for it" instead of using a bleeping int. That guy built a framework for every single little thing, and thought Microsoft invented marshalling. He literally could not define the term outside the context of the .Net Framework. And big companies paid him well to write overengineered crap. Of course, he constantly bragged about all this amazing stuff he'd learned 'at the top.' 😂
@anonymousweeble2224
@anonymousweeble2224 7 жыл бұрын
I come back to this video a lot. Here's some timestamps: 4:38 Definition of Terms (Procedural, Imperative, Functional) 8:00 Why does OOP dominate the industry? (Java) 15:50 What is the appeal of OOP? 17:18 The One True Way to do OOP (Bandaids) 18:08 What's wrong with OOP (Encapsulation) 20:05 Shared State (Not too different than a global variable) 21:10 Encapsulation requires direct hierarchy (Problems.) 25:41 Premature erected wall building = cool-aide man solutions (OOoooH YeaaaaH!) 26:14 When starting bad structure is worse than an absence of structure 26:44 The mind games of OOP (Unnatural data types, kingdom of nouns, Manager classes) 28:54 Stupid questions you have to ask yourself (Analysis paralysis) 29:52 Abstractions hide complexity (The princess is in another castle) 31:43 Spreading your code out unhelpfully (Increases the surface area of code) 33:19 Solution! Good procedural code: 34:24 What to do about shared state? 34:46 Parameterize! Try not to use globals. 35:15 Bundle globals you do use into a single datatype 35:48 Prefer pure functions 36:19 Use namespaces / packages / modules 37:15 Long functions are fine! Logic in sequence = code in sequence. Use "section comments" 38:55 Use nested functions. (Functions inside a function, so you know it only gets used multiple times there.) 39:50 Constrain scope of local variables (Anonymous functions, use blocks, Jai programming language) 43:32 Conclusion - liberate yourself. For those who enjoyed this, I also recommend talks from Casey Muratori, Jonathan Blow, and David Acton. Thanks for creating this Brian!
@DunetsNM
@DunetsNM 6 жыл бұрын
Deserves a separate bookmark: 43:50 you don't need to read any of these books Refactoring by Fowler Test Driver Development by Kent Beck etc.
@yowut8075
@yowut8075 6 жыл бұрын
44:36 trump 2020
@macsitou
@macsitou 6 жыл бұрын
Seth Archambault thanks
@Weaseldog2001
@Weaseldog2001 6 жыл бұрын
"Use namespaces / packages / modules" = OO concepts...
@dupersuper1000
@dupersuper1000 6 жыл бұрын
Just now watching this video. Thanks for the nice index!
@among-us-99999
@among-us-99999 5 жыл бұрын
My (C)ommunist Coding style: A classless society
@mastermati773
@mastermati773 5 жыл бұрын
Your coding style is marxism. Communistic paradigm be like... Every variable, every method public. No private APIs. No borders between namespaces. No inheritance - every variable is common! Get rid of bourgeoisie class. Lines of the code, unite!
@a0flj0
@a0flj0 5 жыл бұрын
@@mastermati773 That would explain why communist societies failed ... they should've learned to be object-oriented :-D
@mastermati773
@mastermati773 5 жыл бұрын
​@@a0flj0 I find some things from programming outside IT: My favourite example are ads. Ads are nothing other than some unreliable message from some host to us clients. Normal people see products. I see that some outside API tries to change my internal state in suspicious way, so I need to project my thinking, so I will be able to handle this spam. (Sorry for my eng) PS Minutes before writing my previous comment I had watched Zizek xD
@GeodesicBruh
@GeodesicBruh 5 жыл бұрын
dontlikemath -.- Nice.
@shalokshalom
@shalokshalom 5 жыл бұрын
@@mastermati773 Its maybe more like functional programming :P
@realchrishawkes
@realchrishawkes 5 жыл бұрын
I know from experience, anytime you put an opinion out on something like this it brings out the pitchforks for sure.
@MrHarpette
@MrHarpette 5 жыл бұрын
Well he shouldn't have claimed this to be the most important video, or whatever similar.
@dupersuper1000
@dupersuper1000 4 жыл бұрын
Jerome Potts I mean, this is one of the ONLY videos on KZbin which explicitly calls out OOP as a bad paradigm. If his assertion is more true than false, then I would say this video is indeed one of the most important programming-related videos on KZbin right now. If it’s not, then whatever, maybe it’s not that important, and then the pitchforks wouldn’t be necessary... just a thought.
@fwefhwe4232
@fwefhwe4232 4 жыл бұрын
Most people blindly believe what they have been taught at school. It's hard to fight decades of brainwashing
@ZBBBlL
@ZBBBlL 4 жыл бұрын
@@fwefhwe4232 lol
@alanbourke4069
@alanbourke4069 4 жыл бұрын
@@fwefhwe4232 Most people do what will actually get them employed in the real world.
@Barnardrab
@Barnardrab 2 жыл бұрын
As much as I love object-oriented programming, I have to admit that you strike some good points that I haven't considered. After backing up my original code for a particular project, I deleted the whole thing (because it was a mess) and started over from scratch. I will try to implement these principles in that project in hopes of making my code more manageable.
@tongobong1
@tongobong1 Жыл бұрын
My advice is to write procedural code inside classes and only when it really makes sense use inheritance, interfaces, design patterns and other OO stuff.
@HumanBeingSpawn
@HumanBeingSpawn Жыл бұрын
The fault was not with the tool, rather your design.
@Vitorruy1
@Vitorruy1 Жыл бұрын
@@HumanBeingSpawn Beware, OOP fanboys always gonna try to gaslight you into thinking you are the problem after your code turns into a mess by following their advice.
@MartinSparkes-BadDragon
@MartinSparkes-BadDragon Жыл бұрын
@@tongobong1 I have started doing this without realizing what I was doing. My inheritance seldom goes much deeper than 2 levels and even then usually only for datatypes
@tongobong1
@tongobong1 Жыл бұрын
@@MartinSparkes-BadDragon Objects are great for modeling business logic. When you have a domain expert telling you what he wants software to do it is great to represent his knowledge with objects.
@WoodymC
@WoodymC 2 жыл бұрын
Employee: _We're practicing POOP here._ Applicant: _What's POOP?_ Employee: _Proper OOP._
@drygordspellweaver8761
@drygordspellweaver8761 2 жыл бұрын
employeR?
@WoodymC
@WoodymC 2 жыл бұрын
@@drygordspellweaver8761 Nope, employeE. In each of my 20yr past cases, applicants (including myself) were talking to their potential teammates about some tech details. Guess most employeRs actually don't even have a plan what the heck their devs are doing in detail... 😁
@gianglai7346
@gianglai7346 2 жыл бұрын
Should be top comment 😂
@jacquesmariosayao6237
@jacquesmariosayao6237 2 жыл бұрын
People Order Our Patties, POOP
@steverempel8584
@steverempel8584 Жыл бұрын
No.... POOP actually stands for Python Object Oriented Programming.
@MCOD1999UK
@MCOD1999UK 6 жыл бұрын
Q:What is the object oriented way to become wealthy? A: Inheritance.
@danieldragojevic3016
@danieldragojevic3016 5 жыл бұрын
nice
@coldwatermarketing
@coldwatermarketing 5 жыл бұрын
create state, create controllers, design gui. besides that you need a state that allows function for your site/app the controls to manipulate it towards the users objective and then the GUI for an end user to manipulate the controllers they have access to.
@69erthx1138
@69erthx1138 5 жыл бұрын
Kiss ppl's asses and procedurally control their minds.
@collinsa8909
@collinsa8909 5 жыл бұрын
think functionally about money
@JakobJenkov
@JakobJenkov 5 жыл бұрын
Multiple inheritance ;-)
@IterativeTheoryRocks
@IterativeTheoryRocks 4 жыл бұрын
I am a mother one of those old timers - started programming back in 1980. That was with an HP calculator with 15 lines of code and 8 memory registers. There were also the ‘optical cards’. You scribble your program onto cards by selecting various numbers, send them off to the mainframe, then a few days later back comes a printout. No keyboards. No monitors, and the printout just as likely to say ‘syntax error on card 3’ as it is to provide any meaningful result. Imagine, A code, run, test cycle measured in days! I have been through almost every ‘revolution’ there has been. Several times. These new fangled technologies come and go out of fashion on roughly a 10 year cycle, just with new TLAs. I have also been responsible for pushing a fair few of them myself as well as resigning myself to ‘here we go again’. One thing to keep in mind is the Turing Machine. Turing proved that all computers, and all languages, are equivalent. Pretty much, once they can do basic logic, then all languages have equal expressive power. Anything you can do in one, you can do in another. So arguments about procedural vs OO vs Functional are moot. I can write an OO compiler using a procedural language and vice-versa. Not efficient, perhaps, but doable. So what it comes down to, as mentioned in this video, are the practicalities. In practice, in a real team, with real people with real business problems and challenges. The efficiency of writing and maintaining the code. The efficiency of new hires getting up to speed and the risks of losing people with ‘the knowledge’. Building a system that is easy to adapt and extend that Ames the users/customers happy. This video singles out ‘excessive OO’ or ‘extreme OO’ as a bad thing - in particular encapsulation. Quell surprise. Excessive anything is a bad thing! For the comp sci students out there, just remember all these technologies are tools. To be successful in a programming career you will need to master a fair few of them. No real world problem, worth solving, can be done well with a single tool. As a wise boss said to me once, ‘this is technology. With the right tool it will go 100 times faster’. This was when I was writing my own ORM layer - not realising there was already a library to do that. Similarly, I once had 85 lines of procedural code replaced with a single line of (damn clever) SQL. Being a programmer is a bit like being a doctor. You can’t solve every problem with a scalpel. You can’t solve every problem with antibiotics. Every person is a bit different. You need years of training and a wide variety of diagnostic as well as preventative as well as curative tools, medicines, machines and hands on experience - book learning alone will not cut it. The main factor for deciding what tools to use is the Problem Domain. One thing I have noticed, time and time again, is that the ‘best’ computer code accurately reflects the Domain it is working in. I guess it is called DDD these days. From that perspective, and getting back to the video, your encapsulation level should reflect the natural encapsulations of the domain you are working in. Though this is more of a heuristic than an absolute rule. Let’s call it ‘Domain Oriented Heuristic’ programming or DOH programming for short. 👍
@bennyhansenlifindra1636
@bennyhansenlifindra1636 4 жыл бұрын
Thanks for the information. I'm still an under-graduate. If anything, this gives me insight on my future in computer science.
@shirommakkad5251
@shirommakkad5251 4 жыл бұрын
I liked that last paragraph of yours. Do you know of any resources to study this further?
@IterativeTheoryRocks
@IterativeTheoryRocks 4 жыл бұрын
Shirom Makkad mmm. Well, Domain Driven Design is the thing to search for. Most custom written (let’s say in-house) systems, built to support a specific business, end up with libraries, objects and data models that reflect the nouns and verbs and datasets that the business users use themselves. Encapsulation is also reflected in the various departments and functions of the business. Where this gets really interesting, is dealing with mergers/takeovers and internal re-organisations. Over time, what happens is that the system moves towards an ‘industry standard’ model - particularly as engineers and users are hired and fired between companies but within that industry.
@graham287
@graham287 4 жыл бұрын
Well said old timer. Just left my own comment on this 45 minute rant. I beat you though. Had to carry my cards to the computer building in a wheelbarrow. Those were the days - not. You still programming?
@IterativeTheoryRocks
@IterativeTheoryRocks 4 жыл бұрын
graham287 yeah - spent quite a few years ‘managing’ and ‘enterprise architecture’ but back to programming now. Mainly Python - which I think is now my favourite language. Mainly because it ‘defaults’ the right way, most of the time and automatically deals with edge cases. So less code.
@matthewwillis5129
@matthewwillis5129 Жыл бұрын
This is so good. My first C++ job, 20 years ago, was writing code in corporate codebase where a genius code architect had de-crufted a horrible architecture of earlier encapsulation. Nine layers of OOP encapsulation were collapsed into a single layer in an epic refactoring. That happened shortly before I joined the company and I supported both the "old" product and the "new" product. I had started this job fresh out of procedural coding and the excesses of unsupportable "isa" / "hasa" confusions were freshly there on day one. I still like C++, I guess. But this is such a well thought out, battle scarred view. Thank you for this!
@morbiusfan3176
@morbiusfan3176 Жыл бұрын
C++ is not an OOP
@UncaAlbyGmail
@UncaAlbyGmail Жыл бұрын
The beauty of C++ is that you can practice OOP (classes, encapsulation) etc. where it seems to fit the problem, but not where it doesn't. The problem with Java is *everything* has to be a goddamned object, whether that concept fits the problem or not. Not everything "is-a" object or "has-a" object or "is-a-kind-of" object. Some things just "is".
@morbiusfan3176
@morbiusfan3176 Жыл бұрын
@@UncaAlbyGmail Except java was, is, and forever will be a million times better than C++. At least in java you can actually code a functional, logical code, whereas in C++ the best you can do is some fibonacci
@UncaAlbyGmail
@UncaAlbyGmail Жыл бұрын
@@morbiusfan3176 Somehow I get the feeling you're trying to tell a joke, but it went over my head. Sorry.
@matthewwillis5129
@matthewwillis5129 Жыл бұрын
@@UncaAlbyGmail I still like C++, and having OOP in places saves time. I am not sure I'd like to inherit somebody's codebase who goes through all the mistakes of OOP. I also never warmed to Java.
@TheMrPandaGamer1
@TheMrPandaGamer1 3 жыл бұрын
Me who has done just a simple calculator in python: "He does have a point"
@ItsMeChillTyme
@ItsMeChillTyme 3 жыл бұрын
A calculator is a very decent program to compare differences between languages, you observed right. You don't need complexity to know the rightness, only how logically sound and consistent it is. A calculator program fills these requirements very well.
@SapioiT
@SapioiT 2 жыл бұрын
@@equinox2584 But you have to limit the input to a certain set of characters, otherwise you can end up with a code-injection vulnerability in your program.
@badunius_code
@badunius_code 2 жыл бұрын
@@SapioiT it's not the thing you'd worry about writing your first program
@SapioiT
@SapioiT 2 жыл бұрын
@@badunius_code Not the first, true, but among the first hundred or thousand, maybe sooner if you hit that problem early on.
@nickscurvy8635
@nickscurvy8635 2 жыл бұрын
@@badunius_code my first calculator was a graphical calculator made with tkinter, mostly to avoid messing around with eval and hardening against code injection lol
@reallyanotheruser7290
@reallyanotheruser7290 2 жыл бұрын
I return to this video periodically, every year or so, to read comments from people coming back to this video periodically, every year or so
@Omaryllo
@Omaryllo 3 жыл бұрын
In reality though the "combination of objects and functional programming" is already the real world way people use OOP and i might argue the standard. The problems with OOP are really just strawman uses of OOP. In the real world, encapsulation and abstraction are only used if it is beneficial, like reducing complexity and improving readability. In school, it's probably the case that everything is over-engineered, but that has educational benefits too. You get to experience the friction that comes with objectifying everything
@nerfmasterdou
@nerfmasterdou 3 жыл бұрын
One hundred percent agree. For example, he introduces a theoretical OOP practice(not sending object references), completely admits that almost nobody follows this practice, and then spends minutes following that explaining why this practice that nobody follows is bad. Well yeah, no shit, thats why nobody does it.
@MjolnirFeaw
@MjolnirFeaw 3 жыл бұрын
Agreed. Even when in java, a lot of big projects end up having one or several "Tool" static classes which are used as a repository of procedural functions, used with parameters and all that. Because it makes sense, even if it is not ideologically perfect.
@ConcerninglyWiseAlligator
@ConcerninglyWiseAlligator 3 жыл бұрын
If I'm not mistaken, he acknowledged that people don't really program that way, didn't he? Anyways, I don't really care about that point. The thing you said that bothered me was the "school fail upwards by teaching you to do things that way", kind of part. I agree, but I just don't like that reality. Could schools be explicit about this and tell you that full OOP doesn't work? Shouldn't students learn something useful instead of that? If anything, I think we should push back against the literature that pretends that full OOP works.
@omniphage9391
@omniphage9391 3 жыл бұрын
in every project i was involved in, there has at some point been a situation where we went "damn, if only we hadnt cut corners back then"
@omniphage9391
@omniphage9391 3 жыл бұрын
@@MjolnirFeaw yes, those repositories suck ass, because they are usually strewn all over the code base, and the next guy is just gonna write his own "Helper" function rather than see if something already does the job. They result from not actually working on the architecture.
@username7763
@username7763 2 жыл бұрын
I've made enough OOP mistakes that much of this resonated with me and wasn't really surprising. But the bigger take-away is much of these same problems apply to microservices. Each microservice couples it's own data storage with the service and they don't share databases. This causes all sorts of problems managing the indirectly-shared state. It is a similar problem, by trying to force a small encapsulation, problems get spread around but not made any easier.
@jonty3551
@jonty3551 2 жыл бұрын
That is a very insightful analogy.
@peaku8129
@peaku8129 2 жыл бұрын
microservices don't solve any problem, they just move the complexity of the monolith to the infrastructure, it makes no sense
@Ian-eb2io
@Ian-eb2io 2 жыл бұрын
Why would you put data storage into every microservice?
@username7763
@username7763 2 жыл бұрын
@@Ian-eb2io That is a fundamental concept in microservices. Each service has it's own data store containing all the data it needs to use. The point is to reduce how chatty your system is, rather than call another service for the information, read it from your own data store. This prevents other issues such as deadlocks or infinite recursion. It breaks DRY, but is an intentional duplication.
@cr7ckd0wn
@cr7ckd0wn Жыл бұрын
@@username7763 Are you telling me each services having it's own data store is so that it CAN have access to the data? Otherwise it has to call other services to get the data for it?
@heisenberg2144
@heisenberg2144 2 жыл бұрын
This is how I saw scientists program intuitively. I was an experimental physicist before changing to the industry and most programs, I have seen back then, written by physicist followed the functional programming idea. Maybe, because all of us were comming from a mathematical background. Some programs were a mess though and comments were in Portugese, German and English on different layers of code. ... Good memories. And good video.
@elliotts5574
@elliotts5574 Жыл бұрын
@@Bayo106 not even close. engineers.
@link_team3855
@link_team3855 Жыл бұрын
i knoww XD Procedural coding has its name literally because its how most would learn to code if self guided. i think. usually accurate but not probably not correct.
@ianrust3785
@ianrust3785 Жыл бұрын
Scientists don't know how to program, this is well known to software engineers...
@00SEVEN28
@00SEVEN28 Жыл бұрын
Well, the quirky thing is that we're doing OOP when deep "in the beast of the machine" it's literally running the code in a sequence vis a vis procedural.
@ihateidiots9484
@ihateidiots9484 Жыл бұрын
You must understand that every programming paradigm solves those problems, that other paradigms can't solve. And different tasks require different paradigms
@Holo___X
@Holo___X 3 жыл бұрын
As someone relatively new to programming, I appreciate how thoroughly you managed to explain your argument in this video despite all the jargon that was involved. It also taught me more about how and when to use both procedural and OOP, so thank you for that.
@necronomicon1472
@necronomicon1472 4 жыл бұрын
11:43 "It seems like real programming, it has curly braces after all." I see, a fellow man of culture.
@TheBelrick
@TheBelrick 4 жыл бұрын
I recently ported a PHP web api client into my project without thinking . It has 1300 lines of code, 8 classes 4 files. Pure unadulterated OOP straight out of College... The amount of lines performing the actual function of the application? 8 lines. Which was what was left after i pilfered it for my own use (i had a duh day not knowing php uses CURL library for webapi.)
@azchen6511
@azchen6511 4 жыл бұрын
*python has left the chat*
@williamdrum9899
@williamdrum9899 3 жыл бұрын
haha goto go brrr
@Dominexis
@Dominexis 3 жыл бұрын
@@williamdrum9899 Underated comment.
@JorgetePanete
@JorgetePanete 3 жыл бұрын
@@TheBelrick Who did that and why? 😨
@tharun7290
@tharun7290 Жыл бұрын
My goodness, as a student learning OOP I found the criticism here so relatable. I spent DAYS thinking about how my project could be conceptualized into classes and which methods belong to which type. I decided it was my own lack of OO design experience but I'm so glad to learn I'm not alone and it's never possible to make perfect object-behavior encapsulation in the real world. The "matchmaking game" is absolutely real.
@eax2010EA
@eax2010EA Жыл бұрын
Fellow student here, I see inheritance useful if the main code changes a lot and the clases that inherit do not change. Otherwise, composition is useful. I find it rarely in my programming that I used OOP succesfully, but the idea that I want emphasize is that if this style of codijg is hard to implement, maintain and change for any programmer at any level, it's probably not good. And I haven't even talked about scalability...
@Sarah-re7cg
@Sarah-re7cg Жыл бұрын
Also a student! I know, I’m so happy I came across this video.
@bobbycrosby9765
@bobbycrosby9765 Жыл бұрын
Then when you graduate you'll be writing webapps that make almost zero use of OOP despite you likely writing them in a class-based language.
@maukschilol
@maukschilol Жыл бұрын
@@bobbycrosby9765 so typical nodejs smelly shit? (Even though js does not really have classes ... or does it now with a new standard? not sure)
@websherp
@websherp Жыл бұрын
I've been in the industry for 20+ years and thought I would share my experience. These are just tools. Imagine 2 handymen arguing that the hammer is THE tool and another claiming a screwdriver is THE tool. They go back and forth pointing out the inadequacies of the other while showing the advantages, elegance, power and more than anything personal aesthetic preference for their preferred tool. Meanwhile the thousand other handymen in town use both tools alongside each other as well as a dozen other tools in their toolbox. Out of the 2 arguing handymen one is certainly more right than the other, though no one is likely to know which. All the other handymen in town know how and when to use specialized tools and they are getting paid the same if not more than the 2 arguing. Learn what you can, try it out, use it when it applies, get paid. School is just one of the tools along the way. There are many problems with the educational system, but that's too much to cover here. What the education systems effectively do is certify you can solve problems and you can see things through. You will learn more about effective design in your first year working than you did in the 4 years to get your undergrad. The learning never stops. Your intuition will continue to develop through your entire career. Listen and extract from these hot takes but please don't take them as gospel. Mostly don't take anything as gospel, just figure out how things are useful. Enjoy your journey.
@ericpmoss
@ericpmoss 3 жыл бұрын
It drives me nuts that people act like Common Lisp never existed, exclaiming "Oh, why can't I have " when it was available for the past 30+ years. Or worse -- crapping on all that Lisp provided and then embracing it as soon as someone adds curly braces instead of parentheses.
@smoothbeak
@smoothbeak 4 жыл бұрын
I return to this video periodically, every year or so, as I improve my knowledge of programming concepts, each time I understand it a little bit better :)
@amadeusk525
@amadeusk525 3 жыл бұрын
Me too!
@mfilipe7778
@mfilipe7778 3 жыл бұрын
same
@smoothbeak
@smoothbeak 3 жыл бұрын
@@mfilipe7778 Good to know there are others out there who do likewise :)
@amadeusk525
@amadeusk525 3 жыл бұрын
@@smoothbeak Hahahah this is too much of a coincidence. I returned to the video today again and here I find a comment from you from 1 day ago.
@smoothbeak
@smoothbeak 3 жыл бұрын
@@amadeusk525 I agree!
@richardblain4783
@richardblain4783 4 жыл бұрын
The anonymous functions denoted by the “use” keyword exist in C++ lambdas, right down to the explicit list of named function variables that can be shared with the anonymous function.
@1u8taheb6
@1u8taheb6 3 жыл бұрын
Is that what a lambda function is? I have been trying to understand lambdas for so long that it's embarrassing. The "use" idea described at 41:40 makes perfect sense to me. Is this all a lambda is?
@CapteinObvious
@CapteinObvious 3 жыл бұрын
@@1u8taheb6 Yes that is exactly what a C++ lambda is, it allows you to capture any or all variables from the enclosing scope either as references or values, and also allows you to pass in regular variables like you would to any function, you can combine these options in any way you like, they are very handy.
@1u8taheb6
@1u8taheb6 3 жыл бұрын
@@CapteinObvious Thank you so much!
@koacado
@koacado 3 жыл бұрын
yes, python lambdas are the same concept
@MisterBrausepulver
@MisterBrausepulver 3 жыл бұрын
@@koacado Python Lambdas allow only one expression. Python lambdas are also closured which means they capture the variables of the surrounding scope. The proposed "use"-block should be like an immediately invoked function that is NOT a closure.
@waynethompson6667
@waynethompson6667 2 жыл бұрын
My first programming language was Fortran IV in 1979. For over 30 years I got paid to write COBOL code. During the time I’ve seen languages and theories come and go. I learned PL/SQL in 1997. As a procedural programmer, switching to OOP drove me nuts for many of the reasons you mentioned. All those factories and patterns made it nearly impossible to find the business logic. I retired and came back to do pl/sql again.
@elkeospert9188
@elkeospert9188 2 жыл бұрын
COBOL and Fortran are optimized for a specific area of problems - and inside their area they are fine because they are very limited - it is difficult to write code in COBOL or Fortran which is hard to understand. But imagine you have to implement a graphical user interface having a dynamic number windows containing complex dynamic layouts of widgets of different type (Checkboxes, Radiobuttons, Textedits) using COBOL or Fortran - it would be a nightmare...
@TrueFork
@TrueFork Жыл бұрын
reminds me of a time I was on a Java project, one part was an incomprehensible kludge and the developer responsible answered every question with "oh this is the (whizbang) design pattern, refer to (book) if you want to understand it." When I finally dove into the code, I found the synchronisation was completely broken, and that he didn't have a clue about multithreading but always managed to blame the resulting crashes on other things.
@stelarfox
@stelarfox 4 ай бұрын
That is the main problem the OOP programmers just use 80% time to refactor and only 20% (or less) of the time to make the program how can they not take 5 times more?
@bulghurbulghur3698
@bulghurbulghur3698 7 жыл бұрын
Whether I agree or not is unimportant. This was very thought provoking indeed. Many thanks!
@LoTekkie
@LoTekkie 8 жыл бұрын
I appreciate your insight, this has allowed me to view my code from another perspective. Thank you for taking your time to express and share these ideas.
@mscottbarnes
@mscottbarnes 8 жыл бұрын
Blasphemy. How refreshing.
@10e999
@10e999 3 жыл бұрын
That's the attitude I like to see !
@itermercator114
@itermercator114 Жыл бұрын
Just found this video, found it really informative and I'm glad someone pointed out that OOP isn't some magical methodology you learn and becomes default. From what I found with OOP is that most cases it's either a) Trying to be an overengineered struct, or b) Trying to be an overengineered function (or group of functions). It seems most people use them because it's normally the most advanced thing they learnt and they assume "it's what the real programmers do" (Like a kid mimicking adults). Unless you specifically need inheritance or instancing (e.g., gamedev), FP makes way more sense than OOP
@KoziLord
@KoziLord Жыл бұрын
There's been a shift in gamedev away from OOP because objects are slow and hard to multithread in practice and class hierarchies are simply too restrictive to express complex game logic nicely. These days many big titles are built using entity component systems which in many ways mimic relational databases, with every entity being an ID with components like position and health associated with it.
@Kheldae
@Kheldae Жыл бұрын
There is a other way of seeing it, and it's fairly simple : OOP is good to learn to learn how to suffer in it and know not to touch it later on, while still learning about UML stuff (which can be transposed in FP)...
@TachibanaKyosuke
@TachibanaKyosuke 2 жыл бұрын
“Procedural code is better” Me, a COBOL programmer: Is it finally my time?
@justins8802
@justins8802 2 жыл бұрын
Always has been ;-)
@TricoliciSerghei
@TricoliciSerghei 2 жыл бұрын
Hahhaa :) I've done COBOL in the past, don't really want to go back to it sincerely )
@moestietabarnak
@moestietabarnak 2 жыл бұрын
procedural is not an essay ! COBOL is so damn verbose, is it still ADD X TO VARIABLE or MOVE BlahBlah TO thisOtherVariable ? Everyone else found that Variable += X or variable =variable + x is as informative without screaming in prose.
@Guddler
@Guddler 2 жыл бұрын
@@TricoliciSerghei I cut my teeth on SNOBOL. It's not really SNOBOL I wouldn't want to go back to (although frankly I can't remember much that far back) it's the primitive Dec MicroVax hardware I'd rather not go back to. "Hey guys, is the tape deck free?" or "is anyone running anything at the moment?" Glad we're not heading back there!
@EchoMeToo
@EchoMeToo 2 жыл бұрын
Yes, you would be very successful working on OOP projects. You could join all the teammates not understanding and hating OOP. ;-)
@MorganBlem
@MorganBlem 3 жыл бұрын
Minimizing state is something I think a lot of people gradually learn over time. Function side effects make your code difficult to use if your project grows enough, function side effects can just cause an overwhelming amount of bugs.
@technoturnovers7072
@technoturnovers7072 2 жыл бұрын
I really disagree with people saying OOP is bad, but that's mostly because if it weren't for OOP, modding minecraft would be fuckin *impossible*, like holy hell it would suck.
@daedalus6433
@daedalus6433 2 жыл бұрын
@@technoturnovers7072 Coding efficient game engines and game logic would also be a pain with only functional or procedural programming.
@hongkyang7107
@hongkyang7107 2 жыл бұрын
@@daedalus6433 not really, doom classic and quake 1 are those that were written in C very optimize and modable.
@walter3934
@walter3934 2 жыл бұрын
@@hongkyang7107 Moddable because it's small. For bigger size ones like Minecraft it's practically impossible to do with just procedurals and even if you could, you'll need a degree on Minecraft to mod it.
@daedalus6433
@daedalus6433 2 жыл бұрын
@@hongkyang7107 Doom was written in Objective-C. Quake was written in QuakeC.
@splashmaker2
@splashmaker2 3 жыл бұрын
I disagree, because cognitive complexity is a real thing. Our human brains can only hold so much in memory at once, so it is our goal to design a software architecture that optimizes for that. I can say definitively from my own experience that giant procedural code I wrote in my early years is far more difficult to read and comprehend. Once you study it for a while it becomes understandable, but only after a while. Code where I broke up into smaller pieces is much faster to read and comprehend, and I make fewer mistakes with code written like this.
@solstice5767
@solstice5767 3 жыл бұрын
Agree. I think more importantly, breaking code up into smaller pieces, sets things up for unit testing later on. Rather, what I got from this video is to try really hard to avoid needlessly increasing surface area thereby displacing complexity. But in procedural programming's defense, procedural programming often helps me build momentum until i need to break the code up to make it easier to unit test.
@omniphage9391
@omniphage9391 3 жыл бұрын
@@solstice5767 all the cool kids do tcr these days
@mikeyearwood
@mikeyearwood 3 жыл бұрын
Encapsulation does not fly out the window. While object B method is processing message from object A, object C cannot affect the innards of object B.
@splashmaker2
@splashmaker2 3 жыл бұрын
Also do not forget that, going into more of a domain driven design paradigm, eventing allows for decoupling when things get too far apart from a domain standpoint. Think about how much UI systems rely on eventing, but often still use OO concepts as well.
@Elrog3
@Elrog3 2 жыл бұрын
Yes, cognitive complexity is a real thing. But OOP does not help with it. All it does is throw the performance aspect out the window so that the problem you are trying to solve is a simpler one. Dumbing things down means you aren't solving the same problem anymore. For a given problem, if you aren't disregarding the codes performance, the problem is necessarily as complex as the problem is. You can't just willy-nilly group things up without affecting how the code runs. When you are trying to solve the more complicated version of the problem (which is not done for nothing, it is useful), thinking in OOP terms will not do anything useful.
@Avpixlamer
@Avpixlamer Жыл бұрын
It really depends on the problem. I programmed the first ever constructed OOP-language in 1970 which was SIMULA and has since then used various OOP-languages including Object Pascal, Java, Javascript, C++ and Ruby. Some problems are really difficult to tackle without objects and for some others objects just distract from the task what you actually want to achieve. Nowadays I mostly use procedural programming but occasionally add in objects for special tasks. It just boils down to common sense when to use it. I agree to that OOP is overused and often just adds confusion when one wants to understand what the code of others actually do.
@neptronix
@neptronix Жыл бұрын
This is exactly how i do OOP. Objects when it matters / procedural for everything else. it's the most sane path!
@peterburtsev3951
@peterburtsev3951 4 ай бұрын
This is exactly how I do OOP... in Haskell.
@tullochgorum6323
@tullochgorum6323 4 ай бұрын
Agreed. In some domains there are natural relations between data and methods that are never going to change, so objects work well here. In others there are cross-cutting concerns, so standalone data structures and functions work better. It's not really so difficult if you take a pragmatic, undogmatic approach. All my apps end up with modules that contain objects, standalone data structures, and libraries of functions. Works for me. Seems to me that it's not objects that are the issue - they have their legitimate uses. It's dogmatic OO thinking that attempts to force every domain into the OO paradigm.
@TheOriginalNCDV
@TheOriginalNCDV 5 жыл бұрын
While I agree with most of your arguments, what you've mostly described is just bad programming practice. Procedural programming has its own pitfalls, and an inexperienced coder will turn it into crap just the same.
@gavinschuette9826
@gavinschuette9826 5 жыл бұрын
you missed the point that oo is not needed
@TheOriginalNCDV
@TheOriginalNCDV 5 жыл бұрын
Gavin Schuette neither is procedural programming. They're just two different ways of abstracting the logic so you don't have to code on the bare metal. Use whichever floats your boat.
@leahparsuidualc666
@leahparsuidualc666 5 жыл бұрын
@@gavinschuette9826 .. "to turn it into crap all the same" ? - I agree.
@djpeterson7479
@djpeterson7479 5 жыл бұрын
That is a sound premise. I've always felt that C++ is one of the better languages out there because it's a Swiss Army Knife of tools. You can write pure OOP or pure Procedural or mix and match. We even have his "use a, b {...}" example in C++ with lambdas. I think it comes down to picking the right tool for the job. Don't make everything a class, and don't make everything a 64 parameter function. Use what fits the situation best, and remember bad programmers will always choose the wrong tool.
@ehsanag5837
@ehsanag5837 5 жыл бұрын
@@djpeterson7479 why couldn't they define classes for c++ too and other functionality of other languages so we could have one single language and either use it as oop or make our own universe. Why is that so hard if c++ is as flexible as you describe? Im just asking i dont know nothing about these but whoever gonna respond to this comment just dont be a dumb
@RasmusSchultz
@RasmusSchultz 3 жыл бұрын
This year, I took the plunge and decided to write an entire project using just functions and interfaces, in TypeScript. I had to stop and regroup a few times along the way, but the exciting thing is, the stuff I've had to learn along the way really seems more generally applicable - whereas a lot of the OO patterns and principles often seems like (as he says) a workaround or a bandaid. What you learn by committing yourself to this is much more general - simple techniques that work every time, not just for one specific problem or scenario. I have 23 years of developer experience and pushing myself to go all in on this feels like leveling up - for the first time in a long while. I was on the fence about this video in 2016. I knew there was something true to it, but I had no idea where to start. It does have something to do with the language you're using - I was using mainly PHP, where functions and interfaces aren't really practical or useful the way they are in TypeScript. I don't agree with absolutely everything in this video. Part of me wonders if the author hasn't changed his mind about some of the finer points in this video over the years - we all grow and learn, right? I kind of wish he would post an updated version of this presentation. Anyhow, I gave it my like today, 5 years later. 😄
@aaronmacdougall
@aaronmacdougall 2 жыл бұрын
I also don't agree with everything stated, particularly about functional programming. Computers just don't work that way so will never be efficient enough. I was a true believer of OOP as a C++ game programmer for many years. One day a friend suggested I try writing a game engine in C instead of C++. I was skeptical as I loved my fancy C++ systems and templates etc, but in the end I found my code to be much simpler, smaller and more elegant. Unfortunately I still have to work on OOP game engines and nobody will believe me that procedural is better.
@reed6514
@reed6514 2 жыл бұрын
I've started coding in a more procedural style i think, but i like to slap most stuff into a class anyway ... just with more emphasis on making many methods pure functions that don't touch the object's properties. And i reduce the object dependencies. I find when my code is hard to test, it's hard to think about, and it's hard to maintain. I also make most stuff public because idk when i might need to mess with things. Idk. I used to put a lot of weight into designing things perfectly for extensibility or whatever & talks like this (and moreso molly rocket) have lead me more toward just ... get it done, clean it up a little bit, and don't worry so much about design. I feel like I'm explaining myself poorly though
@aaronmacdougall
@aaronmacdougall 2 жыл бұрын
@@reed6514 I don't really understand the point of pure functions in a class.
@reed6514
@reed6514 2 жыл бұрын
@@aaronmacdougall if it's generally only used by other methods in that class
@efronlicht1043
@efronlicht1043 2 жыл бұрын
@@aaronmacdougall in my experience, people know that namespaces are good, but they are used to classes being the way you do that.
@ravenking5558
@ravenking5558 3 жыл бұрын
Your description of modelling real world things with OOP makes me think about a large corporation and all the pointless layers of middle management. Its like we found a way to replicate *that* relationship in our code.
@chrisginn4267
@chrisginn4267 3 жыл бұрын
Another manifestation of Conway’s law?
@yousefabdelmonem3788
@yousefabdelmonem3788 3 жыл бұрын
Middle management is a necessary “evil”
@archmad
@archmad 3 жыл бұрын
it's like taxation. we all hate it, but it's necessary
@ekki1993
@ekki1993 3 жыл бұрын
@@yousefabdelmonem3788 Well yeah. Furthermore, those necessary evils are a fundamental problems arising from scale. As the problems become bigger and harder to solve by one person, you need to make bigger and bigger compromises. It's also useful to remember when criticising governments as "less optimal" than corporations. They only have more clutter because they have harder problems to solve. Same goes for big code.
@honkhonk8009
@honkhonk8009 2 жыл бұрын
@@ekki1993 No. Thats not a fair comparison with the governments. Some governments dont even use version control for their engineers when they make their software. People dont say governments are less optimal because of their messy solutions, people say governments are less optimal because bad managers are even harder to fire, and bad employees are the only ones that flex their worker rights. Its just inherently bad.
@fetherfulbiped
@fetherfulbiped 2 жыл бұрын
The biggest problem I have with this video is that it completely forgoes one crucial aspect of development - testing. Not having modular components and having "God functions" that do everything in one place makes your software really hard to test, you can't really test individual bits of logic and it will become a nightmare to debug your functions if you need to make even tiny changes. Besides that this obviously introduces a very high barrier of entry for understanding your code, there is so much that a human brain can process and keep track of while reading and grasping the full picture will take much longer than if the same logic was split into separate components, and in many cases the ability for your colleagues to quickly understand what the code does without delving too deep into implementation details is really important, they in general would have other shit to do and spending an hour to understand what a function does is not a good use of their time
@dukiwave
@dukiwave Жыл бұрын
Working on large, highly complex projects, I've found the opposite to be true. Human brains struggle with interlocking complexity, not cardinality. We use the functional core imperative shell apporach -- even a non-technical person can open the "shell" procedure, read it top to bottom and understand what it does, hell they might even be able to make minor edits. Uncle Bob-style OOP does the opposite -- it fragments business logic into as many small, individually meaningless units as possible, making it much harder to build out a mental model in your head. Our code practically has a UML sequence diagram built-in, and our engineers love it.
@sbeve7445
@sbeve7445 Жыл бұрын
@@dukiwave Its funny because I've also worked on large and complex projects, and modular code with broken down function points is absolutely crucial if you ever want to extend or maintain your code. Having smaller function blocks allows fast isolation to problematic code. Not being able to form a mental model is more of a skill issue and can be overcome with time, code comments and documentations.
@XeenimChoorch-nx8wx
@XeenimChoorch-nx8wx 5 ай бұрын
@fetherfulbiped No. Nononononono no. You have it COMPLETELY backwards. It is infinitely easier to debug procedural code and reason about it when it is right there inlined for you. And figuring out a codebase is made HARDER by fragmentation it into 10,000 little pieces scattered everywhere. Your coworker can just as easily use a FUNCTION over some class with a built in method.
@samgoodwin89
@samgoodwin89 2 ай бұрын
Procedural programming doesn’t mean write everything in a single function. You can still build single responsibility functions and test them.
@matthewcragg3607
@matthewcragg3607 3 жыл бұрын
"Kernels of good ideas have been taken to holistic extremes." That's a very succinct way of pointing out a bad tendency people exhibit in many areas not just coding. I'm adding that to my "great quotes" list and attributing it to Brian Will.
@SpiritmanProductions
@SpiritmanProductions 3 жыл бұрын
Yeah, I liked that line a lot, too. (When you do the quote, though, bear in mind that the word is 'holistic'.) 😉
@matthewcragg3607
@matthewcragg3607 3 жыл бұрын
@@SpiritmanProductions Corrected. My mistake.
@atiedebee1020
@atiedebee1020 3 жыл бұрын
45 minutes of someone with a nice voice telling me OOP is bad, I'm in
@ChristopherGray00
@ChristopherGray00 2 жыл бұрын
sounds like you just want to hear someone say something that you agree with to make you feel good, rather than actually think critically.
@atiedebee1020
@atiedebee1020 2 жыл бұрын
@@ChristopherGray00 I actually just like listening to people talk about how something sucks which I know nothing about. rn I do know what OOP is about and its usecases and use it myself when needed
@youuuuuuuuuuutube
@youuuuuuuuuuutube 3 жыл бұрын
41:55 C++ has a solution for this: lambda functions, so instead of doing "use x, y { ... }", you do "[x, y] { ... }". It won't have access to any other variable than x and y. Edit: and it does exactly what you want, it makes clones of those variables, and if you really want to change them, you can pass them as reference for ex, with &x. It's really like having a function but without having to name one, and it can be placed anywhere.
@moestietabarnak
@moestietabarnak 2 жыл бұрын
lambda a simply nonamed function.. i.e: not reusable. why not simply make it a named function, and you can re-use it!
@MrAbrazildo
@MrAbrazildo 2 жыл бұрын
@@moestietabarnak C++ lambda is just an anonymous f() inside a normal f(). It can be reused inside it.
@jukit3906
@jukit3906 2 жыл бұрын
@@moestietabarnak C++ lambdas have a feature called CAPTURE. Basically they can capture variables in the scope as static values.
@moestietabarnak
@moestietabarnak 2 жыл бұрын
@@jukit3906 SO, it emulate a function with args passed by Value.. great note : capture can also do references. Still the same functionality as a named function, but the named function can be shared more , re-used more and syntax is cryptic ..
@jukit3906
@jukit3906 2 жыл бұрын
@@moestietabarnak nope, it is more useful: it is dynamic (that is, a function can hold lambdas with different captures and function bodies) Only virtual member functions are comparables.
@mrbcstewart
@mrbcstewart 2 жыл бұрын
As a Software Developer with over 20 years in, having developed in many different languages using multiple methodologies and patterns, this was an interesting presentation, Thank You Brian! The pitfalls you point out and complexities are absolutely real. While I don't think that falling back to the 90's is the answer, as you seem to insinuate, your argument points to something very important, which is too keep architectural and design concerns at the forefront as you write and modify code. "Bolting on" without understanding the design of a program is a fast way to create spaghetti, not matter functional or OO. I find that good program layering and being familiar with Design Patterns is crucial, and helps avoid some if not all of the pitfalls. If I am a doctor doing surgery, I better know how the organs (objects) are laid out and connected (patterns). Just knowing how everything functions is not sufficient in a complex system. As far as Agile goes, that is not a coding "thing", it is a shift in the way we think about building and maintaining things, but should also involve many non-coders in order to correctly set expectations about what gets done when. I will be watching some more of your content. There are some great titles, and you obviously have a lot of real world experience to draw from.
@KXBeats
@KXBeats 2 жыл бұрын
did you just thank yourself?
@visitante-pc5zc
@visitante-pc5zc 2 жыл бұрын
You're right to bet in design and architecture, but it doesn't change the fact that once in implementation you'll face the dilemma for full/partial encapsulation as he mentions around 25:00 - full encapsulation results in lots of additional classes created to help you deal with state (design patterns). Those classes are not related to the problem being solved. They increase complexity because it doesn't make the code any easier to read and leads to poor performance - partial encapsulation results in spaghetti code.
@mrbcstewart
@mrbcstewart 2 жыл бұрын
@@KXBeats accidental click :-)
@mrbcstewart
@mrbcstewart 2 жыл бұрын
@@visitante-pc5zc you are certainly right. I deal with this in two ways. 1. I'm aware of most standard pattern classes and their functions. They are just part of the world I live in 2. A LOT of those classes are relegated to the framework and work magically.
@ianrust3785
@ianrust3785 2 жыл бұрын
1) OO was proposed as a solution to problems inherent in functional, top-down design. It was first implemented in languages like Simula (1960s) / Smalltalk (1972), Python (1991). Java wasn’t created until 1996, OO was well established by then. 
OO was adopted after struggling with many problems in industry, having a long theoretical debate, then doing some experimentation. 2) Brian fails to mention the problems with functional / procedural design. Top level interfaces become very fragile without encapsulation, Iterative development often leads to repeated refactoring of the higher level interfaces. Reuse within programs is common, having every consumer maintain its state for an interface adds complexity and will become unwieldy at scale.
 It's also simply unnecessary. And no, making the shared state global is not a good solution. 3) Test driven development is not consistent with OO. Test driven development was pretty much a fad imposed by managers. It is just design by interface applied to testing with some other rituals built in, it has more in common with functional design than OO. It suffers from the same shortcomings. 4) Brians biggest mistake is he pitches functional and OO as opposite one another. OO is not about data modeling, or data driven design, or modeling real life objects. The early theoreticians overemphasized the data modeling aspect of OO because they were contrasting it with the prevailing design style at the time, functional design. Had data modeling been popular instead, OO would have been described in terms of designing for behaviors. OO is simply the bundling together of functions and data, with some support for minimizing duplication and access. That ideal balance of functional and data-oriented styles you keep alluding to - that is a good use of OO. OO is also totally compatible with FRP, infact FRP is used alongside objects in most code implementations of FRP. It actually compliments OO very well as it solves most of the state management problems. And FRP is an entirely separate paradigm from functional / procedural programming that dominated in the 60s - 70s. 5) Your object graph is just an undirected mess. You claim the only alternative is a hierarchical structure, this is simply not correct. You can maintain a cyclical object graph and trigger update cycles... you can have mid-level objects that manage lifecycles, and then have an object-graph of them at scale, or a hierarchical structure of them. You can come up with bad designs for anything, this is not a criticism of the paradigm. 6) refactoring code into smaller components is a functional technique, I'm not sure where you got the association with OO. Many functional programmers advocate super-small functions that confuse people ... I've never seen OO designers advocate using tons of super small classes. That's just bad design, the fault of that is on the programmer, not the paradigm. The programmer has to choose the right granularity. 7) Inheritance is used all over the place, there's just a good and bad way to use it. There is not some uniform consensus it should be avoided. When you use inheritance you just have to make sure that the base class won't be torn in different directions. Usually this means using it on smaller components without complex responsibilities. 8) OO is meant for large projects where architectural issues matter. Java was designed specifically for this purpose. If your application is 3000 lines, you might not need OO. You might be able to get away with using global variables at that scale (though if your application grows much larger you're pushing it). In an enterprise scale codebase where you have 10 million lines, no architect would ever design for reliance on global state, this would only result in complete chaos. You exaggerate the flaws of OO without providing a real alternative, and don't address the scalability problems in procedural programs at all, hardly.
@valizeth4073
@valizeth4073 5 жыл бұрын
41:49 auto foo = [x, y]() { // Code here }; lambda in C++
@aatkarelse8218
@aatkarelse8218 5 жыл бұрын
Most programmers are perfectly capable to make a mess of any project without oop, good programmers can make a gem with any style of programming. Must admit that oop can rely boost the clusterfuckery of a project.
@carlosgarza31
@carlosgarza31 5 жыл бұрын
I like the name spacing iOOP provides but I don't think you should be hiding internals of an object unless you actually need to. Other developers just hide things by default and cringe when they are forced to add accessors to their private variables. :/ I go the other way around untill I see abuse I'll keep accessors to private variables and remove them if they start being abused.
@rehmanarshad1848
@rehmanarshad1848 5 жыл бұрын
😂🤣🤣😂
@kewlbfy
@kewlbfy 5 жыл бұрын
@@carlosgarza31 when you expose variables or methods they become part of your public API. removing them in big projects later when you discover that people abuse them (probably because you have exposed something you never intended to be used by someone else than you), then you have to mark those variables and methods as deprecated, release a new version and give time (depending on the size of the project or the user base that process might take years), and then finally you can mark them private to hide them again. information hiding is one of the key principles of oop and a powerful tool in the hands of the right programmer.
@themilkspots2652
@themilkspots2652 5 жыл бұрын
Good procedure code is much easier to understand than 'good' OOP code, whatever that means
@themilkspots2652
@themilkspots2652 5 жыл бұрын
@Minori Housaki Not necessarily. It's the difference between `queue_push(q, elem)` and `q.push(elem)`, or even `queue.push(q.elem)` if you put your queue handling functions in a module.
@djbanizza
@djbanizza 8 жыл бұрын
I think this is part of larger problem of adhering too strictly to a specific doctrine.
@agumonkey
@agumonkey 8 жыл бұрын
+djbanizza instead of searching for god
@Vermilicious
@Vermilicious 7 жыл бұрын
Yeah, it's a group think issue, as with so many other things.
@gnollrunner520
@gnollrunner520 6 жыл бұрын
I agree.....for instance one specific doctrine is OOP is bad.
@baruchben-david4196
@baruchben-david4196 6 жыл бұрын
Holy wars.
@hanelyp1
@hanelyp1 3 жыл бұрын
Object oriented programming has some good ideas, which applied intelligently can help produce good code. But when those ideas are reduced to formulas and applied blindly, you can get some very bad code. And the latter seems to be the norm for much of the industry.
@DJazium
@DJazium 4 ай бұрын
This is the best explanation of what I've been feeling for over a decade. Thank you so much for putting this together.
@stomah9832
@stomah9832 3 жыл бұрын
the “use” block is a c++ lambda
@tomascanevaro4292
@tomascanevaro4292 7 жыл бұрын
Why is C such a rude language? cos it has no class :V
@Taric25
@Taric25 7 жыл бұрын
Ba dum tiss!
@callykitten5095
@callykitten5095 5 жыл бұрын
C++ exposes the programmer to all variants of STDs. Versions prior to 17 make exceptions.
@tiagocardoso4702
@tiagocardoso4702 5 жыл бұрын
Who need class when you have (void*)?
@dandre3504
@dandre3504 5 жыл бұрын
With C you can shoot yourself in the foot. With C++ you can reuse the bullet. With Java you would have a Bullet factory. With C# you would have a bullet that would query the subject to harm itself.
@victorq5309
@victorq5309 5 жыл бұрын
Haha :v +10 lol
@justins8802
@justins8802 2 жыл бұрын
I’ve spent 15 years at a fortune 200 company where we have almost always been writing procedural code in OOP languages, mostly Java. We generally feel shame for it, and occasionally an overachiever builds something with “proper” OOP. Every time it ends up being a mess and more trouble than it’s worth. This has helped me finally see why that has been the case.
@pyhead9916
@pyhead9916 2 жыл бұрын
Your company problem stems from too many programmers who don't understand OOP.
@Dovenchiko
@Dovenchiko 2 жыл бұрын
@@pyhead9916 I think OC and OP are both under the impression that writing with objects automatically makes you a good programmer. Hopefully this is obviously wrong because a pile of crap is still a pile of crap no matter what angle you look at it. If the object collection has weird hierarchical madness OO is not to blame, uness implemented so poorly in the language itself, but instead simply is a bad programmer/team.
@juanausensi499
@juanausensi499 2 жыл бұрын
@@Dovenchiko I agree. Yes, using OO doesn't make you make good programs magically. I think the authour is a good programmer, and as good programmer, doesn't really understand the problem of bad programmers. He is always comparing good procedural programs with good oo programs, and he has some really valid points. But the fact is business wants/needs a replaceable workforce and that causes a high rotation, so you are going to have some bad apples sometimes. And OO really excels limiting the amount of damage a bad programmer can do. I think every criticism the author makes about OO is correct, but he doesn't value enough its advantages, especially the management ones, and also dismisses the problems of procedural programming, i think because he is good at it so he can manage that. And finally, no two programmers are equal: some understand better (and consequently, are better at) some paradigms, an some other understand better another paradigms.
@drygordspellweaver8761
@drygordspellweaver8761 2 жыл бұрын
OP’s OOP beats OC’s PP as far as OO goes My god, the naming conventions. I would hate to read code from yallz
@juanausensi499
@juanausensi499 2 жыл бұрын
@@unformedvoid2223 No tool or technique prevents damage, but modularization makes the damage contained. OO forces that modularity, and that's why it is the popular choice for business. That was what i was pointing out. Remember that the 'best' language can be one from the point of view of the programmer, but another one from the point of view of the business.
@ProtossHyrdalisk
@ProtossHyrdalisk Жыл бұрын
OOP is wonderful for large codebases. I have worked far too long on the IBM iSeries platform with its go-tos, and top-down programming. It doesn't work. It's nearly impossible to upgrade codebases that are gigantic and written top down quickly, and they're insanely error prone. Local versus global variables and isolating data in OPP makes life SO MUCH BETTER. I feel like you haven't ever worked on a gigantic codebase.
@TheVino3
@TheVino3 11 ай бұрын
This is true, and i also feel like this video has nothing to do with areas of coding that arent database/website associated. Like simulations, or even game dev, where you dont need all data to be stored or returned somewhere. In that context youre not just "performing an action on data", youre using objects to capture behaviours, and having them split into classes with encapsulation allows that process to make sense, without ending up with a script thats 20000 lines of code. Entity-Component DOTS style coding is often a better choice, but its readability is atrocious compared to OOP, and thats important for quick testing and turn around times. The idea that a style as useful, flexible and readable as OOP is just blanket "bad", is really more just an admission that you dont know when to use it, or how to use it.
@JayD01234
@JayD01234 4 жыл бұрын
When you only have a hammer, then everything looks like a nail right?
@justgame5508
@justgame5508 3 жыл бұрын
That’s why as programmers we should have a range of tools. Hammers have their uses
@kb-zealot
@kb-zealot 3 жыл бұрын
@@justgame5508 That's one of the reasons why I like C++, it's the whole toolbox of paradigms. Even if there are a couple weird dangerous tools in there that can prick your fingers (i.e. placement new), it's still nice to have them.
@StrifeOnizuka
@StrifeOnizuka 5 жыл бұрын
The complaints are valid but I can't agree with all the suggested fixes.
@nomotif8863
@nomotif8863 3 жыл бұрын
This is the story of humanity
@TheJacrespo
@TheJacrespo 2 жыл бұрын
Functional programming has also its clear limits when you need mutable variables/objects/functionality because that is available only in run time: for instance user interface devices and dynamic inputs/outputs. In this case it is better and easier to code the business with dynamic objects than with monads.
@user26912
@user26912 2 жыл бұрын
Try Clojure. Great constructs for safe mutable state like atoms.
@llothar68
@llothar68 Жыл бұрын
@@user26912 Clojure/FP makes things much slower and trashes memory so you have to ask yourself why are you using multithreading parallelism at all. It's done only for performance and if you waste this on clean code i don't understand. Then write just zero shared data multitasking.
@damiengates7581
@damiengates7581 6 ай бұрын
lol, idiots trying to run from state, must be in a state of fear
@XeenimChoorch-nx8wx
@XeenimChoorch-nx8wx 5 ай бұрын
@TheJacrespo Uhhh- no? If your buffer is 256 bytes long and the user inputs 300 bytes, just increase the size of the buffer at runtime. This is how it is ALWAYS done- the difference is that OOP incurs a heavy performance cost by doing that stuff under the hood to account for all general cases. The garbage collector for example…
@tullochgorum6323
@tullochgorum6323 4 ай бұрын
In the end, it all comes down to error handling. Monads do this at the expense of performance and cognitive overhead. I've always preferred simpler pragmatic approaches, and they seem to get the job done.
@gfmoore
@gfmoore Жыл бұрын
Thank you so much for this. As a programmer from the days of Fortran IV through Pascal, C, Java, JavaScript etc I always felt a bit of a fraud when not writing "proper" object oriented code. I much preferred writing in a procedural way. Now I know why!!! And yes teaching OOP is a real hassle as I'm always thinking, but really I don't need to do this... 😀
@HansMagnusNedreberg
@HansMagnusNedreberg 5 жыл бұрын
I think Gilfoyle did a great job narrating this epic story!
@hazevt04
@hazevt04 3 жыл бұрын
I LOVED that show. It was so weird seeing him in Spiderman, though...
@shwhjw
@shwhjw 3 жыл бұрын
@@hazevt04 Wow, never recognised him, I guess that's his real voice?
@Fire_Token
@Fire_Token 8 жыл бұрын
I really liked this video! At the time of writing, so did more than 3 quarters of the people who gave it thumbs, which is really reassuring after reading through the horrible comment section. I have to admit that I related to every single example that was given, and it brought back painful memories of so many years of writing code. Thanks Brian! Now I don't have to feel guilty any more, and I have the courage to say it! :)
@bichitomax
@bichitomax 9 жыл бұрын
I think the video could be more digestible if you didn't sensationalize it with "This is the most important programming video you will ever watch". Not that I am one to talk though.
@fburton8
@fburton8 9 жыл бұрын
+Jesus Bejarano On the other hand, it's also a good hook to get people to watch the whole presentation.
@bichitomax
@bichitomax 9 жыл бұрын
+fburton8 I think is a little bit cheap but I know was he was going for none the less and its merits.
@BoTuLoX
@BoTuLoX 9 жыл бұрын
+Jesus Bejarano With OOP being a standard of the industry for 20 years now, I don't think it's too cheap.
@ChilledfishStick
@ChilledfishStick 8 жыл бұрын
+JBeja M I almost didn't watch it only because of that grandiose promise.
@ChilledfishStick
@ChilledfishStick 8 жыл бұрын
+Shawn McCool What does my or his ego have to do with this?
@curtkoehn3906
@curtkoehn3906 Жыл бұрын
I have 35 years of software development experience. OO is a tool. A very effective tool when used correctly but not so much when you slavishly allow it to dictate every little decision you make. Leverage the strengths of OO (like polymorphism, high cohesion, low coupling) but minimize its pedantic usage (like unnecessarily complex inheritance trees for the sake of OO purity). Unless you are using a pure OO language like Smalltalk, most OO languages are flexible enough to be multi-paradigm. It's a poor workmen who blames his tools, unless of course it's VB.
@valeriyv1073
@valeriyv1073 Жыл бұрын
Agree! In my simple understanding. Objects are stateful and most distributed and multithreading approaches assume stateless where data is separated from the handlers. OOP still is a working horse of all internal logic.
@shrin210
@shrin210 Жыл бұрын
OO is a tool, but in language like Java uses OOP all over the places wherever it's not even necessary. New programmer checking the codebase gets confused when OOP used in places when it's not even necessary, with inheritance its just nonsense abstraction.
@noahwilliams8996
@noahwilliams8996 5 ай бұрын
No, some tools really are garbage.
@ww123ification
@ww123ification 4 ай бұрын
There is a programming tool that, when used incorrectly, causes compiling errors (and the code won't compile). No damage then. When used correctly, causes the debugger to be practically useless. Have you tried it? And yes, it is FP :-).
@stelarfox
@stelarfox 4 ай бұрын
And the problem is there are too many purist that do exactly what you say it should not be done. I know a programmer and even have to work with that instead of making a single switch with 5 different settings will make 6 factories that will contain 15 classes to do it. If you are doing that just for a single switch you are bad on the head and heavily. And the switch on itself has only 1 or 2 lines of code. If you say "that is hard to read" trully cannot understand how compared to a total of 21 clases.
@marleypeter
@marleypeter 2 жыл бұрын
This was an absolutely fascinating video. I intended to just watch the start to get a vibe for the idea here and ended up watching the whole thing. I'm a SD student and we are using Java as our teaching language, and I personally am currently trying to square the circle; to extricate the cross-over from encapsulated objects. Something you said in the end about programmers taking good ideas to holistic extremes is something that even someone at my level can appreciate. A lot of the questions I have asked my lecturer, the ones that did not receive "good" answers anyway, relate to this idea. Super interesting video.
@samhughes1747
@samhughes1747 2 жыл бұрын
Oh, heck yeah. I normally hit the skip hard on lines like "One of the most important yada-yada." There was just enough nuance to promise the goods, and yeah. Maybe not a life-changer, but I'm with you!
@ianrust3785
@ianrust3785 2 жыл бұрын
Lol... the video just speaks above the audiences heads, where most listening aren't educated / experienced enough to refute the horrible ideas. OO is meant for large projects where architectural issues matter. Java was designed for enterprise-scale applications. It was designed by Sun microsystems specifically for this purpose. If your application is 3000 lines, you might not need OO. You might be able to get away with using global variables at that scale (though if your application grows much larger you're pushing it). In an enterprise scale codebase where you have 10 million lines, no architect would ever design for reliance on global state, this would only result in complete chaos. There would be so many unpredictable synchronization issues it would destroy your application. This has been known since the earliest days of high level languages... Most of the people in these comments agreeing with Brian are students, or people with 1 or 2 years experience, small scale web developers, electrical engineers / other scientists working only with C, for whom programming is not their main specialty... etc. I can guarantee you very few of these people are working at scale, these ideas simply do not work at scale. Which is why they are not used...
@cavasnel
@cavasnel 2 жыл бұрын
@@ianrust3785 Linux is millions and millions lines of code in a procedural style. It has more than half a million contributors and has been maintained for 20+ years. Every AAA game that pushes the boundaries is made in a procedural/data oriented fashion because OOP kills performance. These two examples absolutely dwarf any enterprise app by an order of magnitude in complexity.
@ianrust3785
@ianrust3785 2 жыл бұрын
​@@cavasnel ​ Despite the fact Linux is written in C, the code in the kernel leverages many tricks of the C language to mimic OO. For a detailed description of these various tricks and their use within the Linux kernel google "is linux written in procedural style". Also.... according to The Linux Foundation, since 2005, “some 14,000 individual developers from over 1,300 different companies have contributed to the kernel.”. Most of those contributions are drivers, ... but it's not half a million, sorry.
@ianrust3785
@ianrust3785 2 жыл бұрын
​@@cavasnel Games are typically written with components based architectures these days, most are written with Unity or using various C++ libraries. Try describing a real game and how it was architected in detail. You just claimed the entire game was written in procedural style. What game was designed this way...? And what was the reason - was memory severely limited on the platform for some particular reason? This sort of problem was far more common in the days of 16-bit SNES than it is now. If you’re writing your own custom game engine or image processing functions, some piece of code that executes millions of times for a single update to the UI, then extra layers of abstraction could start to degrade performance. If performance is critical and resources are very limited, eliminating those layers will be one of two dozen optimizations you might do here - because you’re dealing with such a critical piece of code. The entire program would not be coded this way, this engine code will be tucked and the rest of the application will only interact with it through an API. In your main application, the part of the code that is user-input driven (not compute bound), memory management is the only thing that matters. A trip to disk takes about 8 orders of magnitude longer than a compute operation, processing extra layers is a compute operation… eliminating a single call to those layers might amount to a few microseconds worth of difference in performance, maybe. Depends on what’s in the cache. Depending on the compiler, it may actually make no difference whatsoever… To optimize in such a way any user-input driven code is purely idiotic, it is compromising the architecture for microseconds worth of performance. Meanwhile if you need to reuse any code, like an object model or behavior, in the entire game... you have to begin maintaining duplicated or global state for your code, and now you have a giant mess on your hands. I don't doubt some developers have done it, developers do all kinds of stupid things, but this is not a good design by any stretch. A more valid concern is potentially pulling in more from standard libraries than you need, increasing memory consumption, so some developers write their own custom algorithms that reimplement some things from standard libraries... but even this is usually a bad idea, the compiler recognizes & optimizes code in standard libraries, the code actually executes 3-4x faster than custom code. But this isn't a paradigm problem, it just has to do with memory management. Carry onward
@Gelikafkal
@Gelikafkal 5 жыл бұрын
1) in my university they tought us, that classes called -manager, -service, -handler, x-er and so on are considered to be bad for the reasons that you mentioned. They are actually bad practice and no contradiction to the use of the oop paradigm. 2) the "use" keyword that you suggested is basically the semantic of lambda expressions in pure functional languages like Haskell 3)even though you tried to give ideas, how to solve the problems instead, you did not give very concrete solutions. One main reason to impose a structure using oop is to avoid "spaghetti code", where everything is connected to everything and it is not really obvious what functions are called from what scope.
@rafalborowiak7235
@rafalborowiak7235 6 жыл бұрын
Actually C++11 has the `use` feature that you show. In C++ lambdas doesn't capture (see) all variables from enclosing scope, you need to declare them explicitly in capture list. Instead of writing `use a, b { }` you end up writing `[a, b] {...}()`. Example: `const int a = 2, b = 3; const int c = [a, b] { return a + b; }();`
@kitten-inside
@kitten-inside 6 жыл бұрын
It's almost as if "OOB == Java" was a bad premise for the video...
@mikejohnstonbob935
@mikejohnstonbob935 6 жыл бұрын
avoid temptation to [&] :(
@pcfreak1992
@pcfreak1992 6 жыл бұрын
+1! I was scrolling through the comments just to see if someone posted this.
@EbonySeraphim
@EbonySeraphim 6 жыл бұрын
@@pcfreak1992 I missed that someone already said this and re-posted >.< My reply is a little more long winded though. I verified that Java and Ruby can't do anything close to what you can express in C++.
@janisir4529
@janisir4529 5 жыл бұрын
@@kitten-inside Java is kind of a bad language by oop standards.
@lesterdarke
@lesterdarke Жыл бұрын
Hey, just want to thank you for this video. This explained something really well that I’ve noticed from trying to grapple with existing codebases at work and have intuited as a kind of encumbrance. Chasing classes down gives me a headache - when I want to understand what code does ideally I want it as sequential as is sensible so that I can follow the changes of values and potentially interrogate by pulling values out at different stages. Having classes built on classes built on classes all the way down means that often I get to the functionality I want but then can’t find weird the values get into that piece of functionality in the first place as whilst I’ve followed the hierarchy down one leg I now need to follow it up another! I’m a Data Engineer but have come into it without a degree in any computing field, and many of the things you’ve mentioned in this video I have come to on my own. Such as passing global variables into functions explicitly not just calling them for the sake of it. I totally agree that there is a place for objects/classes for data structures makes sense but not making all functionality Objects. DataFrames are excellent for my work and what they do makes sense, but that doesn’t mean that style of structure makes sense for everything.
@XeenimChoorch-nx8wx
@XeenimChoorch-nx8wx 5 ай бұрын
Here’s a fun project: write your own Flattenizer. Scan through a code base and inline all the scattered logic into one location as if it were procedural.
@TheQwerJoe
@TheQwerJoe 8 жыл бұрын
42:51 C++: int a = [x,y]() -> (int) { .. return 3; } (); It does exactly what you are looking for..
@zegarek840525
@zegarek840525 6 жыл бұрын
;) ... and javascript: var a = 3, b = 4; var c = function(d, e){ return d + e; }(a, b); console.log(c); php also...
@brendanjohnson2833
@brendanjohnson2833 6 жыл бұрын
@@zegarek840525 Even easier in ES 6 with a pointer function!
@mateuszkaplon
@mateuszkaplon 6 жыл бұрын
In C++14, you don't even have to specify the return type yourself :)
@iorbit
@iorbit 6 жыл бұрын
He was saying that the inner scope should not be able to access any data that's not explicitly passed in to it. This would let the reader temporarily forget all about any variable which is not immediately necessary for the next logical step. I don't know about c++ but local anonymous functions / closures in both php and js are not restricted in this way. He also mentions that the data is always passed by copy - not by reference - ensuring immutability.
@hsjoberg
@hsjoberg 6 жыл бұрын
@@zegarek840525 No... You have the outside scope inside the function and thus not the same thing. Did you even watch the video?
@pat5star
@pat5star 5 жыл бұрын
I watched the entire video and while it made me think I still can’t agree with the premise. To me a well thought out and designed OO program is easy to work on (whether you were the original programmer or not) and to extend. In my experience, the nightmares arise from programs that started as one thing and grew to something else or worse they were extended by a programmer who took shortcuts and no longer adhered to the original OO design. I’ve worked with both well designed OO and procedural programs and in my experience I have always found it so much easier and enjoyable if it’s OO.
@Roescoe
@Roescoe 3 жыл бұрын
Code debt makes all issues clear.
@honkhonk8009
@honkhonk8009 2 жыл бұрын
What I like to do, is to basically fuck around and make some prototype , and then if I have the time, I draw up some random chart on how stuff is supposed to relate to eachother, and then organize it like that. It helps to be off a few adderal pills while at it. Im programming for fun, so i dont really know any of these industry level knowledge. Maybe people do that.
@CyrilCommando
@CyrilCommando 2 жыл бұрын
By that logic alone however, OO is difficult to extend because adhering to the original design plan while extending it in a meaningful way is exceedingly difficult.
@Slink3322
@Slink3322 2 жыл бұрын
"programs that start as one thing and grew to something else" pretty much describes every piece of commercial code ever written :-)
@ianrust3785
@ianrust3785 2 жыл бұрын
@@CyrilCommando good luck changing thousands of lines of procedural code to a new design when it relies on the whole sequence of operations being maintained in an arbitrary order, otherwise your global state goes out of sync. What you'll have to do is rewrite the whole program.
@EdgarVerona
@EdgarVerona 3 жыл бұрын
Poo-pooing autocomplete as "groping your way through" is a nonsense argument. Programming isn't about memorizing rote syntax, and having that belief is a recipe for disaster in a codebase of any significant size.
@babyfire6221
@babyfire6221 3 жыл бұрын
Imo a good programmer is the one that comes out with te best and most efficient solution, not the one that memorized all syntax. Autocomplete is a really good tool that improves workflow exponentialy
@travis1240
@travis1240 3 жыл бұрын
Absolutely. Especially if you're modifying someone else's code or code you wrote more than a year ago, autocomplete is an absolute lifesaver. This is why it takes me 3 times as long to write JS as Java.... I have to constantly look for function names in other files that were written years ago by other people.
@thegrandnil764
@thegrandnil764 3 жыл бұрын
If you can't hold what you want to do in your head before you write it, then your program is shit.
@Swift016
@Swift016 3 жыл бұрын
Typical computer scientist completely failing at comprehension lmao. What a terrible, bad-faith strawman.
@omniphage9391
@omniphage9391 3 жыл бұрын
it seems like these "oop critics" have only ever woked on single person small scale applications where they could reinvent the wheel without it taking years - its also proably a very shitty wheel if they just came up with it themselves.
@TeamPuzel
@TeamPuzel 14 күн бұрын
A few years later, you were correct, this was the most important programming video I ever watched. Thank you for making the video.
@patheddles4004
@patheddles4004 3 жыл бұрын
@20:55 "Where in the system of 10 objects all sharing the state is the coordination?" In the object that holds that state, and in the class that defines all valid state changes for that object. Each object is responsible for its own state, regardless of how many other objects have access to that state. I find myself disagreeing with some of your arguments, but you are forcing me to think deeply. And I also appreciate your clear definitions of terms.
@darkengine5931
@darkengine5931 3 жыл бұрын
There tend to be complicated cross-cutting concerns across shared, mutable objects in many circumstances. A simple example is a traffic light and a car. These could be two separate objects but, for correct/desirable behavior, cars should not cross the road when the light turns red. Now you have a cross-cutting design concern which requires you to look at the interaction of the objects, and not just the objects themselves, to reason about correctness. Even if you unit test the traffic light thoroughly, and unit test the car thoroughly, and they both pass their tests, they could be used incorrectly together. A recurring one that's similar is race conditions (including deadlocks) when objects are used in the wrong order across threads. Functional programming eliminates this completely by avoiding shared, mutable state. Procedural programming can sometimes simplify things a lot more than OOP by centralizing the mutations to shared state to the minimal number of functions instead of branching all over the place between complex object interactions.
@aliengenie8896
@aliengenie8896 2 жыл бұрын
@@darkengine5931 A 'traffic light' problem like this is an inherently stateful problem that involves interactions between multiple objects in the real world, so of course you'd have to have this interactions replicated in code if you wanted your program to work correctly. The trick is to establish these object relationships in a way that makes sense. If you're deciding whether or not a car should go or not, a car should have knowledge of what road it's on, you should be able to easily tell how far away the next traffic light is, what color it is, what other roads connect to the intersection, how many lanes those roads have, you should be able to tell what other cars are at, or are nearing, the intersection, what speed they are going, whether they have their turn signals on, etc. Trying to avoid complex relationships between objects when modeling a problem where those complexities exist in the real world, is futile, and trying to model a problem like that without objects is going to quickly turn into a tangled mess.
@darkengine5931
@darkengine5931 2 жыл бұрын
​@@aliengenie8896 The difficulty I've found in my experience as a gamedev dealing with such simulations of the real world is that if we have so many stateful, mutable objects, we have a great deal of shared, mutable state. Even the most enthusiastic object-oriented designers understand, if they deal heavily with multithreading, the difficulty that shared, mutable state imposes on reasoning about the correctness of systems in multithreading contexts. >> A large fraction of the flaws in software development are due to programmers not fully understanding all the possible states their code may execute in. In a multithreaded environment, the lack of understanding and the resulting problems are greatly amplified, almost to the point of panic if you are paying attention. Programming in a functional style makes the state presented to your code explicit, which makes it much easier to reason about, and, in a completely pure system, makes thread race conditions impossible. -- John Carmack Yet I would suggest such thread-safety concerns that arise from shared, mutable state are just one example in the broad category of integration hell where code that works fine in a single-threaded context, when integrated in a multithreaded context, fails unexpectedly due to data races. One common problem teams can encounter if they design codebases that consist of so many stateful, mutable objects is that their unit tests pass but they can still be plagued by edge cases that only reveal themselves in the context of integration. I've started to see many object-oriented developers starting to make arguments that integration tests provide more business value than than unit tests as a result. Yet embracing a more functional style eliminates integration hell almost entirely in all forms since it largely eliminates mutable state. An alternative that doesn't do quite as thorough of a job as functional is the ECS. The ECS tends to take on a more procedural design breaking encapsulation, but it tends to avoid the integration hell problems that can manifest in lots of heavily object-oriented systems by reducing the design to a handful of systems that transform data which are extremely explicit about exactly what data they transform. They don't eliminate shared, mutable state but they make it extremely clear and explicit exactly what is mutated and when/where.
@darkengine5931
@darkengine5931 2 жыл бұрын
​@@aliengenie8896 Allow me to try another angle as well focusing on the tangled mess you mentioned. Hopefully both of us have seen at least some of the worse cases of object-oriented design to see that OOP is not immune to producing a tangled mess where we can no longer effectively predict what would happen by merely looking at individual things without getting loss in a tangled mess of other things through their complex and tangled relationships, and/or change something to suit a new design requirement cleanly without changing everything else involved in this tangled design mess. The first and foremost metric easiest to measure and address to untangle object-oriented designs is coupling. If we seek to decouple objects further (either loosening their coupling or completely decoupling them), our tangled designs start to become less tangled. When we can effectively produce the most independent object designs not interdependent on one another and without becoming too leaky in their abstractions, that's when I'd say OOP produces the maximum value for the buck as it avoids producing a tangled, highly-interdependent mess, with self-contained invariants easy to guarantee and maintain. That's when we get the maximum benefits of predictability, modularity, reusability, and I'm totally aligned with OO enthusiasts in utilizing encapsulated objects in these cases. The problem I see is that as we work towards higher-level design requirements in a sufficiently complex simulation of the real-world (which tends to involve so many cross-cutting concerns as Brian calls it), we can't help but produce tangled messes if we favor at least an eager or even purist style of object-oriented design. This is because the very nature of encapsulating state and methods that can exclusively access that state together tends to result in something we might analogically describe as a thousand teeny islands that give the illusion of being easy to comprehend in ways that provide a lot of business value. Yet they don't actually provide much business value on their own and end up having the most tangled and convoluted trade routes in between them, and we find too little valuable information to be comprehended and predicted as far as comprehending business/design requirements by looking at each individual island without fully comprehending the convoluted and tangled trade routes in between them. When the analogical trade routes in the above example become the ultimate source of tangled complexity and misunderstandings which makes things difficult to predictability change, and in isolation without changing surrounding things, the only scenario to further decouple and simplify such designs and untangle them is to start abandoning OOP on a small scale in favor of what John Carmack calls "medium-weight" to "heavyweight" encapsulated objects, and that's precisely what he did in the final stages before he largely abandoned object-oriented design all together in favor of functional programming which provides maximum comprehensibility, predictability, reusability, modularity, but largely eliminating mutable state outright and achieving the highest degrees of decoupling. He was doing the metaphorical equivalent of coalescing these teeny islands into larger landmasses whose individual requirements become a bit more complex to understand on their own, but whose trade routes between islands become substantially simplified. It's a decoupling mindset as well as a testability mindset (a small object which provides very little business value on its own provides very little business value in passing its unit tests regardless of the coverage). The analogical "TrafficLight", "Pedestrian", "Road", "Sidewalk", "Car", etc, turn into simple bundles of state whose traffic-oriented functions might move into something we might organize and bundle into "TrafficSystem". That is also what the ECS, as becoming increasingly favored for modern game engines, does. It would turn something like "TrafficLight" into a simple data-oriented component that bundles state but not its functions together.
@darkengine5931
@darkengine5931 2 жыл бұрын
​@@aliengenie8896 If you'll forgive yet a third way of analyzing this which moves away from the most technical, we can focus on design in general. As beings of limited intellect and comprehension, and whose comprehension and capabilities for misunderstanding and miscommunication multiply with more team members between us and more lines of code, we tend to want sufficiently "meaty" designs to simplify our comprehension and communication. If our goal is to build a sand castle and focus on the artistry behind it, we will start to lose our way if we become obsessed with the functions of each individual grain of sand in producing that castle, or each individual drop of water, or each molecule (and further the atoms) of air. At some point we'll lose our artistic vision getting overwhelmed by the chemistry and physics. Yet OOP taken at least to extremities might start to want to model and design every single thing which intuitively resembles an object into an encapsulated object, such as a grain of sand, or an air molecule, or even the atoms that make up that molecule, or a water droplet, and test them all in isolation when our main focus is to design sand castles. OOP tends to want to work towards bottom-up ways of design when the design of a sand castle might not benefit much business-wise from being decomposed no further than walls and pillars and roofs and the like. Another example is digital art. If we're painting a 16x16 ultra low-res sprite or tile, then it makes sense to place a lot of focus on the design of each and every pixel of that pixel art. That doesn't become overwhelming with a total of only 256 pixels. Yet if we're painting a 4000x4000 pixel image with 16 million pixels, it starts to become downright counter-productive and thoroughly overwhelming even to a single human brain, let alone a team, to focus on and test the design of each and every pixel as well as the relationship of every single pixel to every other pixel. OOP doesn't tend to prioritize where to focus our design efforts for interfaces, maintaining invariants, effective polymorphism, etc, this way against the complexity of our design/business requirements. It tends to want to design and model anything that sounds intuitively like an object, as a single pixel in above example, as an object complete with its own carefully-designed public interface and private state. It also wants to test everything that sounds like an object in isolation. And when our business requirements are very complicated, that can start to become counter-productive in comprehending what we're doing from a bird's-eye view. This isn't necessarily a criticism of object-oriented features but how object-oriented design tends to be tackled, especially when we start moving into SOLID and principles like DIP.
@huzzah3234
@huzzah3234 4 жыл бұрын
I really needed to see this. It's like I'm looking back at myself of the past, and this was always the obvious point I was supposed to reach but I somehow got lost along the way. This is what programming should have always been about for me but it never was, and it made me displaced because I was always looking at it from this artistic angle, but the pieces of the puzzle just never truly fit together, while nobody else ever gave a damn. That tree, the need to send a message up the nodes to send it back down, I felt that hard, it's the kind of minor thing that leaves me stuck for days working on until it kills the passion for what I'm working on and effectively kills the thing I'm working on. The way you talk about documenting your code, organizing things, it's like staring into a mirror. I wouldn't even know where to begin, but I would love to talk to you more about this, or even better, have some group pertaining exclusively to this kind of discussion, I cannot put into words how refreshing this would be to me. You did an excellent thing bringing light into this topic, I'm thankful.
@grahamdavies8924
@grahamdavies8924 4 жыл бұрын
Huzzah, thank you for writing this comment because now I don't have to. I feel exactly the same way in every particular. Fortunately for me, I am now retired and have taken up woodworking. Now I agonize over whether to use a hardening oil finish, shellac or water-based urethane.
@username4699
@username4699 3 жыл бұрын
If you haven't already seen it, you may appreciate Rob Pike's "Public Static Void" speech. Mr. Pike was one of the designers of Go, a language that Brian brings up in this video a few times himself (and does so in a positive manner).
@ItsMeChillTyme
@ItsMeChillTyme 3 жыл бұрын
Yep! Started out with Java in school and its good until you get out of the basic algorithms and data structures in isolation. Started making Android apps cause I figured that's how its done since I already know Java and wow, did I have this same frustrating experience to the point that I quit! I never much bothered to look into how people felt about these things and would sometimes read an article or two from people who should rather be designers with a keyboard instead of pencils, the web developer types, and would never really get anything concrete, very vague things that, at the time, I assumed I did not quite 'get' because they were simply better than me. Now that I am in a better position, it seems so surprising to me just how much contet surrounding this industry on the internet is utter pollution advising you to do things in a way that makes other things get in your way than get the job done!
@john-3642
@john-3642 3 жыл бұрын
Same here. I realized the importance of refactoring code but what killed my passion was thinking that everything had to fit together into labels and that it’s useful to do one thing in a million places for the future. I guess in any situation, one shouldn’t do X just for X’s sake
@moosesgalore
@moosesgalore 2 жыл бұрын
def looking at it from an autistic angle for sure
@Ratchet2022
@Ratchet2022 3 жыл бұрын
I find I understand what Brian is saying about the tree graph and refactoring problem. In OOP class in Java I felt I totally didn’t do it right. I remember in Java I had to pass data all the way back up a hierarchy of classes and down again instead of just communicating directly. I had to add extra parameters in the class chain just to pass one or two pieces of data. It made looking at the UML diagram obfuscated. Other than this, there would be a lot to pick apart and a lot is about preference and can’t be proven whether one way is better or not. For example Brian you said how long functions are okay and better than abstracting away short functions because the reader of the code base has to sift through the names of the functions and that you can just comment the longer functions well instead. Orrr, you can just abstract the long functions away into the smaller ones and document your code well so that the reader can quickly glance at the comments and see which functions are sub-functions of others, and good IDEs like VS will do this for you, that is tell the reader where the function is referenced or called. This is a matter of style. It can’t be proven that one way is intrinsically better than the other. You either comment your long functions well or you comment your short functions well, but you document either way. The reason we break code up into smaller chunks is to forgo the law that complexity is always more error-prone. Breaking tasks into smaller chunks eschews accidentally updating a variable that a sub-task doesn’t need to touch. You threw in Agile, Test-driven development, and dependency-injection as bandaids for OOP. What?? I think you’re reaching. Maybe DI, but Agile has nothing to do with OOP. You can “fail-fast” in procedural and functional languages too. One more comment is on your saying that there’s no good way to connect behavior with a class, like should you send by a sender or receiver function. You basically said there’s multiple ways to do it, so therefore there is no right way to do it. Well… just pick the best one then-in the flow of the data. Sender. A sender method will import and call the method that does the sending. If you receive, then that would be an event-listener. The premise of this video is that we need to account for if data can be sent in multiple directions and that state… basically can’t be managed, so why bother at all. Data generally flows bilaterally though, and you’re always going to have to have some “god-object” to manage the state of any subset of data, which classes encapsulate, or in other words organize, whether it be a class or a namespace, or else this objection about maintaining “state,” or the state of your program, will always be unmanageable. This is my opinion anyway. I am certainly not wholly informed or don’t have experience with procedural I guess, but I do with OOP and functional. I appreciate the exercise of freedom of thought and opinion, but I think some things in this video are reaching.
@chrisschaefer3863
@chrisschaefer3863 Жыл бұрын
I'd say MOST good java code is actually written in the style above. The things which are encapsulated in classes tend to be a) various functions which are logically grouped together and b) configuration (which is a bit like global variables as it pointed out in the video ). The reason for this is that most server side codes needs to be entirely re-entrant, so storing state (other than configuration ), is a no no. State ends up in databases (of various forms ). The only exception to this is various caching type functionality.
@llothar68
@llothar68 Жыл бұрын
Thats why frontend code is more complex as backend code. But even on server there is so much algorithms and processing to do.
@kahnfatman
@kahnfatman Жыл бұрын
I had second hand experience with Java web developers back in my early day as a software engineer. I saw way too many static class methods to the point I thought to myself: Are they even doing OOP? Well I was still an OOP fanatic at that time -- my foolish younger self.
@LusidDreaming
@LusidDreaming 5 жыл бұрын
Domain Driven Design (DDD) addresses--and in my opinion eradicates--all the issues described. Now DDD is language agnostic, although Evans himself points out that OO languages are usually better suited for it. I think the issue is that most people confuse the paradigm of OOP (which has matured over the years) with Java's implementation of it. Now first I want to say I think this video makes excellent points about some of the shortcomings of old OOP paradigms, although I think the title of this video should be "Strict Encapsulation is Bad." There are, however, some points I think need to be addressed. (I've addressed test driven design in another comment). 1.) The analogy of the over-architected house is (pretty much by definition) describing a poorly planned application. He mentions walls that were prematurely established, but this is a planning flaw and not directly related to OOP. I could argue that procedural code is like a winding country road, it just randomly weaves and has no coherent sense of an actual destination. This is not a flaw with procedural programming, this is just poorly planned code. 2.) He states early on that he will ignore inheritance--rightly so--because even OO programmers warn against it. He then later references complex hierarchy graphs, which are due to inheritance. The modern approach to OOP is much more focused on dependency injection and interfaces. As far as complexity goes, the relations between objects in well designed software are only as complex as the domain requires. Any other complexity is almost certainly due to poor design choices and not the paradigm itself. 3.) "In procedural code there is only the call graph." I think this is very misleading because, in a complex domain, the call graph will only be decipherable by the software designers/engineers themselves. It is very unlikely that an "outsider" would understand the call graph outside the context of the software itself. This is why OOP is such a great tool for complex business domains. I worked on a healthcare application and one of the most valuable aspects of our design was that we could use the same graphs and flowcharts our developers were using to discuss the application with doctors (the domain experts). There was no intermediate translation needed to describe the business logic (interactions between objects) to the people who were actually in charge of implementing it (the developers). This is the point behind DDD's ubiquitous language. 4.) There definitely is a need for functionality that lives outside of objects. Anonymous functions now exist in most languages, as mentioned in many other comments. I would only like to add that creating a "container" for these functions is very much like a namespace and can actually be helpful in describing the context of certain functions and grouping them together in ways that are self-documenting. 5.) Abstraction is a term that has a specific meaning in computer science: it refers to the level at which the actual inner-workings of the computer itself are hidden from the client/programmer. For example, even a simple expression like "int y = x + 5;" is an abstraction that hides some of the implementation details (allocate a memory slot for an integer, add the value in the x memory slot with 5 and store it in the allocated memory). The abstraction of OOP is described properly in this video as "simplified interface over complex inner workings." But this is a GREAT thing! This means once an algorithm (business logic) is perfected (using test driven design) it can then be abstracted to an easier to understand concept. I'll concede that factory--and builder to a lesser extent--patterns can be sometimes hard to understand, but they are actually not meant to abstract away complexity; rather they are meant to enforce constraints. This may be unneeded complexity in small, data-driven domains with a small development team, but it is very helpful in larger teams dealing with complex domains as these patterns enforce constraints with public interfaces while hiding implementation details that only matter to the people working in that subdomain. This is similar to a business that contains forms for certain requests. The person filling out the form does not need to understand the details about how the information on the form is used, they just need to be able to fill out the form. Now, as mentioned in the video, it is definitely difficult to abstract away implementation details to the point that it can be described using real world concepts, but this is just the difficult nature of software design, not a shortcoming of OOP. This is analogous to saying it's hard to abstract away the mathematical complexity of structural mechanics, and therefore CAD software should just have the user input the center of mass and moment of inertia themselves. Abstractions and generality are probably the hardest things to master in computer science, but they are also extremely valuable when done correctly. 6.) Modularization is a great thing no matter what paradigm you use. Setting boundaries between responsibilities of your code minimizes the domino effect a change can have. The "fractionality" mentioned is actually a benefit in the long run. If you contain a big chunk of seemingly related functionality all in one place (rather than split it into smaller pieces), it becomes more likely that a small change in that big piece will bring the whole structure down. This idea of strict separation of responsibility is so fundamental to good design that you now have some of the greatest minds in software architecture (Martin Fowler, Chris Richardson, etc) focused on perfecting the microservice pattern. 7.) Lastly, "The kingdom of nouns" is no better than the kingdom of verbs that is procedural programming. The idea behind objects is that most verbs are attached to a noun--a doer if you will--or at least relate two objects together. For example, take the question posed in the video "should a message send itself?" No, a message service should send it, which describes the real world perfectly (be that the postal service, an email server, etc). I don't see what's so abstract or hard to understand about that. So the idea that OOP doesn't have verbs is utterly false, but I could argue that nouns are better described in OOP than they are in procedural code. Now I will concede that OOP is not always the right choice and I think this video addresses the issue of people always using OOP because that's what Java was designed to implement. It is often overkill for simple data-driven applications. But OOP is absolutely necessary for complex business domains. When the application becomes very difficult to reason about using basic control flow, it helps to construct objects that represent actual domain entities and then hide all the programming minutiae inside methods that represent actual business logic. It is also very beneficial when working with a large team to define public interfaces for objects and then delegate management of more detailed functionality to smaller teams that are able to master the concepts of their specific subdomain. This is similar to how every major business operates: your sales team is not responsible for accounting. They may at times need to interact with the accounting team, but there is no need for them to understand every detail of how the accounting department operates. The problem with procedural code when it comes to complex domains is that the entire team typically needs to understand the codebase in more detail. Most of the points in this video seem to pertain to a small codebase with functionality that is easily described using the basic control flow operations that have been around almost as long as computers. But this simplicity of design often breaks down once more complex logic is needed. Again, I want to say that this video makes some very good points about possible pitfalls in using OOP, but there are ways to avoid these pitfalls and it all comes down to taking the time to understand the problem (or domain) in great detail and carefully planning the structure of the application. If you don't want to put forth the effort to properly design the application then OOP will certainly fail you in all the ways mentioned in this video. If you're the kind of developer who gets an idea and wants to sit down and start coding immediately then OOP is not for you. But if you decide to take the time to apply an iterative, test-driven design process then OOP will reward you with a self-documenting, easy-to-understand, maintainable, and extensible codebase.
@myeffulgenthairyballssay9358
@myeffulgenthairyballssay9358 5 жыл бұрын
I also rue the epidemic incessant resistance to objective domain analysis that is occurring pandemically throughout humanity. You can see it in other areas of life too. Indeed more so! Money supply, politics, history, "education", mass media and blind acceptances of sinister, ever growing bureaucracies are the first examples that come to mind outside of engineering.
@sharp7j
@sharp7j 4 жыл бұрын
I feel like you missed some of the points. The problem with OOP is that most verbs are meant to attach to a noun. In the message example, a new coder doesn't know which class to check when it comes to finding out where messages are sent. Imagine you have the following classes: Message, Connection, MessageReader the new coder has no idea where to look exactly and any public methods in these classes will make them paranoid about side effects. In procedural you can still have namespaces/static classes/whatever to organize where the functions live. So now imagine you just have a "Messages" namespace. All actual business logic for messages is contained in this class. It has a function like "SendMessage(Connection, MessageReader, Message)". Bam you instantly know exactly what it's doing just from the parameters it takes. That's the FREEDOM of procedural. With Nouns (usually data) and verbs(business logic) you can now arbitrarily combine the nouns together with arbitrary verbs! Also if you like modularity pure Functions are THE MOST MODULAR thing in existence. In the above example SendMessage is pretty much a stand alone function (though not pure). But compared to OOP it way more modular. Someone could have programmed this so that it has a constructor Message(Connection). Now EVERY SINGLE METHOD in Message, might be using connection who the hell knows? That aint modular. Worse case it could be EDITING STATE in Connection. In the procedural example you know only that one SendMessage function could possibly be editing Connection. Lastly you can get all the same benefits you brought up with things like "business people readable flow charts" and have easy to follow call-graphs if you just name space and limit scope properly. Which is EASIER to do without OOP than with OOP because of the annoying noun.verb limitations.
@LusidDreaming
@LusidDreaming 4 жыл бұрын
@@sharp7j I don't understand how this is better than something like MessageService.Send(message) And as far as modularity goes, then you have a lot of options, like MessageService.SetConnection(connection).SendMessage(message) MessageService.SendTo(message, connection) MessageService.Send(message).To(connection) I'm also unclear as to the advantage of namespaces over static classes. And to be clear, I'm not an OOP fanatic. I use different paradigms in different scenarios and often find procedural to be the right choice for smaller applications. But it's rather dogmatic to argue that procedural code is always better than OOP. In large-scale applications, I think the encapsulation and expressiveness of OOP can be extremely valuable. The price you pay for this, as this video lays out, is that you have to be careful how you use it. But this video just lays out a bunch of problems that have been addressed (again, Domain Driven Design is a great book on this topic) and then asserts that procedural code must be the answer because OOP has flaws. I love programming in plain old C, but it's not the right choice for every project. I love messing around with functional languages like Haskell, but again it's not the right paradigm for every problem. OOP isn't the only way to code, but it is certainly a valid paradigm which is why Microsoft continues to put a lot of effort into maintaining C# (which is what a good OOP language looks like).
@nancykerrigan1335
@nancykerrigan1335 4 жыл бұрын
​@@sharp7j Your example here is really nonsensical. Speaking just from an object modeling perspective, you've reversed the relationships between Message and Connection. Connections send Messages. Messages don't send themselves. Seeing Connection in a constructor for Message is an immediate code smell. If I ran across that in a code review I'd know immediately the developer didn't understand what they were doing. Whether your favor procedural code or OOP, single responsibility principals still apply. It's just as much a mistake for SendMessage to modify Connection's state as it is for Message to do so. I'm likewise perplexed where you get the notion that a procedural approach would give you a guarantee that only a given function could be responsible for modifying the state of a data structure since that structure could be passed to any number of functions any number of times. You'd have the same problem with each call to SendMessage as you would to each new Message the Connection was passed to. All you've demonstrated is that poor engineering can be carried out by anyone.
@raybelmo
@raybelmo 4 жыл бұрын
I had the same feeling watching nthis video.
@carl8703
@carl8703 3 жыл бұрын
16:37 "What is the one abstraction bigger than a function and bigger than a data type?" Mathematical categories, of course. They provide an even higher level of abstraction than objects in OOP, since they are able to describe more than one object, and they remove the need to play the responsibility game that is referenced at 27:22. They can be most commonly implemented in software as a collection of data structures and a collection of pure functions that map between the data structures, with the additional constraint that functions are associative and data structures have some concept of persistent self-equality (so that there is a "do nothing" or "identity" operation that lets you leave a data structure alone without it changing its nature). This by itself is enough to meet the formal definition. You could implement categories as namespaces or as class constructs within code. Implementing a category using a namespace construct allows greater reuse across software projects, since homsets within the category can be stored within separate files. Since a homset captures a very small, perhaps even atomic aspect of interdependency, moving a single file across software projects will need only require importing the minimal set of other files needed to support it. If a category is implemented using a class construct, then there are many concepts within category theory that can be used to precisely describe many of the aspects of Object Oriented Programming that people actually like. For instance, categories often require other categories so that their behavior can be implemented. The categories that are used to implement another category can be tracked as dependencies passed to a constructor, which itself forms a category of categories, where objects are categories and arrows are constructors. This is similar to the way OOP makes use of dependency injection. In another example, certain kinds of functors within category theory can also be implemented using inheritance and interfaces. A design approach based around categories shows many of the positive attributes that people have found with OOP (dependency injection, code reuse, programming to interfaces) while eliminating many of the problematic attributes (state obscuration, state management, the banana-jungle problem), and it is based on a solid mathematical foundation that OOP lacks, which removes the need to discuss what it is we're even talking about, as is done for OOP starting at 1:01. The approach can be considered consistent with the "object oriented & functional" design approach mentioned at 6:12.
@nullpoint3346
@nullpoint3346 3 жыл бұрын
I'm going to need a reminder to read this reply in full...
@ВикторПалыч-п9п
@ВикторПалыч-п9п 3 жыл бұрын
@@nullpoint3346 same
@thommyavv8905
@thommyavv8905 2 жыл бұрын
@@nullpoint3346 yeah
@reallyanotheruser7290
@reallyanotheruser7290 2 жыл бұрын
@@nullpoint3346 I hereby remind you
@lhpl
@lhpl 2 жыл бұрын
There seems to be a good reason why the term "abstract nonsense" is used about mathematical methods used with category theory... I just wonder how it is expected that the average Joe Coder - who may barely have grasped recursion as he drifted from HTML, CSS and copypasting and hacking JS by trial and error, to doing a little backend programming in Php - will understand category theory, and to what extent he should be expected to understand it?
@BryonLape
@BryonLape 8 жыл бұрын
This sounds more an indictment of lack of design than OOP. I programmed both procedural and OOP. Having learned OOP using Smalltalk and Lisp, by the time I learned C++ and Java, I came at OOP programming very differently than those who started with the latter. Harlan Mills repeatedly demonstrated the value of mathematically proven design, yet the business call for creating a prototypes eventually overwhelmed the idea in the industry. Agile methodology further allows the programmer to really skip design and figure the whole thing out later. Early Java libraries and even MFC went a bit overboard on the use of inheritance and that started to turn programmers off to the idea. Nowadays, I see more code written with a procedural ideal, but using objects. Component frameworks like Spring and entity frameworks like Hibernate helped feed the creation of discrete objects, instead of the OOP concepts that actual delivery the power. The fallacy of his argument is the "truth" that a strictly OO coded program is a tree with only descending communication. The whole concept is that any two objects can communicate, each deciding whether to respond or not. His arguments are what lead C++ to have friend methods. Encapsulation is broken for convenience.
@JordiFerran
@JordiFerran 8 жыл бұрын
+Bryon Lape , I agree with the video content and also with your comments. The idea of class instances containing references to other instances for communication is obsolete. In essence there is no need for a complex tree of instances that are limited in their ability to interact with other code. Because there is not a reference availble. The idea I used long time was to implement Runtime Contexts (thread, request, session, application instance, server side instance, cluster instance) which can be used by any class. So any piece of code can be easily accessed. Even a procedure (static function) might hide where the reference to the instance is stored for further retrieval. So omni directional communication is possible.
@troooooper100
@troooooper100 5 жыл бұрын
You can't design so future changes don't ultimately destroy decoupling.
@ianrust3785
@ianrust3785 2 жыл бұрын
exactly Dad Bryon Lape - exactly. Except one thing I'll add is that a cyclical object graph driven by some reactive data bindings is an industry standard at this point. Formula for making this video: come up with the worst OO design possible, use this to criticize the whole paradigm, ignore all problems in your alternative suggestions, rinse and repeat.
@XeenimChoorch-nx8wx
@XeenimChoorch-nx8wx 5 ай бұрын
8 years since this masterpiece. I’ve progressed with simple procedural code to the point where I physically cringe reading others peoples OOP code labyrinths
@gamefoun
@gamefoun 8 жыл бұрын
What am I doing here, I dont even know what object-oriented programming is
@purpleice2343
@purpleice2343 8 жыл бұрын
1. Women are objects. I am object-oriented programmer, I'd know.
@purpleice2343
@purpleice2343 8 жыл бұрын
Hey guys, we have an object that needs to be garbage collected before we get a segfault.
@balkan917
@balkan917 8 жыл бұрын
ahahahaha
@Zenas521
@Zenas521 7 жыл бұрын
+The Foun Neither do I and according to the video it would be a waste of time figuring it out. O well, I don't even program yet. I ordered a book on structured BASIC today. when I am confident in making 3D Games in Basic, I plan to learn C. When I am able to make AI for Arduino in my sleep in C, I plan to learn Varilog. When I am able to synthesis instincts for robotics in Varilog, I plan to learn Assembly. When I can wright a kernel in Assembly, Then I will consider myself a programmer. It all begins with Structured Basic and game programming.
@nameguy101
@nameguy101 7 жыл бұрын
that's the most retarded language progression i've ever heard
@charliegovenor3681
@charliegovenor3681 8 жыл бұрын
Video should be called OOPs, my bad.
@aneasyliving
@aneasyliving 7 жыл бұрын
lol
@sallylauper8222
@sallylauper8222 6 жыл бұрын
In your country, you like to create "object," but in Java's "Inversion Of Control" paradigm, object create YOU!
@katobytes
@katobytes 6 жыл бұрын
nice one
@vegardertilbake1
@vegardertilbake1 6 жыл бұрын
OOPs i did it again
@mikejohnstonbob935
@mikejohnstonbob935 6 жыл бұрын
OOPsy poopsy
@philipwest4553
@philipwest4553 8 жыл бұрын
I used to write Structured programs in PL/1 and in COBOL, then moved on to NATURAL, and then Visual Basic and Java, and finally Python. I use Objects sometimes, inheritance rarely, parameterised calls often. MY overall perspective is that functions/procedures need not be tiny (a screen or less) and that larger functions/procedures can serve a system very well. The trouble is that many of the junior programmers leap into complex object hierarchies immediately and because one must work with a team and many members of the team will be recent graduates with almost nothing but OO languages at their command systems get stuck in the morass of huge object hierarchies. It is not easy to avoid.
@koekeritisVideos
@koekeritisVideos 8 жыл бұрын
The thing whit OOP is that you need to use Objects when they are supposed to be used. You shouldn't overdo it, but you shouldn't write a whole game in 2 classes either.
@myztazynizta
@myztazynizta 8 жыл бұрын
Wire Rubbish Bin what about Traits?
@rethygy0410
@rethygy0410 8 жыл бұрын
So what would you say to somebody who is still studying? What to do to avoid that?
@philipwest4553
@philipwest4553 8 жыл бұрын
I'd say, learn Python. Program without objects for a while. Try objects when functions will not quite do what you need. Put emphasis on need. Objects are a fashion for many and lead to fashionable "design patterns" which often do not fit the problem one is seeking to solve. So resist the temptation to create complex object hierarchies when simple functions will suffice.
@JonesCrimson
@JonesCrimson 8 жыл бұрын
Python was my first language and I intend to return to Iron Python once I have enough experience with mainstream programming of Java and C# to accomplish my current goals. Kudos to you for your excellent tastes.
@DarkHorseSki
@DarkHorseSki 8 ай бұрын
I completely agree with this video! I learned structured programming and the issues with objects is figuring out the best design for the objects and inheritance, at the start. OOP code, almost always compiles into bigger code that runs slower.
@JeffBarczewski
@JeffBarczewski 4 жыл бұрын
Great job on this video. I have come to most of the same conclusions from my own experience. I now love a functional style where most functions are pure. Greatly simplifies everything.
@SaidMetiche-qy9hb
@SaidMetiche-qy9hb 4 жыл бұрын
True, the C way is almost perfect, but there are higher level features which would make it better. Generic code generation is a good thing to have which saves you a lot of grunt work and bizarre macros, the issue is the C++ way this is done through the template system is a bit limiting and there's no way for example to store templates as DLLs as they don't really "exist" as something in binary. That's the other thing as well the inconsistency and complexity in which the C++ ABI is setup.
@R3DT1D3
@R3DT1D3 5 жыл бұрын
I really don't see how huge functions with only comments to break up logic are any more readable and, more importantly, easily testable. I would much rather modular functions that can be separately tested and read quickly rather than just a huge column that I have to memorize the components of. Also why wouldn't you just put the same comments you suggest in your longer function before the function calls?
@paulbaker78
@paulbaker78 4 жыл бұрын
I watched the video with an open mind... but then he said we don't need functions, we need inline functions. No matter how "good" the code you write is, it will break at some point. I fear debugging an unnecessary inline functions as much as a dependency hierarchy that is too deep. Debug a 2000 line function and you'll see.
@sobreinquisidor
@sobreinquisidor 4 жыл бұрын
I disagree with the idea of long functions, we need a way to test our code by unit instead of a bunch of logic at the same time
@richardblain4783
@richardblain4783 4 жыл бұрын
It’s more readable because the sections are lexically contiguous, instead of being scattered around the source file. Wanting modular, separately testable functions is really just wanting the unit tests to automatically localize any bugs that occur. If the large function fails its test, you still know something’s wrong with it, you just have to manually examine more code to find exactly what. Writing code so that its tests can localize bugs is optimizing for the wrong thing.
@sobreinquisidor
@sobreinquisidor 4 жыл бұрын
@@richardblain4783 The separation into smaller functions does not imply testing all the little functions separately. A module can be broken in 15-20 functions instead of a huge pile of 2000 spaghetti code, and still you would test the same behavior. I'm working on a pile of functions that are thousands of lines long, with no tests. I can not refactor because well, there are no tests for the big function either. The auto refactor failed because it is written in the 'C' style with 'goto cleanup;' instructions. If the programmers had split the code into smaller pieces it would be easier to reuse the logic AND to write unit tests for them step by step instead of testing a 1000 logic (which is way beyond my timeline). While I agree with most of the things said in this video I'm totally against having long 1000 lines functions
@sobreinquisidor
@sobreinquisidor 4 жыл бұрын
Also, I think longer functions makes the code harder to read because it implies that all the details are in one place. You start seeing things at a high level of abstraction. Ex "makePayment" entangled with ultra annoying details like a for loop over char*. You start reading code that is like 4 levels of abstraction in just 10 lines. which makes the cognitive load way higher than just see nice separated subroutines.
@furrepanther
@furrepanther Жыл бұрын
I propose the idea that, in programming, there is no good to be found through inconsistency. Great job, Brian. I was in the business for over 35 years, and when OOP was first announced and I got my first taste of it, my thinking swirled around the realization that in the attempt to add clarity, OOP would add layers of complexity that have nothing to do with code functionality. I'm grateful to hear someone else take OOP apart on this basis. Thank you for this presentation.
@matthewgrotke1442
@matthewgrotke1442 7 жыл бұрын
I clicked on this video with skepticism because the video title is so "black and white". But unlike the title, the contents of the video is not so black & white. I think a lot of people who thumbs-down this video actually aren't watching the full thing. For your convenience, the 1st half-hour or so is all background and setup and analyzing the problems. He gets to his list of proposed best-practices (which are quite reasonable) at time index 34:46.
@nextlifeonearth
@nextlifeonearth 6 жыл бұрын
His evidence is anecdotal and many of the issues can be attributed to incompetent programmers as opposed to their paradigm. Also some of the advice is really bad and I hope I don't have to maintain code by people who took that advice to heart. Nested functions in favour of-you know- non-nested ones? Relying on comments? Like anyone writes those where they're needed. Properly named functions are the natural comments and make things more readable in the process. For the love of Zeus don't use large nested functions just because you "shouldn't be afraid of large functions". Give my scroll wheel a break.
@RipleySawzen
@RipleySawzen 5 жыл бұрын
The tl;dr of this video is no one even does the crap he says is bad about OOP. At least no one any good does.
@noahwilliams8996
@noahwilliams8996 5 жыл бұрын
He's saying OOP is bad. Sometimes things genuinely are black and white.
@Kinglink
@Kinglink 5 жыл бұрын
It's hard to take anyone seriously when they start with this is the best video ever. It doesn't help when having decades of dealing with people who say that and you find out most of them are blowing smoke. It ruins any attempt at trying to make a change when he starts with a victory lap.
@noahwilliams8996
@noahwilliams8996 5 жыл бұрын
@@Kinglink He didn't say it's the best video ever. He says it's the most important programming video you are ever going to watch, and he's right. The fact of the matter is that the majority is not always right. Sometimes all of society can collectively make a mistake, and that's exactly what Java, and OOP was.
@ixion2001kx76
@ixion2001kx76 6 жыл бұрын
This argument applies precisely to bureaucracy, it’s tendency to form chains of command, and why that doesn’t work so well.
@VndNvwYvvSvv
@VndNvwYvvSvv 5 жыл бұрын
Onus probandi
@edgeeffect
@edgeeffect 4 жыл бұрын
OOP is the ultimate bureaucracy!
@tiokio
@tiokio 8 жыл бұрын
I'll just grab some popcorn before reading the comments
@baruchben-david4196
@baruchben-david4196 6 жыл бұрын
Better grab a bucket.
@markteague8889
@markteague8889 6 жыл бұрын
Eatin’ some white cheddar flavored popcorn right now ... LOL
@NabsterHax
@NabsterHax Жыл бұрын
Yeah, as a computer science student that took the supposed rules of the OOP paradigm and the supposed virtues it provides, I often wondered as the things I programmed became more complex just how on earth people tolerated writing code like this. I could whip up something fairly complex quickly with a procedural approach, but trying to force everything into boxes I was supposed to keep separate just paralysed me and I spent more time shuffling those boxes around to keep things neat than getting stuff done. All I could think was "this is so much extra work, but I guess it's good practice. It'll be worth it in the future, etc." So, can't say I was particularly impressed when I started looking into real world OOP source code and found out none of these rules are actually followed and people just threw around references to objects that were specifically there to allow global access to references of virtually every other object in a giant clusterfuck void of hierarchy. What's the point?! Now I still have to micromanage state myself, because your code will let me do things I probably shouldn't do, but I have no chance of understanding what's actually going on because most of your code is still pretending to respect encapsulation and is just juggling references to references which is now nothing more than a maze between me and the actual data or functionality.
@coreyaruecker
@coreyaruecker Жыл бұрын
I’m quite literally the exact opposite. How do people not write code and keep things separate.
@NabsterHax
@NabsterHax Жыл бұрын
@@coreyaruecker Depends what your version of "keep things separate" is. I don't understand how people write code that seems to contain more boilerplate than logic. Like, imagine code that has a comment every other line explaining verbosely what the code's doing in plain English. (Obviously I'm not comparing OOP to comments in terms of functionality, just using it as an extreme example.) Do the comments hurt the functionality? No. Is it useful? Maybe to someone who doesn't know how to read the code itself, or gets lost in it without plain English. Is it pointless busywork at best or a cluttered mess at worst to someone who doesn't need the comments? Absolutely. To be clear again, I'm not trying to say OOP practices are like writing needless comments. I'm just trying to illustrate how it can sometimes *feel* to work in OOP code written with a level of granularity that feels unnecessary. Like having an entire directory designed to contain a single file because to some people that's "more organised," when to others it's needless convolution.
@harrywang4769
@harrywang4769 Жыл бұрын
A computer science student doesn't really know what a production code base looks like.
@NabsterHax
@NabsterHax Жыл бұрын
@@harrywang4769Oh I know. Only half joking when I say I realised I wasn't cut out for working in the industry when I figured out most of the job is about working at the level of the lowest common denominator.
@olabiedev5418
@olabiedev5418 Жыл бұрын
assuming people knowledge based on academic levels is just arrogance. maybe this person knows much more than you think@@harrywang4769
@mrpoundsign
@mrpoundsign 9 жыл бұрын
I love this discussion. It has cleared up some of my frustrations with large projects and OOP. I do really enjoy discussions like this. For the less academic among us, it would be nice if they came with lists of projects which exemplify the ideas being presented. It's fine and good to say how things should be done, but it would be nice to be able to look at examples (more complex then a "blog written in X") that show how these types of ideas would be implemented, well, in the real world. I would rather jump into some open source project that does things in a new way than try and write something new in a vacuum. I think this is where things like PHP or Ruby get their power -- they let those without the time to jump in and work on things. The example base to get things done is so large, it makes it easy to adopt, and you adjust to he flaws over time. It would be extremely bad for someone who already knows the problem space to start with these languages, but the fact is it's the least path of resistance. The power of rich examples should not be underestimated, if you want to see a real change in the landscape.
@fburton8
@fburton8 9 жыл бұрын
+MrPoundsign " lists of projects which exemplify the ideas being presented" Yes, please! That could be very useful.
@cutelittleball
@cutelittleball 8 жыл бұрын
+MrPoundsign Google "handmade hero", I think Casey Muratori probably likes a lot of the ideas presented here.
@Calmarius
@Calmarius 8 жыл бұрын
+MrPoundsign Look at the C code of any popular open source project. For example Linux kernel. To see show these ideas are implemented in practice.
@thescottyjam8906
@thescottyjam8906 3 жыл бұрын
What I like about this video, is that you really know your stuff. You're not someone who dipped into OOP, didn't like it, and posted a rant, rather, you've done extensive research into this field and have obviously put deep thought into everything you shared. I'll also note, when you first started talking about not being afraid of large functions, I was ready to pull out my own pitchfork. But then, as you started talking about breaking up that large function into sections, and making a bunch of small scopes within it, I realized the beauty of what you were proposing. Now, we have a single function we can go to to get a sense of how the logic flows, but we've also broken it up internally, so it's easy to understand individual parts of the function. That "use block" syntax would be really helpful for facilitating this sort of pattern. In fact, now that I think about it, I'm realizing that I've done this sort of thing before. I created a bunch of sub-functions within a bigger function to section it off, then I created a scope at the end where I invoked the different sub-functions and passed parameters around. I chose to put all of the data in a single scope at the end, to force each sub-function to explicitly list the parameters it needed. It wasn't allowed to just grab them from the enclosing scope. function doThing() { function taskA() { ... } function taskB(a) { ... } function taskC(a, b) { ... } { const a = taskA() const b = taskB(a) return taskC(a, b) } } A use-block syntax would have made this sort of thing much easier to do.
@pyhead9916
@pyhead9916 2 жыл бұрын
The exact same thing can be done with static methods in a Java OOP class.
@KebunH
@KebunH 2 жыл бұрын
The irony in that design (and I know its very popular in js) is that you’re basically emulating classes
@thescottyjam8906
@thescottyjam8906 2 жыл бұрын
@@KebunH I haven't seen this sort of design used in JavaScript, nor do I see the resemblence with classes (you can emulate what I did here with classes, but IMO, it's wrong to use a class when there's no need for state or dependency inversion is not being used). In fact, I rarely see people create new bare scopes using "{}". Did you by chance mistake that code snippet for the factory pattern, which I know is popular in JavaScript? At the end, I did this: { //
@KebunH
@KebunH 2 жыл бұрын
@@thescottyjam8906 its similar to object oriented programming in the sense that the way your function resolves to its final value is by using internal encapsulated (private if you will) state and functions, albeit only temporary. Its not the best example of class emulation indeed as its not a reference but a value thats returned, but it still does something very oop like
@thescottyjam8906
@thescottyjam8906 2 жыл бұрын
@@KebunH Ok, I see what you're saying. I will mention that this type of temporary encapsulation and state-management isn't unique to OOP or classes. You can take the purist functional language, like Haskell, and find this sort of pattern all over the place. People will use the "let-in" construct to declare functions inside of functions, use them, and return a final value. (and, indeed, the use of functions inside of functions is common in JavaScript like you said, it's just the specific use of the sub-scope at the end that I felt was unique). So, we could say that this pattern is emulating something you can do with classes. Or, perhaps, we could say that when people use classes in this way (where you create an instance just to call a single function on it and throw the instance away), they're emulating this commonly found functional pattern ;). Either way, it is an interesting correlation.
@rcottam
@rcottam 8 жыл бұрын
Fantastic. And brave. I started with BASIC and machine code (Z80) in the eighties. We knew freedom. I write apps for Android in Java these days. I hate Java.
@MrCmon113
@MrCmon113 6 жыл бұрын
Then do something else. Is someone forcing you to use high level languages with strict compilers?
@keris3920
@keris3920 6 жыл бұрын
I have my complaints about Java. For instance, not having unsigned primitives is almost a deal breaker to me. However, It has some amazing features that you can't get from other languages without convoluted workarounds.
@crankyinmv
@crankyinmv 5 жыл бұрын
I hate Java too. I was in a Java User's Group for a while in the 90s when it seemed like the language was changing every week. Then I found other there were other web programming languages like PHP which didn't require a half dozen XML files to write a Hello World.
@edgeeffect
@edgeeffect 4 жыл бұрын
@@MrCmon113 Yes, it's called having to go to work to earn money to feed your family and eating whatever shit your boss throws at you.
@jodazague8333
@jodazague8333 4 жыл бұрын
you can always use Kotlin, it's like java but better
@sjwarialaw8155
@sjwarialaw8155 8 ай бұрын
Completely amateur programmer here, trying to make a game with no education or experience coding. Most tutorials I find teach OOP, but for some reason I just can't adapt to it, its as this video says, anything with any complexity that needs multiple linked behaviors becomes an entangled mess, leading to paralysis. So now I'm just coding without almost any inheritance, it just seems more logical, any instance of something I create, I just store it everywhere it will be used, so when I need to use it I just know exactly where it is, plus every class when instanced I also put a reference to it inside a global dictionary, so no matter what, I always have a way to acess it easily. Not sure if I'm doing this correctly, or if this is considered procedural, but its flowing much better. Loved the video, its good to know that there are other options other than OOP.
@darkengine5931
@darkengine5931 7 ай бұрын
OOP is often especially disastrous for video games where you have very complex interobject interactions. At the end of the day, all every video game does along with every single software that has ever existed does is input, output, or modify data. Also OOP can trick you into thinking that you need a new type for every new concrete noun, as though an Elf must be a different data type than a Dwarf rather than just having a data field to identify what type of creature they are. That will skyrocket the size and complexity of your codebase very rapidly. Model your designs with data as much as possible and your life will become so much easier. Object-oriented polymorphism is only useful when you need to branch between operating on things that require very different data, not things that can all be modeled with the same data.
@xileets
@xileets 5 жыл бұрын
I was a Philosophy major first in college, then changed to Comp Sci. The part about 'abstract' actually made me laugh, because I literally thought that every single day.
@unmellowthegamer8946
@unmellowthegamer8946 5 жыл бұрын
my thought though is "abstract" means abstract to the computer, not the human wasm is abtract because it's not like the real machine
@mondoXpeanut
@mondoXpeanut 5 жыл бұрын
@@unmellowthegamer8946 Abstract because you're extracting the core shared essential process from the specific implementations - just like abstract images aim to capture the core essence of an image, or a set of images. The word means exactly the same thing in both contexts. The language that surrounds programming can be daunting at first, but if you apply some rigour to your efforts to apprehend the meanings and purpose behind the names chosen for concepts it begins to make sense. I found such an aha! moments to be real breakthroughs in both my comprehension and my programming capabilities.
@djwillcaine
@djwillcaine 5 жыл бұрын
The definition of abstract is "existing in thought or as an idea but not having a physical or concrete existence." This perfectly described what OOP attempts to achieve. I dont see the problem.
@inafridge8573
@inafridge8573 5 жыл бұрын
It still has the same core meaning in both philosophy and programming but usually it's something that takes a lot of thought to make intuitive in the former, yet it's something that makes intuition easier in the latter.
@MultiPetercool
@MultiPetercool Жыл бұрын
Many portable operating systems have something called a Hardware Abstraction Layer. Most folks I knew called it a Hardware Obstruction Layer. 😉
@georgesmith9178
@georgesmith9178 5 жыл бұрын
The insights are well explained and point to a number of OO programming deficiencies I have been pondering over the years. Some of the arguments suffer from biases, though. For example, the argument that we don't really control state in an object of a particular class is a bit one-sided. True, as we give access to underlying state to more objects of other classes, we tend to weaken access control. However, this can only happen if we are undisciplined about it. As a general rule, access to a particular part of an object's state (member variable in OO terms) should only go through its accessors. That way we can effectively control the number and types of state mutations. What happens in practice is a different story - some undisciplined developer will go and change a member variable in a method where it is not supposed to be changed - without calling the proper accessors (setters). In this case, it is not the OO principles that don't work, it is the developer who has chosen to break them. Another example is code reuse, which the author does not talk about. OO substantively reduces the cost of a project because a developer can reuse entire hierarchies, sub-hierarchies, or compositions of objects (graphs). Even if we take this to the procedural level, for example when we decide to create a families of algorithms by breaking a the main pattern into steps and reusing some or all of steps in an OO manner, it is clear that the OO saves time. OO patterns greatly assist in achieving this goal - Strategy and Template patterns in this case. Even with these two points in mind, I believe the video brings a lot of value. That's why I voted it up.
@ytechnology
@ytechnology 5 жыл бұрын
I've found reusing entire hierarchies happens less than advertised. Sharing within a department is possible. But sharing across company departments doesn't work out so well because the needs, while similar, are different enough. Yes, they could subclass and customize to fit their requirements, but by doing so, they've inherited a lot of baggage.
@billowen3285
@billowen3285 3 жыл бұрын
This guy's voice makes me want to believe him
@SlashKilll
@SlashKilll Жыл бұрын
thank you so so much! as someone learning OOP this video was so helpful!
@diegotorres8952
@diegotorres8952 4 жыл бұрын
Ahh the internet... the place where if you look hard enough you'll find someone who will agree with anything you can come up with. No one programming paradigm is perfect or suitable for all tasks. If you need raw performance speed you might use one paradigm, if you need to write a proprietary API you might use another; or you can do something in between. It is called "the right tool for the job".
@omniphage9391
@omniphage9391 3 жыл бұрын
performance rarely does come into it, cmpilers are smart enough these days that this doesnt matter unless you have a really hard problem and at that point no paradigm will save your ass from having to think
@JathraDH
@JathraDH 3 жыл бұрын
@@omniphage9391 Yeah, right. This is why you now need a 5ghz machine to run a web browser. Keep thinking "performance rarely comes into it" like the rest of industry, its worked great so far. Also, compilers are dumb as fuck. Try actually looking at some of the shit ASM they output. I would rather have a "stupid" compiler from the 90s literally any day over the BS compilers pass themselves off for these days. At least then I am not spending 95% of my time stressing over weather or not what I am writing is "undefined behavior" or not.
@omniphage9391
@omniphage9391 3 жыл бұрын
you spend 95% of your time stressing about getting your code to compile? I dont know what to tell you. I hope you get better soon.
@JathraDH
@JathraDH 3 жыл бұрын
@@omniphage9391 Compile? No, of course not. Do you even know what undefined behavior is?
@JathraDH
@JathraDH 3 жыл бұрын
@@omniphage9391 I am also very confused at both of your replies because they both have nothing to do with what I was originally talking about. Undefined behavior is when you tell the compiler to do one thing and it does something entirely different. The code compiles, it executes, but its not guaranteed to do what you tell it to do. Modern smart compilers don't actually listen to you, which is the problem. They take what you tell them and consider it a "lose guideline" then output something that's often entirely different than what you tell them to do, and sometimes with an entirely different result or behavior. Thus, these days you are always trying to avoid doing something that will make the compiler shit itself rather than just focusing on getting the job done in an optimal manner. I don't want to have to trick the compiler into doing what I want it to do, I just want it to do what I tell it and not have it second guess me and think it knows better.
@leocomerford
@leocomerford 5 жыл бұрын
7:56 You shouldn't take as a reliable guide a history of why (mainstream) OOP became mainstream which focuses on the rise of Java but (AFAICT) doesn't mention Smalltalk or C++ at all.
@nancykerrigan1335
@nancykerrigan1335 4 жыл бұрын
@Shailendra Nath I'd argue that if a function doesn't have a meaningful association with a data type and you're using OOP, then the mistake was using OOP for that task. That doesn't invalidate the paradigm, it just means it's not the holy grail. And to be clear, there is no holy grail. That's why these types of videos are always hilarious. They operate on the premise "this isn't useful for me, therefore it's wrong and can't be useful for anyone". The bottom line with OOP is that it isn't a set of specific patterns and techniques: it's an approach to object modeling. If the domain you're working in doesn't demand that kind of modeling, the fault is yours for selecting the wrong too. His video could have just as easily been titled "Hammers are bad and here's why."
@BaalTomekk
@BaalTomekk 4 жыл бұрын
@@nancykerrigan1335 My CD's always break when I try to play them with my hammer 😢
@pip0109
@pip0109 4 жыл бұрын
@Shailendra Nath this is so true but does not render OOP any less valid approach
@jumpman120
@jumpman120 4 жыл бұрын
+Leo Comerford Because nobody care about smalltalk fucking morons so he criticize what OOP means for people and why it is problematic !
@disecke
@disecke 4 жыл бұрын
@@nancykerrigan1335 I think your point is well taken, but actually this video is a bit more nuanced than you seem to give it credit for. I think Brian Wall would actually agree with you 100%, and that is why he suggests using some encapsulation, but simply at a higher level of granularity - around the module level, or around cases when the class (data+actions on that data) are actually logical. What he is suggesting is exactly what you suggest - its not the holy grail, and attempting to square every circle into OO will often create more problems than it solves.
@homeXstone
@homeXstone 8 жыл бұрын
if a video itself states "this is the most important video you will ever watch" (twice) it's already super suspicious
@homeXstone
@homeXstone 8 жыл бұрын
so.. i did get some way into the video. what i found strange is that first you state that oop shouldn't get all the credit for java has done right since a lot of it is not fundamentally about oop but then you go on to criticise oop for some things which are not per se a problem of oop but rather how things are done in best practice. i am currently at 22:17 and you just complained about shared state and how you shouldn't pass references to other objects (although i dont see why this is a problem when done well. sometimes shared state can help coordination of classes). you could just structure your oop code to always just pass copies of your objects like you do in functional programming. anyways, i wish you had used a different intro for your video, as it doesn't suggest that anything of non-subjective nature is going to follow..
@carsonfujita-turnbull4549
@carsonfujita-turnbull4549 4 жыл бұрын
@@homeXstone Joshua Bloch Effective Java third edition. Good read.
@formyeve
@formyeve 9 ай бұрын
Amazing presentation. You've done an amazing job voicing many of the concerns I had writing oop, and i love the guidelines you've outlined towards the end of your presentation.
@iamamish
@iamamish 3 жыл бұрын
I remember writing code in the early 2000s and I felt like that was peak OOP. Nobody was writing code, they were tying together 30 different frameworks that were heavyweight as hell. I thought it felt way over-engineered to me. I'd much rather read tightly written and organized procedural code.
@CarnesSurefire
@CarnesSurefire 2 жыл бұрын
I love debugging everyone's personal sort algo.
@iamamish
@iamamish 2 жыл бұрын
@@CarnesSurefire Maybe I'm misunderstanding, but I'm not suggesting you shouldn't use libraries. I'm not really even against frameworks, per se. There was just a trend toward bringing in every framework under the sun, then swapping them out every 6 months or so.
@camthesaxman3387
@camthesaxman3387 2 жыл бұрын
Nowadays, the trendy thing is functional programming which is really easy to test, but is very poor with performance.
@swapode
@swapode 2 жыл бұрын
@@CarnesSurefire Libraries are great. Frameworks suck.
@camthesaxman3387
@camthesaxman3387 2 жыл бұрын
Even today, we have these web frameworks like React that perform like dogshit. People don't want to deal with JavaScript and HTML, but they will gladly deal with a framework reinventing the wheel.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Brian Will
Рет қаралды 2,1 МЛН
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
UFC 310 : Рахмонов VS Мачадо Гэрри
05:00
Setanta Sports UFC
Рет қаралды 1,2 МЛН
Леон киллер и Оля Полякова 😹
00:42
Канал Смеха
Рет қаралды 4,7 МЛН
2024's Biggest Breakthroughs in Math
15:13
Quanta Magazine
Рет қаралды 433 М.
Is OOP EVIL??? Reacting to my favorite dev Youtube video
54:49
Theo - t3․gg
Рет қаралды 132 М.
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Object Oriented Programming is Good | Prime Reacts
31:30
ThePrimeTime
Рет қаралды 329 М.
You dont know OOP
50:48
ThePrimeTime
Рет қаралды 371 М.
Object-Oriented Programming is Garbage: 3800 SLOC example
52:48
Brian Will
Рет қаралды 235 М.
Object Oriented Programming vs Functional Programming
18:55
Continuous Delivery
Рет қаралды 764 М.
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 928 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 980 М.