Object-Oriented Programming is Embarrassing: 4 Short Examples

  Рет қаралды 2,109,987

Brian Will

Brian Will

Күн бұрын

Пікірлер: 6 700
@xiphaliadanlianthol6715
@xiphaliadanlianthol6715 3 жыл бұрын
This isn't an argument against OOP it's an argument against making extremely complicated solutions to trivial problems. Classes are powerful but not always necessary.
@nice_sprite5285
@nice_sprite5285 3 жыл бұрын
The fact that people respected enough to be giving talks are making these same decisions *across different talks* and teaching them to younger devs kind of does point out something against OOP. OOP is being taught as a tool to solve all problems when it is not necessary, and to me that points to some disconnect between the problem at hand and the tool people use to solve it. And they *will* use the tool they are told to use, especially if its the only thing they have ever been told about. If you were taught from day 1 that *everything* is an Object, then your entire problem solving toolset is based in that idea. OOP and the people teaching it are not teaching how to solve problems, they are teaching how to use OOP. Obviously OOP has uses, and plenty of software is written using that paradigm, but the OOP *mindset* has a tendency to leak its gooey goop into places it shouldn't go.
@alexho5769
@alexho5769 3 жыл бұрын
@@nice_sprite5285 True. And I believe FP is the solution. Sum type, typeclasses and HOF are far superior than whatever those factories and singletons are.
@nice_sprite5285
@nice_sprite5285 3 жыл бұрын
@@alexho5769 I havent experimented much with FP, but from what little I do know about it I think it definitely provides a good way to solve problems with good perf and design. I've had the thought for a long time that what we do in OOP-land seems sort of silly and masturbatory at times, but only more recently had the chance to reform the way I write code to be better. Would you say rust's functional features are a good way to start writing FP? Or if I wanted to learn FP, would i be better off with a "true" or "pure" FP lang like Haskell? Your comment is making me consider branching into that domain a bit
@alexho5769
@alexho5769 3 жыл бұрын
@@nice_sprite5285 Yes I do believe rust is fantastic. It's not pure FP but it does provide a sophisticated type system and FP-like features such as pattern matching and traits, and it's bloody fast ;). I'd say if you want to build something "real" and you're not looking to learn the deep theories behind FP, definitely start with things like Rust, Scala or OCaml. And if you're still interested after that, it's also very beneficial to learn Haskell since it's essentially the Occam's razor of functional languages (but it's harder to build something "real", like a REST API). And if you're still interested after learning these, it's also fun to dive into the deeply "nerdy" aspects of FP by learning languages (proof assistants) such as Coq, Agda and Lean (but these are highly specialised languages that will definitely require knowledge of Haskell), there you'll learn about type theories and the art of proving program correctness. Note that these are *definitely* not required to understand FP. Hope this comment helps :)
@CreepSoldier
@CreepSoldier 3 жыл бұрын
i think the point is that the Bad OOP is the one beeing taught in classes and the one mostly found in programs
@Vixikats
@Vixikats 4 жыл бұрын
Actual title: "Overengineered solutions to simple problems are bad."
@ZeruelB
@ZeruelB 4 жыл бұрын
And its what happens in real life. Requested is a Giant Featureset where, after everything is finished and released etc. you realize none of the features are actually ever used or used in the way they should be used. Its like "Hey, we want giant logs displaying everything" and then after a year you see those logs with just thousands upon thousands of exceptions. Turns out noone reads the logs anyways, but its ok to waste time on those logs. not only your time but also CPU/IO etc. time...
@deanolium
@deanolium 4 жыл бұрын
The problem is that the strengths of OOP require non-trivial examples -- however that's almost always out of scope of KZbin videos and presentations. So, yeah, of course they're going to find overengineered solutions. Like, no sane software engineer would go that approach for merely flipping a coin. However, once you add in needs to extend the game to use other types of 'coins', maybe more players, maybe changing the AI for each player which could be dynamically instanced -- say you want it to become more sophisticated over time - then an OOP approach begins to make sense. But it's all wayyyyy beyond the scope of these demonstrations.
@ifstatementifstatement2704
@ifstatementifstatement2704 4 жыл бұрын
@@ZeruelB Yeah lol, crazy.
@Austin1990
@Austin1990 4 жыл бұрын
deanolium In the flipping game video, I believe it was specified that the code was overkill but merely an example of the principles.
@MrAST4R0TH
@MrAST4R0TH 4 жыл бұрын
He is missing the point. Object oriented code is not about classes, data encapsulation, and inheritance. At its heart, is all about interaction and message passing between replaceable entities representing traits of the system, each implementing public interfaces. Therefore, object oriented code is all about interfaces compliance, polymorphism, dynamic binding, delegation, and composition in a safer and cleaner way, leading to greater flexibility. Good object oriented design relies on patterns to allows one to delay critical decisions, do interface implementation swapping (thus reducing risk o vendor locking), and to add new features with minimal work, therefore is suited for big and complex systems, when you may not know ahead of time what the final features are.
@ObiWan80186
@ObiWan80186 3 жыл бұрын
I've been programming for 44 years. Classical, non-object oriented (mainly years ago) and fully OOP. Currently, I manage a system that was 1.5 Million lines of code that I have down to 750,000 lines (that's HALF) - all thru applying OOP techniques. You have to use the right tool for the job (ask any handyman, mechanic or woodworker). OOP isn't the answer in trivial programs. But in big systems and systems that have to adapt to new business rules, it's invaluable. To just say OOP is bad is a total misunderstanding of OOP. You have to LEARN the tools - not just dismiss what you don't understand. You need to study the OOP subject further before you dismiss it.
@JohnCorley13
@JohnCorley13 3 жыл бұрын
OOP also isnt the answer in a lot of other things that are insanely popular and useful related to AI/ML. I wouldn't call that trivial. As far as enterprise applications...I get your point. But to call anything else trivial? And also...what would the architecture look like in F# for instance? Still a million lines?
@MaxRunia
@MaxRunia 3 жыл бұрын
What you say about OOP may be true, the problem is not every software company is made of engineers with 44 years of experience. The OOP I've seen devs write is not great. Mainly the cognitive complexity is high. That's the real issue with OOP IMHO. It's complex. There are still to this day some OOP patterns that simply don't make sense to me. The benefits of which I just haven't seen yet. To me clean code is understandable and testable. I think OOP with DI is great for testing, so it nails one of the requirements.. but it's not always very understandable. Maybe someday when I've been in the industry for as long as you have I'll circle back around and enjoy OOP
@JohnCorley13
@JohnCorley13 3 жыл бұрын
@@MaxRunia excellent point
@theRealRindberg
@theRealRindberg 3 жыл бұрын
You're right. Use the right tool for the right job. But he has a point, to many people think that oop is the best tool for everything. Even Bjarne Stroustrup have said that oop is a bad choice in may cases.
@JohnCorley13
@JohnCorley13 3 жыл бұрын
@@_mr_andersson by most you mean most in python? While those libraries are certainly constructed that way for convenience, I haven't really seen any data scientists build their data pipelines I'm an OO way much (in their day-to-day) work. What I've seen and used mostly ends up being a mix of functional/array or procedural
@Scarhwk
@Scarhwk 6 ай бұрын
Half the commenters seem to think that "object-oriented programming" means "code that uses classes." Brian Will was pretty clear that he wasn't saying "don't use classes." He could have been a little more explicit about this, but I think he defines OOP as having three main properties: (i) all of a program's functionality is contained in class methods; (ii) all of a program's data is contained in class instances; and (iii) class properties are all private, or predominantly private, so that classes can only ever directly manage their own internal state (i.e. classes are used to "encapsulate" state). Two things about that: First, that's a pretty reasonable way to define OOP. It's pretty much what I learned in university when they were teaching Java and C++. Second, defined in that way, OOP absolutely is terrible.
@mattjones1154
@mattjones1154 4 жыл бұрын
“Polymorphic dispatch in this example is overkill, therefore all polymorphic dispatch is bad.” This video should just be called “Bad code is bad.”
@JellyMyst
@JellyMyst 4 жыл бұрын
Object-oriented programming produces bad code.
@rosek6585
@rosek6585 4 жыл бұрын
@@JellyMyst Most of the time... yeah... BUT you can write even more shitty oo code if you try.
@JellyMyst
@JellyMyst 4 жыл бұрын
@@rosek6585 Oh, trust me, I don't need to try to write bad code. The point, though, is that object-oriented programming produces bad code more often than some alternatives when you're trying to write good code.
@ptechlead
@ptechlead 4 жыл бұрын
There are a lot of really bad develops, OOP enables them to cause too much damage, like giving a gun to a retard. On the other hand, good programmers can (almost) do perfectly well without oop. Maybe only people with 5+ YEARS of solid C programming experience should be trusted with OOP
@Frozander
@Frozander 4 жыл бұрын
@@ptechlead I agree, most devs these days should not be able to write code. They are way too careless with their code and produce problems more often than the rest.
@alexclark6777
@alexclark6777 4 жыл бұрын
"Hammers are bad because not everything is a nail; here are some examples of people hitting screws with hammers to prove why hammers are terrible."
@niccster1061
@niccster1061 4 жыл бұрын
LOL
@PetersFXfilms
@PetersFXfilms 4 жыл бұрын
@@niccster1061 Wow, this is the perfect metaphor.
@youKnowWho3311
@youKnowWho3311 4 жыл бұрын
Always be on team Depends...... I start every conversation with this caveat.
@niccster1061
@niccster1061 4 жыл бұрын
@BringerOfTheTruth so not only did you not make any points. But you made a blatant assumption and then used THAT to claim he is unqualified to talk about this. I dont give a shit WHICH paradigm is better, your comment was probably the most retarded argument ive ever seen. Like at that point why dont you just say "OOP bad FP good I'm right youre wrong and unqualified cuz i say so. Bye stupid fanboy kid".
@PetersFXfilms
@PetersFXfilms 4 жыл бұрын
@BringerOfTheTruth Are you really suggesting that we should never use object oriented programming?
@InfallibleCode
@InfallibleCode 6 жыл бұрын
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand. " - Martin Fowler
@1Maklak
@1Maklak 6 жыл бұрын
That's the guy who wrote "refacotring, improving the design of existing code". I've read it and some of the improvements make sense, but others are just cutting code into confetti, like extracting methods that you only use once.
@13b78rug5h
@13b78rug5h 6 жыл бұрын
​@@1Maklak It increases readability and you lose barely any performance. Most code can be extracted to be a method which has a meaningful name and purpose, which makes your code much more readable and understandable. It also makes sure that you do not have to know the details of what the method does unless that specific method is relevant to you. Extracting pieces of code to a method which you only use once reduce complexity and the amount you have to understand about the code.
@1Maklak
@1Maklak 6 жыл бұрын
@@13b78rug5h To me it decreases readability, as described in this video. I prefer having a pretty long, but segmented function. After method extraction, I get a bunch of smaller function scattered around and possibly even in their own classes. But like I said, much of Fowler's advice is sound, for example that you can make small incremental changes to existing code as you go along doing other stuff with it.
@Alx-gj2uz
@Alx-gj2uz 6 жыл бұрын
@@1Maklak smaller functions are easier to test than larger functions in my opinion, thats also a reason for single responsability design. But I like to see other opinions as well as this video. Rethinking the way you code and listen to others is always usefull. I also think in Oo you can end up really fast in overcomplicating things.
@1Maklak
@1Maklak 6 жыл бұрын
@@Alx-gj2uz Ah, right, that's true. I never had to do unit testing. It may be that the way people think is wired in different ways, so different approaches are "natural" to different people. For example some people are good with mathematical formulas, while others look for a geometric interpretation, so there's that. I also got reasonably good at procedural style in C before being forced to learn object-oriented (and even then it still didn't make sense to me to put every function inside an object). Some things, like making lots of small classes, design patterns and self-commenting code newer made sense to me, so I was wondering why and then I saw this guy's lectures and everything he says works for me. Those objects, constructors, inheritance, factories and all that other stuff is mostly bloat and noise code that gets in the way of what I'm trying to do. I can put some data and functions manipulating that data together for encapsulation and separation of concerns, but it will be large classes with long and often static functions and it just works. I also usually end up with an "Util" class that's a namespace for static functions that don't have a good place to put them in. Funny think is, when you get people like me and OO people working on the same project, you'll end up with a refactoring war.
@deckard5pegasus673
@deckard5pegasus673 Жыл бұрын
I could give 100's examples, since I have been working as a developer for over 25 years. But one that pops to mind was back in 2003 or 2004, in a start up company, we developed an extensive video processing, video cataloguing, and video emission platform and the boss wanted a plugin vumeter for the sound volumes for one of the video players. He assigned the task to someone of the team. He took about 2 months to design the complex vumeter with a queue system for the sound samples, etc.etc. and of course all done in OOP C++. The team member was also working simultaneously on other projects, so he did not spend the entire 2 months on just the vumeter. Even after this, the vumeter never worked properly, and was overcomplex and difficult to debug. The volume levels were all over the place, and obviously did not match the volume in realtime of the video. Even so the boss alloted a big chunk of resourses(2 months of one of the team members) that he was going to ride the sinking ship to the bottom of the ocean, and just kept trying to fix the vumeter to no end. I secretly took some of my own time, and wrote a vumeter dll in pure C using direct win32 calls(to capture the windows of the app, draw,etc..) and no queue, and no OOP. My vumeter when compiled was 64 kilobytes and had no external dependencies(and probably was even smaller but Windows has a cap due to alighment on PE sizes) My team member's vumeter was well into the megabytes and had various dependencies on third party dlls, sdks, etc. In the end, my vumeter worked perfectly and the company had to use my version. My boss took me to the side, and was extraordinarly pissed off at me, almost screaming, yelling: why the hell did you make a vumeter, taking time you shouldn't or you could have just helped with the main vumeter project etc.etc.. I have never seen him so mad. Even so the main vumeter project was completely trashed and they only used mine for years to come. The reason I did not participate in the main project, and just went off and did mine, is that every time I spoke up about overly complex code, and OPP, I was pushed down and ridiculed directly, so the was no reason to argue with people and their devout dogma, I just did what needed to be done.
@Jedimaster36091
@Jedimaster36091 Жыл бұрын
The problem seems not to be with the OOP vs. procedural approach, but with the architecture and design. You could very well end up with a bad vumeter written in C or any FP language. The people deciding on the technology and design are the issue, not the technology.
@siddharth8184
@siddharth8184 Жыл бұрын
Crazy part is that instead of rewarding you, he went off at you
@ShazeAn
@ShazeAn Жыл бұрын
That's exactly what jealous boss does, a good leader doesn't. I guess thats how boss vs leader is differentiated.
@niclash
@niclash Жыл бұрын
@@ShazeAnIn my first job (I just turned 20) I criticized the boss's "3 years in basement" work on a "execution environment" (executing our own programming language in industrial automation equipment, programs downloadable over serial comms) of a new breed of PLC system. "Shut up. You are new here, and besides it exists and it works!". I convinced the other two 20 year olds that what I had in mind was superior, and I argued "let's remove his main argument [it works] by also having 'it exists and it works'". So, on a weekend from Friday to Monday morning, we made a byte code interpreter from scratch, faster, smaller and easier to maintain (all in assembly, btw). On Monday, we assumed that we would need to "stand our ground" to convince the boss. I came a bit a late, and urged the others to "let's go and talk to the boss", and got the answer "We already did. It took less than 5 minutes and the only thing he said was 'Ok. Now finish it.'". I have heard that, that effort was replaced ~25 years later with new implementation in C/C++.
@isk8atparks
@isk8atparks Жыл бұрын
lol, this is why i never just do something that my boss didnt ask for. Im not getting recognition for it, and the extra effort is just going to some big corporation who really couldn't give a shit about you anyway. Why step out of your bounds to help a meaningless project for people who are more concerned with paradigms and the micro management of its employees just to risk your own ass for almost 0 benefit
@BlueBetaPro
@BlueBetaPro 6 жыл бұрын
Object-Oriented Programming is not some omnipotent tool that makes every bit of code it touches better. OOP is just a tool in your toolbox of patterns. Saying we shouldn't use a pattern is as wrong as saying we should use it everywhere. Forcing any pattern is generally not a good idea except it can be a good learning experience. Use the pattern that matches your problem.
@majedhk5460
@majedhk5460 5 жыл бұрын
Captain R. WITTEREL can u plz tell me the story for ur profile pic i seen it every where ?!!
@BlueBetaPro
@BlueBetaPro 5 жыл бұрын
@@majedhk5460 Oh yeah yeah. kzbin.info/www/bejne/eWHWm6aJpp1nh7c
@weneedtogoback8553
@weneedtogoback8553 5 жыл бұрын
Tell that to Ruby
@asdfdfggfd
@asdfdfggfd 5 жыл бұрын
Couldn't disagree more. OOP is actively terrible, and is never a good idea, and should be avoided. Even in cases of ADT's. Especially in cases of ADT's where OOP propaganda makes ADT's nearly impossible to maintain... No seriously, try writing a gui dialog, the best use case of OOP, it is easier to to with procedural code, even though OOP has "solved" this issue for 30 years. OOP has basically failed to deliver even in its most fundamental use cases.
@ilyasuzdalnitski7479
@ilyasuzdalnitski7479 5 жыл бұрын
There are no use cases for OOP, period. It only makes the problem more complicated by building a tower of useless abstractions and by forcing everything to be an object. In my experience, people who are claiming that OOP has any benefits at all simply didn't have enough exposure to the alternatives (i.e. functional programming)
@arturk9181
@arturk9181 8 жыл бұрын
I do like object but i treat them as a feature of a language rather than "EVERYTHING MUST BE AN OBJECT!"
@SteveM000100
@SteveM000100 8 жыл бұрын
+suckmynobs static!
@KilgoreTroutAsf
@KilgoreTroutAsf 8 жыл бұрын
+Artur K Here's a sane person.
@Tudrum2
@Tudrum2 8 жыл бұрын
+suckmynobs Actually not quite, every type is based on Object, but Java is based on "Everything is object" principle more than C# is. Look at the difference in "events" in Java and C#.
@Tudrum2
@Tudrum2 8 жыл бұрын
+suckmynobs Ou, and second thing, if everything is based on Object that will make life easier when you use Reflection
@HairyPixels
@HairyPixels 8 жыл бұрын
+Artur K Yes thank you! I use Pascal for larger projects and it's entirely common to mix procedural with OO when a class isn't needed.
@Zachucks
@Zachucks 4 жыл бұрын
I'm not sure you can just say "OOP is bad", the examples you are showing are a bad use of OOP. Doesn't mean that the idea is just null and shouldn't be used.
@swapode
@swapode 4 жыл бұрын
OOP has very fundamental problems, so much so that OOP best practices (composition over inheritance, dependency injection, ...) can pretty much be boiled down to: "Don't use all the cool features that OOP promises on the blurp". What most people actually find useful about the whole OOP idea is little things like data carrying its own function namespace - foo.doSomething() as opposed to someNamespace.doSomething(foo). And OOP isn't even particularly good at the things it's designed for, for example an ECS is much better at sharing abstract behaviours over different "classes" of "objects" and doesn't require constant reimagining of a class hierarchy when new aspects are implemented. And it'll probably run faster. Maybe the biggest sin of OOP is that it pretends that elegant code is the goal of software development while making writing elegant code incredibly hard (if not impossible, because all that complexity is actually only elegant within an OOP context). But I've been there, I also tried to defend OOP back in the day. In fact it took me a deep dive into Rust to finally cure me completely.
@Alejandro388
@Alejandro388 4 жыл бұрын
@@swapode i did OOP for over 30years (since the times of GangOfFour), still using it for my largest project yet - over 250k LOC of java now, and have no idea what you are talking about here, care to give specifics? Been using functions and procedures since my school days via pascal and assembly, but once discovered OOP, i never looked back, because disparate functions accessing any data willy-nilly is the opposite of elegance, unless you're hacking some adhoc 100-line-long shell scripts. For how long have you personally used OOP, how large/complex the project was and how did you learn OOP?
@codekomali1760
@codekomali1760 4 жыл бұрын
@@Alejandro388 for most object oriented approaches we figured out ways to write cleaner code. For example, we want data to be data, so we have DAOs for that and we want classes which does nothing but computations/utility functions (they are the classes with mostly static methods, if they are associated with some resource+state we might go for singleton pattern, etc etc). But, if you pause for a minute, zoom out and take a look. When I see a dao, isn't that just a map with key value pairs. When I see the classes with just a bunch of static methods, isn't that just a collection of nice functions organized inside a namespace. Unrestricted bad OOP design leads to spaghetti code, so we have design patterns (constraints for not writing bad code). Brian is just trying to highlight that (but the language could have been better). - (new to Clojure and loving it)
@Alejandro388
@Alejandro388 4 жыл бұрын
​@@codekomali1760 initially i was hyped about design patterns, but in practice i never really think in terms of them - but very likely i end up using them or variations of them without even knowing. As for DAOs and statics - these are fine, they just prove how you can still do functional/procedural stuff in OOP languages (but you cant do OOP in functinal langs like Clojure), but in my own practice, i rarely need to resolve to such non-OOP technicalities like DAOs, most of my business-case code is nicely encapsulated into classes. I do have buckets of utility functions as statics and some generic-data sturctures for ad-hoc reuse, some nice generic lambadas, and i love them and use them, but they're just small part of the big cake, which is largely driven by OOP
@pip0109
@pip0109 4 жыл бұрын
You cant say OOP is BAD but you can say procedural is BAD .. the code he suggests is close to unmaintainable!
@DevideNull
@DevideNull 3 жыл бұрын
Some people may fear they will lose their jobs if the code is too easy to understand.
@alejandrodelabarra2838
@alejandrodelabarra2838 2 жыл бұрын
Obbb-vio-us. I insist: Classes are made to HIDE what is behind.
@David_Raab
@David_Raab 4 ай бұрын
Now they train there AIs to create bad OO code.
@jsnadrian
@jsnadrian 4 жыл бұрын
if this had the title "Roasting Bad OOP", you'd have 100% likes and an empty comments section
@NoeLPZC
@NoeLPZC 4 жыл бұрын
I wouldn't call it "bad OOP", they're just using simple programs to demonstrate the principles. Of course if you JUST wanted to make these programs OOP is overkill, but that's missing the point.
@benhardwiesner6963
@benhardwiesner6963 4 жыл бұрын
This title made soooooo many people "hate" him by giving a view, 4 comments in heated discussions and even a rating..... This followup wasnt made to prove a point, but to capitalize on the topic that made his channel explode once already
@XfStef
@XfStef 4 жыл бұрын
All OOP is bad. It's bad conceptually. It's bad when you implement it. It's bad on performance and code readibility.
@gwho
@gwho 4 жыл бұрын
@@NoeLPZC exactly. so much waht you said.
@christophsiebert1213
@christophsiebert1213 3 жыл бұрын
@@XfStef Why performance? OOP is more or less a higher level abstraction of procedural languages like C. I always say that C can just as well be object-oritented, since classes are nothing more than a bit of memory holding data, and then many functions taking in the reference to that memory as the first argument. Features like accessors, interfaces, or generally not having to manually pass the reference to that bit of data as the first argument to begin with are all abstractions of the needs one gets when the code base gets too large and follows such patterns. OOP is not a hell spawn, but it's also not an all hail. Understand what the benefits of OOP are and stop being toxic. Btw, in more complex business logic, OOP tends to be more readable than procedural on average.
@rhymereason3449
@rhymereason3449 3 жыл бұрын
I wrote code professionally for 40 years and this type of argument is as old as Fortran. IMHO, OO has its place for certain classes of problems - modern GUIs for just one example. But as with every "new" programming paradigm that comes along there are people who embrace it and promote it as the one and only "truth". The same thing happened with Dijkstra's "Goto less programming"... while structured code is generally a very good idea, there are times when a simple branch instruction can replace a lot of convoluted nested logic and eliminate a lot of cpu cycles popping return addresses off the stack, etc. The same arguments can be found in Relational vs Heirgraphical databases, and even DBM databases. They all have their strengths and weaknesses. Learning when one method is advantageous and when it only adds complexity is part of becoming a good programmer... and being dogmatic (either for or against) any one style in all instances holds one back from being a good programmer IMHO.
@allseeingeye93
@allseeingeye93 3 жыл бұрын
I'm curious as to why you think OOP is particularly suited for GUIs when functional reactive programming is used extensively in modern frontend frameworks like React and Elm.
@GBGOLC
@GBGOLC 3 жыл бұрын
Agreed, this vid is nonsense. There’s more than one way to skin a cat. I constantly write and switch between object based and procedural code. Why write a thesis on this and labour the point. Life is just too short and why the beef?
@EvileDik
@EvileDik 2 жыл бұрын
@@GBGOLC The issue is youngbloods are taught "this is the one true way" (hello agile/oop/rust etc.), you have to grow a greybeard before you learn to recognise 90% of this is bunkem, and someone trying to sell you something, and the only one true way is to have the experience to identify the right tool for the job (and learn how to tell your project manager they are wrong committing to the next new shiny).
@tabularasa0606
@tabularasa0606 2 жыл бұрын
Goto statements can always be avoided by just calling methods and should never be used. Good code does not have 3 or more levels of nesting. Once you need more, you just extract a method.
@rhymereason3449
@rhymereason3449 2 жыл бұрын
@@tabularasa0606 Makes zero sense. A Goto is an unconditional branch, it is not required (nor desired) to return like an OOP Method. Furthermore, a Goto simply changes the Program Counter and takes a few machine cycles while calling a Method at a minimum must push a return addresses on the stack, and do various initialization tasks that can take HUNDREDS of machine cycles. Why would I waste hundreds of machine cycles for something I could do in less than half a dozen? I think you are confusing a Goto statement with a function call... two very different animals.
@alexanderterry187
@alexanderterry187 4 жыл бұрын
This seems like more of a "don't put crap into objects when you don't need to" than a case against OOP.
@GoldenGamer-es5tl
@GoldenGamer-es5tl 4 жыл бұрын
Yeah, there's some food for thought here, but it doesn't seem to criticize OOP so much as it criticizes how people use it
@JellyMyst
@JellyMyst 4 жыл бұрын
A central thesis of OOP is that you should put everything into objects. Object-Oriented. Plus, he has a whole video going over the abstracts of why Object-Oriented Programming is bad. The video is called _Object-Oriented Programming is Bad._
@pee-buddy
@pee-buddy 4 жыл бұрын
This dude is just sad really. He obviously cannot seem to be able to design good OOP, then rather than blame himself somehow ends up blaming OOP.
@LanPodder
@LanPodder 4 жыл бұрын
@@pee-buddy i dont think thats the case
@pee-buddy
@pee-buddy 4 жыл бұрын
@@LanPodder If you know OOP well enough, it would be clear as day that the guy really is hopelessly lost
@MattRamsay-wh6cd
@MattRamsay-wh6cd Жыл бұрын
"Unified Modelling Language, Universal Modelling Language, whatever who cares... it's f*cking garbage" - that line killed me. You're right, UML is definitely garbage.
@charlesdeuter
@charlesdeuter Ай бұрын
ahh leave UML alone, it's okay for quickly modelling a handful of tables in a relational db.
@wichamir5183
@wichamir5183 22 күн бұрын
​@@charlesdeuter Yes it's nice for that, but many software architects try to shove it everywhere and create those huge convoluted monsters of diagrams, where you have to know in detail every feature of UML to understand what is going on.
@charlesdeuter
@charlesdeuter 22 күн бұрын
@@wichamir5183 yep that kind of thing is pure insanity.
@iAmTheSquidThing
@iAmTheSquidThing 8 жыл бұрын
There are a lot of things I like about OOP. But yes, I see your point. People seem to shoehorn a lot of code into objects when they really don't need to.
@WARnationLD
@WARnationLD 8 жыл бұрын
Samuel Clemens They have been teaching you wrong then the most classic example being the square and rectangle example.
@PerryGrewal
@PerryGrewal 5 жыл бұрын
I've known people who started learning programming and lost interest/gave up as soon as they had to apply OO concepts to solve problems/assignment questions. In other words, they were able to solve those very problems outside of the OO space. This is concerning because they could be adding value to the industry. I wonder if this is a symptom of what the video argues.
@LedoCool1
@LedoCool1 5 жыл бұрын
@@SimonWoodburyForget fun stuff is most oop programmers now go away from oop basis. What do you think dto's been made for? Or what about ECS pattern in game development? Speaking of ECS, it's adding new entities made easy and mostly bug-free. I think that OOP will stop being a paradigm in a future and will become a side feature which still can be used (interfaces and such) but not as a architecture framework. And you can see it even now in web development where most used patterns like factories, dto's domain driven design and other shit intentionally strays away from old and rusty oop.
@andreimasterdev
@andreimasterdev 5 жыл бұрын
@@PerryGrewal My brother gave up on that. He couldn't understand that bunch of stupid things. And I would say to him .. "calm, that's the way" ... But I was wrong. We really don't need it all!
@jeffwells641
@jeffwells641 5 жыл бұрын
IMO there is a big difference between programming with objects and orienting all of your code toward objects. If all you see are objects, then of course you're going to shoehorn all kinds of things into objects that have no business being there. OOP it's a design philosophy that teaches you to think exclusively in terms of objects. It's an inherently bad design philosophy.
@BroddeB
@BroddeB 5 жыл бұрын
There is no point using OOD for a very simple scenario. But using a complex scenario for teaching is not a good idea. So taking a simple scenario made for teaching, and saying "OOD is garbage" is pretty ignorant
@patricklangan950
@patricklangan950 5 жыл бұрын
But just like you say, using a complex scenario for teaching is not a good idea. That's why he's using simple examples in this video. His arguments against OOP in this video and the previous one stand on their own, but if you really need to see a large example before taking him seriously here's the next video in the series: kzbin.info/www/bejne/jGe5gWBolq6WicU
@BroddeB
@BroddeB 5 жыл бұрын
@@patricklangan950 Thanks, but that is still a simple scenario. It is just more lines of code, not more complex. I agree that OOD is not very efficient for simple problems. But I think it is very useful for more complex systems.
@Soremwar
@Soremwar 5 жыл бұрын
Following your logic, taking a simple scenario made for teaching and saying "OOD is the best" is equally as ignorant
@BroddeB
@BroddeB 5 жыл бұрын
@@Soremwar The lesson does not necessarily need to prove that the method is optimal. Since it would be cumbersome to setup a school scenario involving hundreds of branches, and thousands of engineers, it is better to use a simple scenario to teach. The method will seem over complicated and not optimal, but the students will still learn how to use it. And when they find themselves part of a large project, they will be better prepared.
@Soremwar
@Soremwar 5 жыл бұрын
​@@BroddeB The problem is they are convincing the students that this is the right way of coding, literally like: Do it otherwise and you'd be doing a huge mistake And BTW, they gotta prove the method is optimal. Otherwise there is no point in showing two pieces of code that do exactly the same thing and saying This is better, do it
@gnir6518
@gnir6518 2 жыл бұрын
As a student, I learn a lot from these videos and especially the discussions in the comments. Thank you all for your insights
@krazeemonkee
@krazeemonkee 2 ай бұрын
this sums up both the video + comment section quite perfectly.. as a student, as we all are, we can learn from all methods of solving problems ~ expanding not only our toolkits but also our minds that must first conceptualize the solution before solving it ~ in the end, all are tools to be utilized ~ different tools for different jobs ~ some problems may require a single function, others require an entire model/representation ~ rarely is anything "wrong" in life, just maybe not the *right* place or time..
@jadetermig2085
@jadetermig2085 Жыл бұрын
I love how so many comments fall back on truisms: "choose the right tool for the job" (usually in looong form). That statement is worthless. It doesn't pass the "not-test": "Do not choose the right tool for the job". Noone would ever agree to that. Therefore its negation (the truism) is also a completely general and meaningless statement to highly specific critique...
@logicaestrex2278
@logicaestrex2278 2 ай бұрын
because you cant give highly specific critique to discredit a highly general tool. to say "you should never use x" is extremely general, but naturally you dont critique that ridiculous generalization, but the comments pointing out a very context dependent approach to determining solutions to problems (which is literally all that works) are what is illogical here. thats the only general statement that is true. if the answer doesnt start with "it depends", or "compared to what", its the wrong answer
@rusi6219
@rusi6219 2 ай бұрын
They never specify what the job would be. Fact is, OOP has no "right" job to be the "right" tool for.
@bored4428
@bored4428 4 жыл бұрын
I think the main point is: "Know your tools and how to use them. Less is more."
@TebiByyte
@TebiByyte 3 жыл бұрын
The thing is that where ever you look for examples of OOP, you'll find vastly over-engineered code. This isn't because OOP itself is bad and leads to bad practices, it's actually because the examples don't play to the strengths of OOP. And understandably so, since oop is meant to be used in large codebases so you can keep everything modular in case you need to change something. And by the nature of an example, the code for it can't be a huge codebase or program. The conclusion you should draw from this is that both styles of programming have their place where they work best. There isn't a one-size-fits-all solution. OOP is a tool, not a way of life.
@paulie-g
@paulie-g 3 жыл бұрын
No, that's exactly what it means. And because it means that, inherently, you are then taught that you need 'patterns'. Not in the sense of idioms, actual magical patterns that, akin to incantations, must be used in a particular way in particular situations. When the usage of those patterns leads to even worse results, you are told that you did them wrong and you need workshops/lectures/books/tantric yoga to use them properly. It's turtles all the way down.
@kaseyboles30
@kaseyboles30 3 жыл бұрын
Modularity is independent of language paradigm.
@yuplucas4023
@yuplucas4023 2 жыл бұрын
@@kaseyboles30 agreed. What I want to see is someone demonstrate that OOP gives you some kind of modularity that a procedural approach can't.
@karaloop9544
@karaloop9544 2 жыл бұрын
Well, if OOP complicates simple examples to the point of semi-obfuscation then that doesn't exactly bode well for actually complex programs, does it?
@TheWookieDavid
@TheWookieDavid 2 жыл бұрын
@@karaloop9544 why? Killing a single cockroach using all the tools from an exterminator would most definitely overcomplicate things. Does that mean it would be simpler for an exterminator to clear an infested house with a can of spray and a flipflop?
@justinhutchison9866
@justinhutchison9866 4 жыл бұрын
A useful programming mindset that tends toward Brian's style, I've experienced, is to write code that minimizes the number of questions that could be asked about it.
@jfsanchez91
@jfsanchez91 7 ай бұрын
22:59 this is not even close to a "better" solution, i would love to see how you add to that spaghetti code a new DateTime parser, and then a new Base64 decoder parser, and then a new URL parser, and then a new valid file system path parser, and so on. The problem with your video, is that you take the examples only as they are presented, only for that small domain requirement, you do not see the bigger picture at all. Your "better" solution is not open for extension at all, any new parser requires adding a bunch of new IF statements into that - already complex- spaghetti code.
@darkengine5931
@darkengine5931 7 ай бұрын
Fair enough if you're optimizing for ease of change as a writer and editor, but I'd argue that Brian's solution is superior in terms of ease of comprehension as a reader given that it requires fewer elements to comprehend at the surface level as he points out. Also Brian's code is opposite of spaghetti code as its control flow is explicitly hierarchal in nature. The former one is closer to spaghetti in its control flow, as you'd have to visualize it like a DAG if you draw it out in full. The reason GOTO was considered the original source of spaghetti back in the day is that it turns what is generally a very sequential and hierarchal control flow into a complex graph. Branching all over the place tracing function calls has a similar effect. If you are jumping into unpredictable places tracing through code in the debugger, that's spaghetti code. Brian's is opposite; if you trace through his code, the jumps resulting from branching are extremely clear and easily anticipated.
@jfsanchez91
@jfsanchez91 7 ай бұрын
@@darkengine5931 in my opinion you should always write your code to be open/easy to extend. I always hear the argument: "that's not going to happen, or that is not going to change", and 6 months latter it already happened, and it already changed several times. Branching (IFs) is more difficult to read and to trace than some pluggable interface design, ofc that does not mean that you should write pluggable code everywhere, but there are really easy-to-see cases (like the one in the video) where the pluggable interface solution is far better than the branching one. This in conjunction with Dependency Injection makes every piece of code extremely easy to maintain and to extend.
@darkengine5931
@darkengine5931 7 ай бұрын
​@@jfsanchez91 I'm in the middle camp ground. I don't disagree with you in many situations, and especially in the context of the example Brian used where it seems to have a very high probability of being incomplete. It's only the idea that polymorphic refactoring of conditionals always eases maintainability that I would contest, since sometimes clarity and simplicity of control flow and associated state changes is the ultimate thing that allows developers to understand and change the code in a reliable way, particularly in the imperative case when mutable shared state interacts with multithreading. Functional programming is the most complete and thorough solution in these cases if we can afford it (including functional OOP with immutable objects whose data members are constants only initialized in construction), but the next best thing in those cases tends to be simplification of the control flow interacting with the complex program state. Quoting John Carmack: >> The real enemy addressed by inlining is unexpected dependency and mutation of state, which functional programming solves more directly and completely. However, if you are going to make a lot of state changes, having them all happen inline does have advantages; you should be made constantly aware of the full horror of what you are doing. [...] Most bugs are a result of the execution state not being exactly what you think it is. [...] >> Inlining code quickly runs into conflict with modularity and OOP protections, and good judgment must be applied. The whole point of modularity is to hide details, while I am advocating increased awareness of details. Practical factors like increased multiple checkouts of source files and including more local data in the master precompiled header forcing more full rebuilds do need to be weighed. Currently I am leaning towards using heavyweight objects as the reasonable break point for combining code, and trying to reduce the use of medium sized helper objects, while making any very lightweight objects as purely functional as possible if they have to exist at all.
@habl844
@habl844 6 ай бұрын
The code just needs some basic denesting refactoring in my opinion. After that it would be easy to extend with everything you mentioned. If one of the parsers is long, throw it into a separate function. The point of the video stands. I find the original version with recursive derived marshalers (?????) much harder to understand and extend. I find it hard to understand where exactly I should start extending it and why.
@KyleWoodlock
@KyleWoodlock 4 жыл бұрын
You ask the question multiple times, "why is this a class?" And the answer is, ideally, "because it's a highly cohesive unit of behavior that is going to be injected into another unit as a dependency." This allows clean separation of concerns into units that can be tested independently using O(n) tests for the functionality of unit N and O(m) tests for the functionality of unit M, and not O(n*m) tests for the functionality of both those units together where you have to test the cartesian product of all code paths both units could take. OOP doesn't have a lock on this. You can do the same thing in functional programming by taking dependencies as functions and implementing those dependencies as closures over any necessary inputs. Hell, you can do the same in procedural code by using function pointers. The benefit you get, that you're erasing in your rewritten examples, is the inversion of control which requires a callee to be able to dispatch to a method specified by its caller. None of your examples do that, which means none of your methods that have dependencies can be tested independently. It also means you can't pick and choose between implementations of cross-cutting concerns. You couldn't swap in an HTTP file reader in place of the FTP, you couldn't swap in an XML file parser in place of CSV.
@ConernicusRex
@ConernicusRex 4 жыл бұрын
I was looking for this to see if someone explained it to his simple ass.
@skeletalearth
@skeletalearth 4 жыл бұрын
Thank you. It seems like his premise (that OOP leads to spaghetti code) is fundamentally undermined by the fact that the examples he gives aren't practical. If you're trying to do something very specific and think that a fully engineered solution will never be used - then by all means, ignore a clean seperation of concerns, and just get the job done. If you're building a full-scale solution to something that is meant to live in a production environment for years to come, then ensuring that the inversion of control principle isn't violated allows you to quickly maintain your code when shifts in your application architecture and environment demand it. As you said, it's not like these things are owned by OOP, but his response to example code trying to implement clean coding practices was to make the code dirty and quick. It should be obvious to anyone who has worked on large projects why doing this can be a very bad thing.
@KyleWoodlock
@KyleWoodlock 4 жыл бұрын
@Nigel Kipling So you agree that inversion of control is a good principle, but you removed it from all your rewritten examples to make them look simpler but be harder to extend? Go's use of structs, interfaces, and receiver functions is basically just OOP without polymorphism. "Should this be a struct?" in Go is the same question with the same answer as "should this be a class?" in Java or Ruby.
@HowT0Code
@HowT0Code 4 жыл бұрын
Do you really just swap-in things ? Don't you really consider what you swap-in ? Or the fact that same methods can be used is enough, let's say you're swapping mysql with mongodb, good luck with that
@KyleWoodlock
@KyleWoodlock 4 жыл бұрын
@@HowT0Code The data persistence layer needs to understand the differences between MySQL vs MongoDB of course, but any layer above that should be able to operate on the model abstractly without knowledge of what persistent store I'm using. The interface allows me to define what the contract is for those abstract operations, and then the persistence layer only needs to care about conforming to that contract, and any layers above only need to care about using that contract. Even if you aren't swapping anything in or out, even when you have only a single implementation of any given unit, there is still value in separating these concerns into different units, because it lets you test them independently. I can write test cases for the logic of my patent parser without having to stand up an actual FTP server for it to contact, by injecting a mock implementation of the "downloader" dependency that just returns a set of records I define in-memory. I can simulate abstract error conditions without having to cause an actual network error to happen. And frankly the work isn't done if your code isn't tested
@rickchristenham5416
@rickchristenham5416 2 жыл бұрын
I am an OO programmer and never had a problem with absurd examples like these. A class is not always a data object, for example, a service. A service, like "logger," for instance is just that: A logger. Classes to me are ways of grouping and organizing your code. Consider that all Microsoft and Java frameworks and libraries are OO. For example, a String class is an object that both represents a string and contains methods related to manipulating strings, etc. If OO programming is so bad, then the Java and MS languages/frameworks themselves are likewise nonsensical as well and its no wonder that we're able to use them at all. I mean, in procedural programming, it's not uncommon to have a procedure named something like "ProcessOrder" for instance and it usually performs all the steps needed to process the order, but you are often not sure what that all entails. If you ever need to isolate and find the code that specifically performs a certain action like determining the tax rate, would that be in the ProcessOrder procedure or did we load that value when we say chose our state? Or maybe we were able to determine it upon initialization. I can't tell you how many times I've had to search entire applications searching for where a certain piece of logic lived. It just makes sense to place tax logic in a "Tax" class. It keeps us from trying to guess whether or not we decided to put a certain function in a module that we named "GlobalMethods" or if it's in the module where its being used, etc. It just makes more intuitive sense because that's how all frameworks, controls and packages that I've ever used were organized.
@struki84
@struki84 Жыл бұрын
Not to mention that certain development is much easier when handling objects. Like game development.
@AndersenCastaneda
@AndersenCastaneda Жыл бұрын
​@@struki84 In game development OOP isn't used due to performance overhead, in game development real programmers/studios (AAA quality) use plane data group by type (like relational databases structure style) commonly addressed as data-oriented design.
@kalecccxi333
@kalecccxi333 Жыл бұрын
@@AndersenCastaneda "real programmers"
@saltysalt7339
@saltysalt7339 Жыл бұрын
@@AndersenCastaneda We don't talk about the Error 404 Quality not found examples
@KevinUchihaOG
@KevinUchihaOG 11 ай бұрын
@@AndersenCastaneda depends on the scale of the game. Most indie developers use OOP, but i guess they arent "real programmers". Its just quicker to prototype and test ideas for a single developer using OOP, especially if he uses Unity or another game engine developed with OOP in mind. There is alot less setting up and planning required for OOP than for many other paradigms such as ECS.
@markharrison9021
@markharrison9021 3 жыл бұрын
I've been a software developer for over 30 years now .... currently I work with C# a lot ... which I love because it lends itself to both procedural and OO paradigms really easily. If I'm cobbling together a little in-house utility I will always use a procedural style ... it's quicker and I'm not expecting the code to need to be scaled up in any way. For anything bigger and anything that customers will use it will always be OO. As other people have commented ... OO is scaleable in a way procedural code is not. I always think there's oceans of difference between a "software scientist" giving opinions on small and contrived programming examples and actually getting stuck deep into countless thousands or millions of lines real world code.
@brodyyucan
@brodyyucan 3 жыл бұрын
@Marcus - The universe is written in Objective - C
@bossssssist
@bossssssist 3 жыл бұрын
either way you will have to go back and edit the code. classes can be just as hard (if not harder, especially at my current job) to manipulate if you need to add/remove specific features
@Isaac_myguy
@Isaac_myguy 3 жыл бұрын
Yea I came to say this, interfaces and dependency injection could save 10s of hours refactoring code. Wanna switch from SQL server to MySQL? Good thing you used a provider, repository and service classes. Just need to update one file
@Jim-mn7yq
@Jim-mn7yq 3 жыл бұрын
@@Isaac_myguy agreed. Although my old company called them dats access layers.
@Gogglesofkrome
@Gogglesofkrome 3 жыл бұрын
@@brodyyucan the universe is written in binary, and how it gets there is a matter of logic
@MrDocProfPj
@MrDocProfPj 3 жыл бұрын
After just taking an OOP class at college, and appreciating what it is does, the majority of our coursework was small examples that could easily be done procedurally including the final that I felt force to complicate with classes I can respect what he is saying but I also can see the large scale use cases.
@aaronbono4688
@aaronbono4688 2 жыл бұрын
Your understanding here is heading in the right direction. OO, especially with languages like Java, just suck for small things because of all the overhead. However, I love Java for large systems, in large part because of its strong typing, but also because you have lots of options on how you can organize your code and that organization makes dealing with these large code bases so much easier. I am now working with microservices using JavaScript and for these tiny bits of code, a both weak typed language and language not requiring all the OO structure is nice. However, even for these microservices I wish it were TypeScript (strong typed) because it is really hard to understand the data structures being handed around. Just this last week I was working on some code where, if it had been strongly typed I would have had it done in a couple minutes. However it was JavaScript and now I have to wait until I can run it in QA to see the actual data flowing across the wire before I can complete the code. Very annoying.
@walrustrent2001
@walrustrent2001 2 жыл бұрын
@@aaronbono4688 strong typing exists outside of OOP
@aaronbono4688
@aaronbono4688 2 жыл бұрын
@@walrustrent2001 right, that's why I mentioned typescript.
@bassam_salim
@bassam_salim 2 жыл бұрын
Same thing happened to me, although my graduation project was medium sized ,it would've taken way longer and been too complicated if I made it with procedural, glad I did it with OOP
@philippebaillargeon5204
@philippebaillargeon5204 2 жыл бұрын
I don't understand, most OOP languages are multi-paradigm programming languages anyways. You aren't obligated to use classes all the time. You can use struct, enums, static classes, etc. There are multiple options. So many people are hating on OOP languages while in fact they aren't even aware that those languages can do way more than pure OOP.
@skilz8098
@skilz8098 5 жыл бұрын
I'm self taught in C++ and through the years I've learned that when you don't need OOP you shouldn't try to force it. However if you do have an object that has several fields and you to keep the data encapsulated (protected or private) from the user and just provide an interface then yes by all means it is worth it in that sense.
@gerardgauthier4876
@gerardgauthier4876 5 жыл бұрын
The odd thing about C++ and its standard library.. It doesn't embrace encapsulation. Everything is container -> iterator -> algorithm -> iterator -> container or some combination of that pattern. Its odd that a object oriented language would design its standard library without embracing one of the corner stones of OOP.
@raksipulikka
@raksipulikka 5 жыл бұрын
@Hamad Al Marri Yes, and while the traffic light is red, it does not stop you from driving through the intersection. In both cases you are doing something wrong.
@MidnightBloomDev
@MidnightBloomDev 5 жыл бұрын
Seeing by the replies self taught programming wasn't enough
@Tristoo
@Tristoo 5 жыл бұрын
@@gerardgauthier4876 C++ is not an object oriented language.
@Tristoo
@Tristoo 5 жыл бұрын
@@MidnightBloomDev Well you clearly have your head up your ass.
@DerrickJolicoeur
@DerrickJolicoeur 4 жыл бұрын
Very fascinating thought process. It seems clear that you don't despise the use of classes and objects, but that, to use them there must be a reason for them to be used. Much of (if not all) the OOP examples you've picked apart here are quite clearly unnecessarily complicated, not because the author thought that the problem needed to be solved by OOP, but simply because they were trying to give a demo of OO concepts. Unsure if you've already made a followup to this yet or not, but I'd love to see you pick apart real OO projects like you'd mentioned in the video. (namely a small game) Those projects *should* contain OOP examples in which the developer felt that OOP actually offered something.
@quintongordon6024
@quintongordon6024 3 жыл бұрын
Unfortunately the start to all of his oop videos and/or the titles are either extremely clickbait or evidence of just how much he hates oop
@DavidWoodMusic
@DavidWoodMusic 4 жыл бұрын
I started programming almost two years ago this was one of the first videos I found. I come back to it every six months to see if I understand it yet.
@joshodom9046
@joshodom9046 4 жыл бұрын
Beware of anyone who pushes a dogma on you in programming. OO is a box of tools you can use to make your code more flexible, easier to understand, and easier to use. However, you shouldn't blindly use it for everything, just as you shouldn't throw it away due to examples of bad code.
@viktordoe1636
@viktordoe1636 3 жыл бұрын
@@joshodom9046 It's like that in every aspect of civilized life. There are rules and laws made to achieve some higher order goal or purpose. But you have to be aware and keep in mind these higher "meta" goals to see when it's reasonable to break the rules. There are traffic laws for example in place in order to prevent accidents. But occasionally there are situations in which in order to prevent an accident you have to break some traffic laws. So you must not blindly follow the rules. And it's the same with programming, you have to keep in mind the higher order, meta goals or laws: You want to write efficient, bug free code that is preferably readable. This is the most important goal, if the suggestions or principles of OOP occasionally compromise this goal, you might want to let it go, in that particular case.
@YanYanicantbelievethistakenffs
@YanYanicantbelievethistakenffs 3 жыл бұрын
And you now understand it? Cuz i have around 4 years and lets say that this is the first rime i see ruby code and went "welp, this makes sense?"
@DavidWoodMusic
@DavidWoodMusic 3 жыл бұрын
@@YanYanicantbelievethistakenffs Haha getting there.
@user-jn4sw3iw4h
@user-jn4sw3iw4h 3 жыл бұрын
@@freedomgoddess Correct, the *first* response of a java-dev when asked about 'I want to jump from anywhere in a program, to anywhere else in a program' with 'that sounds like a bad idea', and for good reasons. If your response is 'walking away and go complaining to others, how sad their value-judgement made you' instead of asking the follow-up question: 'I wasn't looking for your value-judgement, I was looking for your reasoning *behind* that value judgement. Could you elaborate?' Then the fault lies with you. As for "easier to understand is subjective"..... well key part in the sentence was "tools you *can* use to...": well written Java, is easier to read than terrible written C. well written C, is easier to read than terrible written Java. (regardless of which language the reader is more proficient in.)
@CarlosGonzalez-mp9re
@CarlosGonzalez-mp9re 2 ай бұрын
I'm not too experienced to have a strong opinion on this, but the examples chosen are explaining these concepts, so the problems are simple, what is complicated is the solution they are trying to explain. In my experience, I've found classes the most useful when I'm writing big functions handling general and specific cases. They might begin to be too long, or the parameter list gets too big, or even the parameters themselves are complicated (like an indeterminate number of tuples with a specific structure of contents). Sometimes an object with custom behaviour and properties solves the problem in a more structured way. Hopefully we'll see how it goes with real projects and learn something from this.
@bosshua
@bosshua 4 жыл бұрын
Isn't the purpose of all those examples you go through to teach OO programming? Sure, they can be simplified and optimized into less and arguably more readable code. But i think they abstract them out further than most would in practice, for the sake of simplifying their teaching points.
@Twosies20
@Twosies20 4 жыл бұрын
What really got me was his coin flip implementation. The OOP version steps through the literal actions of a coin flip game, like a simulation. The procedural version just models the results with the understanding that the output will be a random player winning with a random coin. But the point of the OOP one wasn't just to output the result of the game. The point was for the game to clearly be played, with the idea that the same techniques apply to much more complicated "games" or systems. So by writing code that doesn't even play the game (or "plays" it in an implicit, non-literal manner), he did that example an injustice, imo.
@Andy-wv2xj
@Andy-wv2xj 4 жыл бұрын
@@Twosies20 Sure. from that moment I knew this video has a big garbage
@JerryO1995
@JerryO1995 4 жыл бұрын
He had to show 4 examples in one video so it's understandable that the examples were very simple and made for the purpose of teaching, that's why at the beginning he says that he'll rewrite a few thousands lines long OO code to prove his point. That aside, this kind of teaching leads developers to believe that they need to use objects everywhere and, trust me, it happens and it's a real mess. I'm not very experienced, having only worked as a developer for 2 years, but the code some of my workmates have written for the sake of it being purely OO is terribly absurd, long, incomprehensible... OOP is not bad but it needs to be used wisely, otherwise you'll end up with a pretty big mess of a code. That's what I believe this video wants to illustrate.
@Andy-wv2xj
@Andy-wv2xj 4 жыл бұрын
@@JerryO1995 Yes, but for those bad code and designs, he ends up by saying OOP is bad is the thing that i CAN do the same with FP.
@kspfan001
@kspfan001 3 жыл бұрын
@@Andy-wv2xj OOP is bad. It’s bad and it teaches devs really bad habits. Especially with java. Some of the java devs I work with are hopeless as after almost 10 years a few of them can’t NOT code everything like the joke OOP examples from the other video. One of my main projects at work has been to chunk pieces of an old bloated javaapp off into microservices. It took a freaking YEAR to sort through the spaghetti of thousands of classes in this single javaapp to the point where some functionalities in it could begin to be isolated. Thus far, I’ve been refactoring about 100-500 or so lines of hardcore OOP java into 20-100 mostly procedural python. The examples being teaching examples makes this WORSE, not better. Unless you’ve drank the OOP koolaid I guess.
@cristianbilu
@cristianbilu 3 жыл бұрын
For the first example, you said “you need to instantiate classes”. What about static methods in classes? They could have work in that case and as you said the class would have served only as a namespace for code separation ( so it won’t be in the global scope )
@carlosavila4290
@carlosavila4290 3 жыл бұрын
Still orthopedic.
@danieldavies765
@danieldavies765 3 жыл бұрын
I had this exact thought, although I do wonder, if you've got a class that only contains static methods, what benefit do you get from having them inside a class.
@vr77323
@vr77323 3 жыл бұрын
@@danieldavies765 I do not say one thing is better than the other, I think everything is a tool that fits to solve one problem or another and just like everything-everyone has their own preference. Im just giving a simple example to answer your question. A quick thing that comes to mind from reading the comment: Same reason you would have a normal non-static class- encapsulation. Because you might have some static functions that should be accessible from the public static methods, but you might have some private static methods that should not be available to the outside world. Same thing with properties, you may have some static properties that should not be accessible from the outside world or that only the class itself should be able to change. Im sure someone more experienced could probably give you more and better examples. Those same things would be hard to achieve if you didnt have classes and everything has to be global functions that everyone can access
@Danielle_1234
@Danielle_1234 3 жыл бұрын
Generally you can use a file as a namespace instead of a class in this situation. (ymmv)
@pyhead9916
@pyhead9916 3 жыл бұрын
@@danieldavies765 In Java, the entire Math class is made-up of static methods! It's one place to store them all for easy use by multiple programs, projects and programmers. You could ask the question: 'Why do languages use common "libraries?"
@MrTrollinglol
@MrTrollinglol 4 жыл бұрын
It has been known for a while that OOP is superfluous when it comes to simple programs with less than ~1000 lines. The entire point of OOP is to make things more accessible. You cannot argue that the java developers did not use OOP properly. Seriously, can you even imagine the java API existing in it's current state if OOP was not a feature of java??
@JellyMyst
@JellyMyst 4 жыл бұрын
No, without OOP I can't imagine such a bloated, confusing mess of an API where every verb must be phrased as a noun and you have no idea which of 700 Factory classes churns out the functionality you need.
@Frozander
@Frozander 4 жыл бұрын
@@JellyMyst That sums up my experience with Java.
@Roboprogs
@Roboprogs 4 жыл бұрын
Oh how I miss “FILE *” sometimes. As in, the thing returned by fopen or popen in C. I don’t miss malloc (or new), though. But memory management is orthogonal to OOP.
@Roboprogs
@Roboprogs 4 жыл бұрын
In fairness, much of the evil that I and others attribute to OOP is really just C++ and Java being such a train wrecking into a burning dumpster. Borland’s Pascal extensions, or something like Eiffel, or even (now) Go seem pretty pragmatic. But yeah, comparing something like the Java.io package to say stdio.h makes you wonder what the hell they were thinking, despite the issues with error checking in the C API.
@okie9025
@okie9025 4 жыл бұрын
@@JellyMyst at least "HTTPRequestSingletonFactory" is more readable than "r_x *"
@fisauto
@fisauto 5 ай бұрын
Just think about an int vector. Why would it be better to keep track of its size in an independent variable instead of asking the vector itself?
@charlydagos
@charlydagos 8 жыл бұрын
"UML is just fucking garbage" -- You're my hero, Mr Brian Will.
@SE45CX
@SE45CX 7 жыл бұрын
Well I think it's more the fucking college teachers who hold on to their theoretical nonsense. The actual software engineers will ultimately experience what is practical and what is not.
@omgomgomgd
@omgomgomgd 7 жыл бұрын
I am a CS tutor. I am always wondering why teachers are teaching this garbage to the next generation of programmers.
@AlqGo
@AlqGo 7 жыл бұрын
The usefulness of UML is only limited to helping you communicate your idea clearer. It's not that useful to design code. It's just for communication. It's most useful when you want to present your idea to your client. That's it.
@THENewTubez
@THENewTubez 5 жыл бұрын
How bout multi paradigm programming, everything has it's place... A pure anything would probably not be the best way
@brecoldyls
@brecoldyls 4 жыл бұрын
THENewTubez this sounds very rational
@garychap8384
@garychap8384 4 жыл бұрын
@Adam Richard No, you still have goto statements... Of course, these days you can count the legitimate uses for them on the fingers of one foot ; ) It's actually not THAT bad, I'm simplifying. I've used them properly, in situations where it's perfectly acceptable... in ring-zero, mainly bootstraps and kernel drivers.
@chihchang1139
@chihchang1139 4 жыл бұрын
From my experience, all OOP implementation ends up using as little OOP as the language allows, and this actually creates a ton of issues, for example Java Streams is essentially a functional closure. However, because Java's OOP structure, there are pretty weird rules they had to implement with regards to side-effects
@tiagodagostini
@tiagodagostini 4 жыл бұрын
@Adam Richard They are still there in several languages, but except for the complex bail out of branches and loops case, there is very little reason to use them.
@garychap8384
@garychap8384 4 жыл бұрын
@rerunturbografx Not always, there are still a few legitimate uses... But then, when I started some 40 years ago, you needed ASM to do anything in a reasonable time... and goto's and JMPs weren't just a kludge against poor planning. In fact, I still use goto in c, but only for specific use cases in ring-0 code.
@voxorox
@voxorox 6 жыл бұрын
You could make a video like this about EVERY programming paradigm. Bottom line: They are all tools in the toolbox. OOP has a place. Procedural has a place. AOP has a place. They all have strengths and weaknesses, and ultimately work best in tandem with each other.
@michaelmahn4373
@michaelmahn4373 5 жыл бұрын
Indomitus1973 True, but when I went to university OOP was taught as the modern, superior way of programming which were more maintainable and readable than procedural code and you should ALWAYS prefer it maybe except for writing an OS. Possible that it's different now or at other universities, but I think if you had such an education and see the flaws of OOP for many problems, you appreciate such a video.
@rwxrobfun
@rwxrobfun 5 жыл бұрын
You actually could not make such a video about procedural programming.
@storerestore
@storerestore 5 жыл бұрын
@@rwxrobfun "It's embarrassing how our CPUs ultimately execute the code we write!"
@rwxrobfun
@rwxrobfun 5 жыл бұрын
@@storerestore The level of inexperience and ignorance in that statement is dumb-founding. This is why I engage the equivalent of flat-Earther technologists.
@the-digital-idiot
@the-digital-idiot Жыл бұрын
14:00 isn't that what enumerations are for? At least in c++, if you don't have a case for every enum member or a default case, you get a compiler error/warning. Using different types here just seems wasteful and pointless when an enumeration can be used, witch, mind you, are usually just numbers on the implementation.
@iamstruck
@iamstruck 4 жыл бұрын
as a regular user of Java, i can see where you’re coming from and why you’re saying OOP is bad. i use Java for bigger projects in which it is nice to have objects and such for the organization of the large codebase. as many people have said in these comments, OOP is terrible for small projects and wayyy more useful for bigger projects.
@recompile
@recompile 4 жыл бұрын
What you want isn't OOP, it's a proper module system. Classical OOP is pretty terrible at modularity. Robert Harper, a CMU professor, famously called OOP "anit-modular", a fact which is obvious to most, but still manages to elicit a violent reaction from kids indoctrinated in the OOP way in the late 90's/early 2000's. I presume it's because it makes them very uncomfortable. The three pillars of OOP -- inheritance, encapsulation, and polymorphism -- have all long sense fallen. No one even defends those any more. Inheritance as the primary means of reuse is unthinkable today, but it was orthodoxy not long ago! That's always been a problem with OOP. It was never clearly defined. It was more a vague mix of ideas that never really came together in to a coherent concept. It's probably why we found ourselves with a new trend within OOP every couple years. Each time promising that this is the one idea that'll finally allow OOP to deliver. Fortunately, the hype finally seems to have died and the majority are starting to look at OOP with a critical eye. I expect the next trend to be more measured. Probably a mix of functional and structured programming.
@kant12
@kant12 4 жыл бұрын
@@recompile There's no single best way to implement anything. I think you're expecting too much. And I have to wonder how long you've been writing software if you've never found something as simple as encapsulation useful.
@PierreCHARLES1838
@PierreCHARLES1838 4 жыл бұрын
@@recompile Wow, you are not using inheritance, encapsulation, and polymorphism ? Well maybe you are just not implementing the right kind of software. Sometimes you just need 2-3 services classes and a main class. Good programmers should know when to use functionnal programming, procedural programming and OOP. Alone they will look messy but together you can build beautiful and maintainable code.
@Austin1990
@Austin1990 4 жыл бұрын
recompile Modules with OOP is easy. You have a module that accomplishes a specific group of tasks, such as working with a database. It contains defined objects for interfacing with the module, like an API. Then, it has objects hidden to the user of the module that help carry out those tasks. The module may be dependent upon other modules, such as those that define basic data types. This adds abstraction that makes the higher level programming much easier. It makes debugging easier, etc. This could be done without OOP, but OOP can make this easier and more readable for larger projects.
@Ext3rmin4tor
@Ext3rmin4tor 4 жыл бұрын
@@Austin1990 What about something like pattern matching and type algebras vs polymorphism with inheritance and interfaces? Do you think it is easier to handle those situations with dynamic dispatching or a visitor pattern rather than having a built-in language abstraction to do that (I am talking about old school OO, not modern OO languages such as C# where now you have pattern matching, like Java for example)? And what do you think about advanced type systems that support higher-kinded polymorphism that mainstream OO languages generally lack?
@tenzenin6301
@tenzenin6301 4 жыл бұрын
When pursuing dogma, you inevitably find a plethora of examples where that dogma fails to accomplish. Data analysis should give way to action precisely when it needs to.
@BritishBeachcomber
@BritishBeachcomber 4 жыл бұрын
The examples do not prove that OOP is bad, but simply that the examples themselves are badly coded.
@NoeLPZC
@NoeLPZC 4 жыл бұрын
Not even that. These simple programs are just showing the structure of OOP so you can apply it to bigger programs that WOULD benefit from it.
@HonsHon
@HonsHon 4 жыл бұрын
@@NoeLPZC Yeah, if you just shoved a complex ass problem down a student's throat, then you are probably going to lost them. It is good to inch them toward more complex code with examples that are simple enough to not need OOP to teach them how to do it.
@Grunchy005
@Grunchy005 4 жыл бұрын
Huh. But isn’t all computer memory nothing but a 1-dimensional sequence of bytes, and doesn’t the cpu work through a program 1 instruction after another?
@NoeLPZC
@NoeLPZC 4 жыл бұрын
@@Grunchy005 You're right, but code doesn't always run top-to-bottom down the page. There are loops, conditions and functions that point the processor at different lines than the one directly underneath it.
@howardlam6181
@howardlam6181 4 жыл бұрын
@@Grunchy005 No. There are multiple cores in the CPU and the GPU accept jobs in batches.
@skyflight99
@skyflight99 3 жыл бұрын
I agree, the examples went to absurd lengths to make everything an object: when your objects are actions like 'job', or 'marshaler' there's a problem. ... I sat down to eat breakfast with my bow and arrow but couldn't really get the cornflakes on my broad head.
@David_Raab
@David_Raab 4 ай бұрын
Everything is just an action. action operating on data and transforming data.
@ishdx9374
@ishdx9374 4 жыл бұрын
coin flipper: console.log(Math.random() > 0.5 ? "tails" : "heads")
@rasmadrak
@rasmadrak 4 жыл бұрын
www.ripleys.com/weird-news/coin-toss-or-not/ ;)
@derDrache1988
@derDrache1988 4 жыл бұрын
If you want a 50:50 chance, the condition should be "< 0.5". Your version slightly favors tails, because Math.Random might return 0.0 but not 1.0 ;)
@overloader7900
@overloader7900 4 жыл бұрын
@@derDrache1988 fprint(rand()%1?"twins":"tails"); Instead of % could be &
@esbensloth
@esbensloth 4 жыл бұрын
Random.nextBoolean()?"tails":"heads"
@ishdx9374
@ishdx9374 4 жыл бұрын
@@overloader7900 %1 would always give tails
@christophfischer2773
@christophfischer2773 4 жыл бұрын
Here is what you did wrong: You chose examples that were made specifically to showcase OOP. Of course they are over engineered. OOP becomes useful when you need repeating patterns in large programs. Or when you need to access the same objects/data from multiple places. This will never be necessary in 100 lines of code.
@ffghjj9996
@ffghjj9996 4 жыл бұрын
wasn't this already addressed in this video
@nialltracey2599
@nialltracey2599 4 жыл бұрын
"You chose examples that were made specifically to showcase OOP. Of course they are over engineered." There is a problem when every demonstration of how to make elegant, simplified, maintainable code using a particular architecture results in inelegant, complicated, unmaintainable code. Essentially, you're saying his mistake was using it as directed...
@makers_lab
@makers_lab 4 жыл бұрын
Personal experience is that OOP is beneficial over procedural for most general, non-trivial and non-throwaway programs that aren't better solved with alternatives such as a functional or logic programming language; the problem here is with trivial problems that were tackled in a badly engineered way, making it easy to find fault though this is not with the tools but with those who used them. There is definitely a knack to OO design, asking oneself the right questions, imagining what concepts and kinds of things would be useful to have exist in a solution, what questions those things should be able to answer and what behaviours they should have. Done well, a solution can then fall into place easily, be straightforward to understand by others, grow and maintain. When posing on the spot OO design thought experiments to undergrads, some can do this quite easily but most struggle or even fail entirely, suggesting that the way of thinking required is not nurtured and developed at Uni. An OO solution will then very likely seem awkward, confusing and even frustrating to develop, with the resultant code being contrived, muddled and relatively hard to understand.The methodology is sound, but does require good training to use it well unless it is something that one just grasps naturally.
@nialltracey2599
@nialltracey2599 4 жыл бұрын
@trollnerd You've missed my point, and being unnecessarily rude. UE is not a *demonstration* of OO -- it is a piece of software. My point is that when people deliberately attempt to demonstrate the principles of OO, they almost universally produce examples of inelegant, complicated, unmaintainable code. This indicates a problem in their thinking regarding OO. I have never looked at the UE source code, but I would be very surprised if it was a hardcore objects-everywhere architecture... even if we disregard certain 3D rendering stages which are highly unlikely to be OO. Strict OO means never using structs, because structs separate data and code logic. I would be surprised if UE didn't have a single struct in its codebase...
@XfStef
@XfStef 4 жыл бұрын
This isn't an argument against data / objects which are being used and reused within a service. You can easily just make global data holders and a simple mutex system to handle multiple calls to them.
4 жыл бұрын
I once maintained a project that was developed by a guy with exactly this same philosophy. It was hell. Nothing but long, mono-classes with godlike powers. What you advocate here makes sense - for small examples/apps. Once the project gets to a certain size, the 'embarrassing' separation comes very handy.
@nobytes2
@nobytes2 3 жыл бұрын
You know you can separate responsability without being oop, right? That's what he's advocating know the difference between when you need an object, vs static class, vs. procedural.
@flater420
@flater420 3 жыл бұрын
@@nobytes2 He questions why a data-less class exists as it (allegedly) should just be static and the concept of instantiation an instance makes no sense. The problem with that assertion is that it completely shuts out the possibility of mocking (and thus unit testing), and having interchangeable implementations (e.g. different CSV parsing approaches), as you cannot derive or swap out static methods. It simply cannot be achieved without containing the behavior in an instance (and therefore class). Using global scope is NOT equivalent, nor does it provide the exact same benefits.
@samuellourenco9526
@samuellourenco9526 3 жыл бұрын
More hell it is if the code is separated in tiny classes, and you have to look for the definition in another file, and then you forgot what the original problem was. I rather prefer mono classes. Functions should do the separation.
@sdfsdf421df
@sdfsdf421df 3 жыл бұрын
@@samuellourenco9526 yeah, so typically when someone talks trash about other person pick of language or style, it's typically some fanatic, not a professional, who cannot take a look for another perspective than his own, and judge the benefits/drawback of other languages/approaches. Especially it shows when someone advocates smth. using oversimplified examples and extrapolating it to whole world. Just an example. I have here mono class, which was written by mono-classes fanatic. That bloody thing has 20k LOC, almost 2MB. It takes several second for IDE just to open it and highligh it. By default intellij will not provide intellisense features for file >2.5M, so we're close. Navigation in it is nightmare, worse than thousands of files. In normally decomposed project, you can navigate by package by type of class or functionality you working on. Here, you can navigate only by line number, or searching for function by name. Theoretically by named code blocks. But it's significantly worse than any other approach.
@Danielle_1234
@Danielle_1234 3 жыл бұрын
@@flater420 In the video he was talking about classes, not mock objects, not interfaces. Interfaces do not have to be classes.
@schmidtbeatriz
@schmidtbeatriz 2 жыл бұрын
in portuguese Object-Oriented Programming is called "Programa Orientado a Objeto", and yes, we call it POO
@MidnightSt
@MidnightSt 8 жыл бұрын
there's a balance which is very hard to strike and very hard to show on examples. in the terms of real production code all those examples are insanely, absurdly overengineered, the last one even in a very weird and hostile way. but in terms of real production code you need a text that primarily preserves and presents the logic, principles, mindset behind the program, so the next programmer can understand and extend those principles for new cases with relative ease... what you propose in all the cases is "specific minimal elegant code to solve the precise given solution". what OOP is about is "the problem presented is an example of a problem set that will expand, catch the principle and make logic that will be easy to expand and relatively easy to comprehend in general even when in almost constant state of flux. (disclaimer: i say "functions". we are not talking about functional programming, yes. we're talking about procedural. when I say functions, i mean procedures, methods, whatever you call it. for me a function is a block of code optionally accepting parameters and returning value. method/procedure i'm used to think of as a block of code optionally accepting parameters and directly manipulating data within parent (i.e. global, or object) scope, not returning a value. you knew what I mean, this is just defense against nitpicking :-D) object oriented thinking is just more akin to how our minds model the world and events within it, therefore people will be better at using it more readily for larger problems. it is also more suitable for solving/simulating complex interconnected systems. you prefer to think of data as data, and functions as functions, "the program", "what is being done to the data". i prefer to think of data as "data program was made to manipulate", and functions, objects, code as "data that describes what to do, how to transform the target data". so that makes me think of a function/method as a type of variable/object. lambdas, delegates, reflection. all the examples are shit, though. any example any talk or OOP design tutorial ever gave is total shit. until you are sat in front of a corporate solution with 2 milion loc, 150k of it autogenerated, divided in 8 projects (database access lib, webservice libs on top of it, and several apps (from MVC through silverlight through MS CRM extension lib to angular SPA) some using the DA libs directly, some connecting to webservices, some connecting to crm and webservices and creating another webservice for a different system with the combined data...)... until you encounter a beast like this, and after the initial mortal dread and the first stressful month you realize that you can already work within that code with relative effectivity... THAT'S when you start to understand: a) what is the point of; b) how to correctly use OOP. but of course there's boatloads of shit and shitloads of bloat in app architecture in any area... also, procedural-oriented creates hideous function names. example: windows api. c api :-D still, I understand most of your points and I've agreed with them for a long time. OOP is interesting that most of its features seem useless unless you specifically encounter a case where one of them helps you (sometimes to a ridiculous degree) reduce code complexity and increase readability. after that, you start seeing potential application of that feature everywhere, even where it's not necessary. when you again realize where it really is necessary, and where it isn't you've mastered that feature :-D most of that features, at least in recent years, were made with huge corporate systems in mind, therefore to truly understand them, you need to encounter a huge corporate system scenario.
@eddiebreeg3885
@eddiebreeg3885 2 жыл бұрын
You can always take an example and say "uh, I don't need all those classes I could just do this" And that's the issue with examples: they're just that, examples that can't possibly represent the whole picture of what you'd actually be doing in a real code base. Take the coin flipping game program for example: in itself, it's really simple and I would argue that even YOUR code was already too complicated, you could have written everything in the main just fine. To which you'd probably reply something like "yes, but as soon as I need to be able to play from somewhere else in my code it gets hard to read..." and you'd be absolutely right, that's why we have functions. Now imagine that you're using a game engine, with a player, a myriad of other types of entities etc... The developpers who made the engine didn't just have your little coing flipping game in mind. In an actual non-trivial game, even the player becomes a potentially really complex entity, with a lot more data to handle, and a lot more interfaces to handle that data. You need somewhere to store said data, and functions to interact with it, a class provides both at the same time in a single place. And then there's inheritance, abstract types and all these things I won't even try to discuss here because it would get way too long. Case and point being that a limited set of really simple examples (however well chosen they might be) is going to fall a little short for demonstrating how powerful OOP can be. Over engineering is bad, that's something we can agree on. But if you want to make simple example, obviously you'll have to do a fair bit of it, because I think you'd be equally as confused if the example consisted of a super complex library that actually takes advantage of what OOP has to offer. It's a tradeoff. Of course we can write simpler code, but that's completely besides the point.
@hastingsx2865
@hastingsx2865 2 жыл бұрын
this is underrated comment
@qx-jd9mh
@qx-jd9mh 2 жыл бұрын
Nah, look at a programming language that uses modules and types to organize code. You can still expose a public interface without dumb OOP rituals.
@Elite7555
@Elite7555 6 жыл бұрын
7:10 1) It is trivial to pass objects around and call those methods elsewhere, instead of some nondescriptive function pointers; this could be part of an interface. Otherwise, yes, just use functions. Nobody would argue that. 8:05 2) Hashmaps are (compareatively) slow, not typesafe ("stringly typed"), genereally don't have code completion (IDE support), they are hard to debug, and cannot be checked by code checkers. I am not sure how ruby represents objects, but in any compiled language, yaml or json should get deserialized into native objects. 8:55 3) Yes, that indeed is a fair point. Sometimes, it is easiest to just use a function. Then again: If you use that function in several places, it can get tiresome, or if you have more than one config for different events, then this approach could eliminate errors; or if you need the config object and download method as parameters, then again, an object might be easier to handle. 17:10 4) In that case, you have a point, but in many other cases, this is very undesirable. First, you lose type information (can't say what kind of item you have got), and second, string comparison is very slow. Especially for exceptions, one should never use strings.
@chihchang1139
@chihchang1139 4 жыл бұрын
1. It is equally trivial to pass around functions. In fact, most OOP languages allow to pass functions as first class objects. 2. Hashmaps are not comparatively slow nor is it not typesafe. It depends on the implementation and language of choice. Code completion/IDE debuggers are generally not a good argument for or against paradigms because they can create these features, and oftentimes I find IDE auto-code changes more annoying than not (Jonathan blow has a video to demonstrate the issues) 3. Config object doesn't need to be an object even as part of parameters. Data is just data, which is what this video is demonstrating. 4. He used string comparison because that was the original code example. Also, re-think what types mean, losing type definition is a valid case in every kind of programming paradigm (for example, OOP allows for recasting and implicit casting, C lang treats pointers and blocks of data simply as block of data, and you can type it to do anything, etc, etc). I think what people misunderstand about this video is that none of this should be surprising or new. You really can't argue against non-OOP implementation because C is such a strong non-OOP language that it alone debunks any argument you can make against people who do not like OOP. The argument is just a reminder of how a more C-like thinking to program construction has advantages over a more Java-like thinking of a program, and that there's almost (and I believe) no advantage for a Java-like implementation using OOP over C-like implementation
@recompile
@recompile 4 жыл бұрын
String compares in most modern languages are practically free. Do a search for "string interning". You have some very confused and outdated ideas in that rant.
@bittergourd
@bittergourd 6 ай бұрын
Title should be "Do not use OOP on everything, even though that's the only thing you were taught at school."
@rlbond
@rlbond 3 жыл бұрын
I think you are always going to be able to find examples like this. OOP's strengths are in its ability to scale and to have abstractions. Small toy examples will always look better as procedural code because they don't need to leverage those strengths.
@Danielle_1234
@Danielle_1234 3 жыл бұрын
There are plenty of large non-OOP projects that have no problem with organization like the Linux kernel, and there are plenty of large OOP projects that are horribly disorganized, showing it's up to the lead architect's skill, not the paradigm, to keep code organized in large systems. That's how OOP sells itself (that it helps keeps code organized when systems become large), but that's not actually what OOP excels at. OOP excels at interfaces. Say I write a library for users to interact with. Creating an interface can make it easy for them to use my library. OOP is not required here, eg Python libraries are written in C, but OOP a well suited tool when it comes to this kind of development. Furthermore OOP excels at creating natural types. A natural type is a type that acts how you would expect it to, as if it came with the programming language itself. So, int is a natural type. String is a natural type, but barely. BigInt is a natural type. class UtilityWorker is not a natural type. The problem is, natural types require operator overloading, and arguably zero cost abstractions, so only Rust and C++ have this ability. But if you need it OOP excels at this too. (Though technically this is just another kind of interface.)
@LabGecko
@LabGecko 3 жыл бұрын
rlbond Did you watch the video? He starts off covering exactly what you said about toy examples.
@maksymiliank5135
@maksymiliank5135 Жыл бұрын
Inheritance is what makes OOP really bad if you need to change some of your UML diagrams. When you write OO code you are encouraged to extract the same logic into smaller abstract classes, then you inherit that behavior in a couple of derived classes. When you need to change that structure somewhere along the inheritance chain, the entire thing becomes a mess. It's better to use composition over inheritance to make it more maintainable in the future, for the cost of a little bit more boilerplate code. When you write in OO style you tend to write absolutely everything with classes. Even the "toy examples" which could be done with a couple of functions. It introduces a lot of unnecessary complexity and makes it harder to reason about.
@Boxing_Gamer
@Boxing_Gamer Жыл бұрын
Don't think it scales very well really. The web of objects, inheritance, factories and design patterns in general makes it a complete mess after some time. Seen it so many times.
@jasenq6986
@jasenq6986 Жыл бұрын
it definitely does not scale well from my experience. Its probably the antithesis of scaling
@element4element4
@element4element4 3 жыл бұрын
I was just skimming through the video and I think some of the arguments are a very silly. For example at 13:45 a OO-based code is replaced by a shorter non-OO code and then it is claimed: "I don't have to make the argument why his code is so absurd". That's some strange logic. His code was absurd if it was written for that specific purpose. But it was a simple toy-example to teach certain concepts in OO-programming that might be very stupid to use in this example, but might be very useful in much more complex codes. My day job is a theoretical/mathematical physicist and I do research within theoretical physics. Whenever I want to teach somebody a highly advanced and abstract piece of math, I use the simplest possible example to illustrate the concepts. It's very easy to counter argue: "I can solve this simple math problem with simple mathematics and with fewer calculations, do I need to argue why your advanced machinery is absurd and stupid?". Sure, but for more complex problems you need the more complex tools. The simple absurd example is only for teaching purposes. You didn't argue anything by rewriting simple toy-examples into simpler code, as they were by design not meant to be the best way to write that particular code. But a simple way to illustrate OO-design, which might not be useful unless you have the correct level of complexity and application. I am not saying that OO-design is good, I'm just saying that some of the arguments presented against it here are silly and unserious.
@draco2k729
@draco2k729 2 жыл бұрын
THIS! This video is rather idiotic. The whole "UML is shit".... this is an EXAMPLE. In a real world scenario you cant just write 100.000 little functions all over the place, even if each one is simple. In the real world, with complex systems you HAVE to plan, which is UML for. YOu HAVE to structure your code, which is OOP for. The whole video is just a pointless rant against OOP from someone who seems to never got in contact with a real complex system with more than 1,000 lines of code.
@moiattube
@moiattube 2 жыл бұрын
Completely agree with you While oop tendency towards overengineering requires revision, I don't think attacking toy examples is the way to go
@szredinger
@szredinger 4 жыл бұрын
I personally find UML sequence diagrams very useful when faced with undocumented, unknown code and trying to find out how it communicates with the rest of the system.
@kippers12isOG
@kippers12isOG 4 жыл бұрын
It seems to me that the best use case for UML is reverse engineering code lol
@Austin1990
@Austin1990 4 жыл бұрын
kippers12isOG Or UML may be used for documenting code so that reverse engineering is not necessary. Anyone who bashes UML has obviously never worked on anything appreciably complex and/or has no regard for understandable code. OOP provides abstraction that is most useful for making code more understandable. Not everyone uses it as such, but someone who disregards that aspect of it already has discredited their criticism of OOP. Namespaces can be used to group things, but namespaces may quickly become cumbersome and verbose. Think of APIs made to accomplish larger jobs. OOP is great for making such tools. And, in larger projects, OOP may be used to construct encapsulated machines with their own APIs. It’s great for working on teams because one sub-team just needs the defined interface of the API to use it. In turn, it makes debugging and refactoring easier as well.
@stevendeans4211
@stevendeans4211 4 жыл бұрын
UML is good for analysis. A way of stating the actual problem and the required solution.
@stevendeans4211
@stevendeans4211 4 жыл бұрын
@Jumpy Cat I have a pre release copy of the standard that I got back when I was designing with OMT.
@0xfeedcafe
@0xfeedcafe 3 жыл бұрын
UML are so useful, it sucks that not many people use it
@NICK-uy3nl
@NICK-uy3nl 2 жыл бұрын
The new generation of programmers are only taught OOP, they have no concept of simple procedural programming, they see everything as an OBJECT, for example, a simple (a+b=c) function turns into a complex, confusing and inefficient one-time-use object - and that's what irks a lot of programmers who have to read, debug and maintain such OOP code Of course, memory is cheap and CPU power is plentiful so performance penalties for using stupid OOP code is minimal, the main problem is maintaining such stupid code
@SpecOpsFerret
@SpecOpsFerret 4 жыл бұрын
Brian sounds like me while revising my own code after a few months.
@martinn.6082
@martinn.6082 3 жыл бұрын
Nothing more depressing than seeing what code I wrote 2 years ago. And that works for every year.
@mateuszdrewniak7152
@mateuszdrewniak7152 3 жыл бұрын
23:30 I mean come on. There's no way that this mess of nested if clauses (4 levels!) is better than the original OOP example. It's barely readable!
@gwho
@gwho 4 жыл бұрын
14:17 the same argument you make that visual representation of code is only good for small amount of cases... is actually the same argument for object oriented code and against procedural code with larger functions. How do you miss that?
@AlFredo-sx2yy
@AlFredo-sx2yy 2 жыл бұрын
7:00 pretty much is something i love about this vid. I mean, i dont agree with the overall idea that OOP is embarrassing, but lets be honest: that class was being used as if it was a namespace, and thats a problem many classes fall into... thats why i think it is very important to think of classes as structs with functions that do stuff to the data they contain. Its like having a struct to contain stuff and a function to affect it, but instead of having the function be external, you have the function inside of the class so you know it is associated to that kind of data. Cases like the one in 7:00 are displays of why overly complicating code really makes no sense. Why would you need a class to do all of the work that class is doing? all of that stuff is far better off as individual functions, put them inside of a namspace if you want to make it even more clear that they are related somehow.
@lupf5689
@lupf5689 Жыл бұрын
*[...] that class was being used as if it was a namespace [...]* Yes, that class is just a mini-namespace. In C# one might consider making the class and functions static. You'd never have to create an instance of it, since there is no instance related data used anywhere. Which would also save you the (very small) overhead of object creation. But wait ... not creating instances sounds a lot like never creating actual objects from the 'object template' that a class definition usually provides. That's not really OOP anymore, right? Oh wow! That almost sounds, as if an mostly OOP language like C# allows the use of procedural code, if you actually want to use it. *[...] Cases like the one in **7:00** are displays of why overly complicating code really makes no sense. [...]* Well, the overly complicated code boils down to ... public static class BunchOfProceduralStuff { /*Methods go here*/ } I can live with that. ;-) *[...] far better off as individual functions, put them inside of a namspace if you want [...]* Assuming you have a big enough project, you will naturally end with about a dozen methods called Parse(...), Print(...), Convert(...) or such. So yes, you should group methods together that Parse, Print or Convert XML data for example. Maybe another group of methods should handle our JSON data. Yes, that sounds about right. It seems we need a certain type of method to handle these two cases. It's almost, as if two different sets? ... or types? ... or .... classes? of methods might be needed to solve our problem.
@AlFredo-sx2yy
@AlFredo-sx2yy Жыл бұрын
@@lupf5689 it feels like you're trying to argue against what i said but somehow ended up saying the exact same things. Are you sure you understand what i said?
@lupf5689
@lupf5689 Жыл бұрын
@@AlFredo-sx2yy I sure hope so. Basically I was trying to point out that, what was shown in the video was a pretty bad example to demonstrate the flaws of OOP, since, as you already noted, there are no object instances involved anywhere ... so why would you use an OOP approach at all? Maybe it just disturbed me, that you didn't seem to separate the concept of "class" as a template for a container having data and/or methods from the concept of object instances that may be created using that container structure? I'm not sure anymore. Also, it's friday afternoon, there was nothing usefull to do at work anymore and I was bored. Sry :-/
@AlFredo-sx2yy
@AlFredo-sx2yy Жыл бұрын
@@lupf5689 dont worry, i mean, that is basically what my comment was about, that the video's example is just showing a situation where using a class makes no sense, which is what i was pointing out. That OOP is not bad, its just that misusing OOP can lead to nonsensical code like what is shown in this video.
@David_Raab
@David_Raab 4 ай бұрын
You can see on what they relate to, by inspecting the arguments of a function. OO basically just anyway translates to an arguments that is passed as an argument but hidden by many languages. object.function(a) is the same as function(object,a). But somehow OO thinks that one piece of the argument is somehow more important than other. Just as an example: You write a function that concatenates an array with strings together. So your function takes string and array. Do you attach that function to the string or to the array? How about turning an array to a list. Is this a List function because list must turn your function to an array. or is it an array function as the array must know how to "build" itself? How about a function that takes a Hero, an Enemy and a Place. Now you want different logic for all different combinations. Where do you put your "damage" function that calculates the damage? To the Hero, Enemy or to the Place? Now consider just a "damage" function that takes three arguments. A function named "list->array" or a function named "join". If you like you maybe can put them into namespaces or modules. Game.damage() maybe?
@PetarLuketina
@PetarLuketina 4 жыл бұрын
In your Python code, just type: import this Run the code and that's all you'll need.
@Watcher-of-Forms
@Watcher-of-Forms 4 жыл бұрын
Unless you need performance. Then you're screwed with Python.
@Watcher-of-Forms
@Watcher-of-Forms 4 жыл бұрын
Also if you have a big project. I am maintaining a procedurally written software and boy oh boy do you not want to maintain this stuff.
@PixelThorn
@PixelThorn 4 жыл бұрын
@@Watcher-of-Forms you mean maintaining procedurally written software is a chore?
@Watcher-of-Forms
@Watcher-of-Forms 4 жыл бұрын
@@PixelThorn one of the advantages of oop is good encapsulation. You change code and the rest of the code stays the same. Also, I don't know how well maintaining a clear flow is possible with procedural, but this code needs globals which can be modified anywhere, making it very hard to understand what is going on at any given time.
@zomakblah7804
@zomakblah7804 4 жыл бұрын
@@Watcher-of-Forms Not In today's computer world... I work in CGI and the programs handle Gigabyte size files like"Zbrush, Maya, Blender... they all use python. so your old day's argument is shit in today's world.
@ChrisHaveard
@ChrisHaveard 4 жыл бұрын
Write about 20k lines of code (LoC) for an initial release with 3-5 devs and a formal scrum/kanban team, expect another 50-70k LoC over 5 years from 20+ developers of various competency. For your code contract, write unit tests, component tests, contract tests, and integration tests. Let's also consider exposing the API, versioning, documentation for the end user and the developer, performance and logging. What if we want to extract functionality from the app for use in other projects or maybe convert it into a library or smaller (micro)services (because now you have the budget for horizontal scaling)? There is a balance between ease of development, maintainability, testable code, and performance. Procedural code is fine in the scope of one-off scripts. When it comes to releasing an real app into the wild... I'll stick with OOP as part of the development procedure.
@Zuap
@Zuap 4 жыл бұрын
Linus Torvalds and Linux says hi... (a very large colaborative code base all in C and low level, 90% will never make something that hard in our lifes - ok C can replicate some OO concepts but it is not OO by nature - just to say that it all depends in the quality of the developer, it is about the carpenter not the hammer). But I agree that for a team of inexperienced junior developers OO can help making life easier, so a senior can keep things under control more easly (and it all depends on the project, e.g. videogames and OO love each other, but in other areas it is overkill).
@abishekkumar316
@abishekkumar316 4 жыл бұрын
banana gorilla problem
@georgeaustin7805
@georgeaustin7805 4 жыл бұрын
@Nigel Kipling dude you have no idea shut the fuck up. The poster was soooooo right
@georgeaustin7805
@georgeaustin7805 4 жыл бұрын
@Nigel Kipling sorry did you just copy and paste 100 lines of code and add a suffix to the function name to add some more functionality. Go home you utter peice of ignorance
@emerynoel567
@emerynoel567 3 жыл бұрын
I've heard a lot of people say "OOP is a mistake". Maybe there are better paradigms, but I don't think this video does a very good job of proving it. The author is too derisive of viewpoints he doesn't hold or understand. He complains about not understanding single-responsibility, then immediately and unironically explains it using different words. In case 1: I'm not sure the author understands what a "class" is. Classes don't have to be existentially deconstructed representations of physical objects; there is no problem in a class being a simple container for logic. You can also have classes (POCOs/POJOs) that are pure data. Classes are just places to put (related) logic and/or data. You might put your 3 patent functions in a "patents.ruby" (?) file that loads into the global namespace; I would put mine in a Patents.cs file, with one extra line declaring the file to "be" a static class. I have more characters to type when I want to invoke my functions, but my global namespace is nice and partitioned, and if there is some intricacy or translation involved in parsing/loading the config, I have a nice private place to put that logic. I would write a Config class that contains a CreateConfig function, and that function would return a Configuration object*. You would write a global function that still returns an object/hashtable. There is almost no difference here. So in my case, yes, I _might_ have an object to dispose of**, but the trade off is less polluted global namespace. I think having code separated into classes makes it a lot easier to mentally parse, rather than a wall of global functions. *My Configuration object would have strongly-typed properties, no need to guess what's in the hashtable at runtime. **If my class is static, I don't even have to instantiate, handle, or dispose of the object. I _am_ interested in learning more about why OOP is a mistake, but so far it has been difficult to find arguments that have weight. It seems like the author and his peers value one form of thinking to the exclusion of everything else, while OOP programmers are perfectly happy using procedural code inside a class function. It seems like OOP can do everything that Procedural programming can do, but is the reverse true?
@cbot3400
@cbot3400 3 жыл бұрын
You can do everything you just said in C without using classes or objects. Object oriented programming can be done in C using structs. Most C kernel driver APIs tend to be closer to OOP. The problem is people design their software around object oriented design instead of OOP being a tool to use when you need it.
@emerynoel567
@emerynoel567 3 жыл бұрын
@@cbot3400 That's interesting about C, I wonder how much is OOP-like vs actual OOP (like polymorphism). I think I would describe the issue as "people design their software using _inappropriate paradigms_" or even just "incorrectly", rather than pinning it all on OOP.
@cressdrg9562
@cressdrg9562 3 жыл бұрын
Yea, it's pretty embarrassing that he doesn't even mention/understand that methods can be static... lol.
@youareliedtobythemedia
@youareliedtobythemedia 3 жыл бұрын
the true problem with OOP is that you will end up with _state_ everywhere. it's kind of like using global variables instead of locals. it's not that classes are bad, there are use cases for them (containers for example) but writing your whole program in an OOP style actually makes it very hard to reason about what your program is actually doing and in which state it currently is in. what you should do instead is use pure functions where possible (meaning a function that does not depend on any global state, only an its explicit imputs), because they are the best at composition. and move any state as far up the call stack as possible. also try to avoid mutation of state when possible.
@readypetequalmers7360
@readypetequalmers7360 3 жыл бұрын
@@youareliedtobythemedia That's what I also was thinking. The video didn't do much to address that aspect, which I do believe is the most important point especially when dealing with threads or objects in memory/leaks...etc.
@Konslufius
@Konslufius 3 жыл бұрын
I literaly don't know how to make a GUI without OOP.
@lalle5000
@lalle5000 4 жыл бұрын
An object-oriented language doesn't require everything to be in objects. Sometimes I think objects are an extremely intuitive way of thinking, and make structuring your code in an understandable way an easy task. However, if one is writing e.g. Java or C#, that doesn't mean that every bit of logic must use the concept of objects. E.g. in the coin flipping game, as you yourself demonstrated it is possible to write a better way of running the coin game in Java, which is an OOP language. And that fact is what this all comes down to... These examples are simply BAD CODE. You can't make your argument by showing examples that clearly weren't meant to implement objects, and then state that OOP is simply bad. All that you have proven is that sometimes it's bad to think in terms of objects, but that doesn't mean that an OOP language can not be used with another mindset. Objects are just one of the many tools of the languages.
@IrregularPineapples
@IrregularPineapples 4 жыл бұрын
Wrong. Java e.g. requires everything to be objects. And unnecessarily axiomatically so. And no, static isn't it. If you're using static in your Java you're most likely doing something wrong or irresponsibly lazy.
@bennievaneeden2720
@bennievaneeden2720 5 жыл бұрын
It bothered me how his final solution had half camelcase half snakecase
@popsicle199
@popsicle199 8 жыл бұрын
14:51 the control flow structures look like a sine wave.
@WookieMiner1
@WookieMiner1 Жыл бұрын
Clickbait title, It's case by case completely, I use OOP for large scale platforms/applications and even most of the smaller tools I write however occasionally will use procedural programming to write tiny pieces like shell or python scripts as it is quicker and easier to read in certain use cases. I learned how to program as a young child and as soon as OOP clicked in my head I've never really needed to use PP again, it's just felt inferior and after years of experience having to write code on platforms written like this, it's just not scalable. Anyone who thinks PP for large scale projects (e.g. for mid/large size business logic) is a good idea is doing it for job security (or aren't fully grasping OOP concepts) - trust me I've seen really good attempts at it too but in the long run nobody wants to code on those platforms, they are bulky, messy and are just straight up horrible codebases to work on. even if it did give me a job at the time!
@uumlau
@uumlau 5 жыл бұрын
A lot of critics of this video appear to be arguing that of COURSE the procedural code looked simpler, because these were simple examples to begin with that were used to make the object oriented solutions easier to understand. That's a reasonable point, but I disagree. I deal with absurdly complex object oriented code on a regular basis. Typically, it's not complex because what it is doing is complex, it's complex because the compartmentalized code is all over the place. For maintenance purposes, I've gone in and created Helper classes to move sets of changes that typically go together all into the same file, so it's clear to whatever newbie developer where all the pieces are (they're in this one file!), so they don't miss anything. In so doing, I've done exactly what Brian predicts: I've created yet another class without improving functionality, but only to meet a particular vision of where the code should be contained. The useful unit of work is typically NOT whatever classes people dream up when writing code. Command objects, manager objects, controller objects, factory objects, etc., don't have any conceptual basis in the code, except as blocks of code that hold other blocks of code. Most classes, as typically coded, are just namespaces, not actual entities that you'd use to accomplish tasks. The command/manager/controller object merely contains the methods that actually do the commanding/managing/controlling. And in turn these objects reference and call still other objects that do the same thing. In most of the cases where there are very complicated workings of code, and we are worried about the code being maintainable in the long run, procedural code that lets us read what is being called and how it is being called and what kind of side effects it might have at the top level (or close to the top level). When it's split up into objects, supposedly to be more maintainable, all that has been done is to obscure how the code really works, and obscures all the potential bugs. Yes, the "var result = command.Run();" is delightfully short, and you know that the command got run, but without knowing the state of the command or what the Run() method does, you've got a few hours of testing to figure out why and how that error that keeps appearing in the logs is being caused. If instead, it were just a method such as "updateInventoryEquipment(inventoryId, equipmentList);" suddenly there is no state, just arguments. I can test with whatever arguments I'd like without instantiating the entire IoC framework, and debug the problem in minutes instead of hours. People keep on saying that if the OO is designed right, then it really is simpler than procedural. Well, I can make the same argument in reverse: if the procedural code is designed right, it really is better than OO. That's NOT my argument, I'm pointing out that saying "if OO is done right, it works", while a reasonable statement, completely fails as an argument, for the same reason that Socialists always say that whatever Socialist system that has collapsed simply wasn't done right, never mind that "not really Socialist" appears to describe all real-world Socialism. So if an OO system that is too complicated to work with can always be described as "it wasn't done right", why does that seem to describe all OO systems? So, in my real world of real world OO systems, I see only "it wasn't done right" OO systems, your ideal of "OO done right" doesn't really exist. And Brian's argument is valid, not just for these trivial OO examples, but pretty much every real life OO example I have ever encountered. This isn't to argue that OO is "bad". Objects are useful. The argument here is that making objects the primary building blocks of code results in worse code than making procedural methods the primary building blocks of code. You end up with lots of objects that you really don't need, and those objects in turn tend to hide what the code is really doing. Maybe there is some ideal OO approach that is utterly beautiful and disproves my arguments, but if it is so very rarely encountered in real life (never, in my experience), then I have to agree with Brian that a mixed procedural/object approach is better, where objects exist, but are secondary entities, not primary ones.
@jobicek
@jobicek 5 жыл бұрын
I don't really think the problem is that the examples were simple. The problem is that they were just, IMHO, terrible. I'm not criticizing Brian for choosing them. But they don't do OOP any favours simply because they're terrible. I don't really have a problem with having to stick everything into classes. Yes, you end up with classes that are essentially code modules. Even if they have some state. While it might not be ideal, that's not really the problem. The problem is taking OOP too far. And I'm certainly guilty of writing convoluted OO code. Typically as a result of the constrains of the language or platform. I wasn't keen on scratching my left ear using my right hand while standing on the left leg, squinting my right eye and singing the anthem. But if it's what I have to do to get what I want, then I sometimes do it. I also don't agree that UML is useless. It's just a tool. Yes, like 15 years ago I tried doing the full monty, everything by the book, and I just felt like a bureaucrat. Most of the models were simply useless, waste of time. I would hate having to completely model a project. But it can be a useful tool. However, it's just a tool. It won't miraculously make a poor design great. And it doesn't guarantee you'll arrive at a great design. It just allows you to show what's going on which can give you insight. Back at the university, I also created a library for argument parsing. Much more ambitious than the one presented here. Including comments, it ended up over 100 kB. :-) It was OO and most of the methods were written in a functional style (a lot of data processing). And it contained some of the aforementioned overhead ear scratching because I was trying to achieve a great user experience (I set the bar almost impossibly high) which proved challenging. And the assistant that graded my code was like: This is not how you write C#. But it's the most readable C# I have ever seen. :-) And it had plenty of methods with triple digit line counts. I also made use of operator overloading which often isn't popular. I'm certainly not afraid to break the rules. It's like in other fields. You have to learn the rules to break them. Successfully following them should give you something usable. Breaking them, on the other hand, can give you greatness. Or trash.
@ryanj.s9340
@ryanj.s9340 5 жыл бұрын
uumlau bjj
@ArachnidAbby
@ArachnidAbby 5 жыл бұрын
@@jobicek did you switch to an alt?
@ntl9974
@ntl9974 5 жыл бұрын
Cool
@quangtung2912
@quangtung2912 5 жыл бұрын
I think critics also come from confirmation bias. In few years ago, I actually watched this video and thought that it came from a guy who doesn't know how to do OOP correctly. At that time, I learned SOLID, Design Patterns, Domain Driven Designs, etc and I considered OOP is the best tool for building software. But now I think I became an OOP hater because of data oriented design and functional programming =)))) And one of my favorite programming language: Rust even enforce not to code in OOP style :)))) And now I think the best way to model real world is through relational modeling (use database or embed it into code), not through some kind of object graphs.
@alphalobster8021
@alphalobster8021 8 жыл бұрын
I was there in the early 90's when OOP started to emerge. I loved it. OOP encouraged developers to better analyse the problem and define clear structures. With the finer grained modules that resulted, version control (exclusive locking - which is all that was available at the time), became more manageable. Who remembers Borland Delphi? The early Gurus were at pains to point out that OOP isn't anything new, it is what you should have been doing all along (but nobody was) with some extra features. Fast forward 20 years, it seems programmers had all been moved to the "Work Prevention Department" en masse. The utterly irrational and insatiable need for 'gurus' to patternize, abstractize, distribute and XMLize everything had me shaking my head. The equally irrational and insatiable need for developers to follow the Gurus effectively ended any possibility that IT projects could host productive teams never mind there being any danger of them delivering robust, effective and performant software. In the latter stages of my career I was involved as a decision maker in various projects under various hats with titles like project manager, technical lead or architect. Invariably I managed to steer the teams away from the trends and managed through constant evangelising to get them to produce as little code as possible, concerned only with delivering functionality and performance for which there was actually a requirement. I found it easy to create productive teams who always delivered. I never understood why other managers were at the mercy of their tech heads, who clearly forgot what they were there for - to deliver software.
@pascallubbers2286
@pascallubbers2286 8 жыл бұрын
I would like to elaborate one thing about the example given in 14:50. Imagine a situation where this code is in a closed environment, for example on a disc. You, as a programmer, want to extend this functionality. Say you want to add a new item type. Now if the code on the disc was written in an object-oriented fashion, you could easily add a new item by importing the item class, extend it and override the tick behaviour. In don't see how you could do this more easily with the procedural code you have written (using the switch statement). It all boils down to the fact that OOP is not a better way to write more readable code. It makes your code more maintainable, testable and extendable (like the example I gave) because it encapsulates behaviour. And like everything in programming, different situations needs a different solutions. You should always apply the solution that fits the problem and the situation the best. This implies that object-oriented design is not always the way to go.
@neko6
@neko6 4 жыл бұрын
How often does one extend classes that they have no access to? I've never even considered doing that in over a decade of professional software development...
@astavie2920
@astavie2920 4 жыл бұрын
@@neko6 it happens very often when modding games, for example
@jordanray1537
@jordanray1537 2 ай бұрын
Late to the party here, but I found your question interesting. Unless I'm misunderstanding your point about a "closed environment", you could extend this functionality by simply adding a new branch to handle the next case. If what you are saying is we don't have access to this method, by that logic, how would we be able to "import the item class"? Irrespective, writing an API that allows developers to add their own items with a given name and values for the various variables (days remaining for example) and then storing items in an appropriate data structure, such as a hashmap, seems like a reasonable solution to extending this functionality procedurally. Better yet, you could provide a callback function in such an API with the appropriate variables exposed as arguments.
@AmedeeVanGasse
@AmedeeVanGasse Жыл бұрын
For the Gilded Rose kata, which you solved with a switching branch, the original assignment is to extend the system with additional products: "Comjured" items. The assignment also says: "Feel free to make any changes to the UpdateQuality method and add any new code as long as everything still works correctly. However, do not alter the Item class or Items property as those belong to the goblin in the corner who will insta-rage and one-shot you as he doesn't believe in shared code ownership (you can make the UpdateQuality method and Items property static if you like, we'll cover for you)." How would you tackle that?
@alphaforce6998
@alphaforce6998 Жыл бұрын
_"How would you tackle that?"_ By doing a common-law rescission on the application (and any other papers signed) to whatever "school" is perpetuating such nonsense, and then suing them for fraud and failure to disclose all material facts if they choose not to honor the rescission. If you are paying someone to teach you how to write programs, then they should be teaching that in the most efficient manner possible. If you were being trained as a mechanic, and your assignment was, "You can replace the oil however you want but you must use the sledge hammer as part of the process." The real test is "are you dumb enough to do what you're being told to do here?"
@meyes1098
@meyes1098 Жыл бұрын
@@alphaforce6998 Putting you under certain constraints for an exercise is not bad.
@alphaforce6998
@alphaforce6998 Жыл бұрын
@@meyes1098 Yes it is, if the exercise is an exercise in futility.
@GdeVseSvobodnyeNiki
@GdeVseSvobodnyeNiki Жыл бұрын
Hashmap.
@Jacquobite
@Jacquobite 4 жыл бұрын
There is a common English saying "Can't see the wood for the trees". I think it sums up this video nicely.
@skyfall-t8p
@skyfall-t8p 5 жыл бұрын
22:37 I would rather use a single hashmap of the sum type of integer, bool and string. That way you avoid scattering across 3 different hashmaps keys that must not duplicate. The sum type should be familiar to anyone doing functional programming, and it can in fact be just as helpful in imperative programming.
@CristiNeagu
@CristiNeagu 5 жыл бұрын
Objects are a way of combining a data container together with the actions that can be carried out on that data. That's kinda it. You could just have a standalone data container and then some separate functions that do things with that data, but you'd still be doing object oriented programming, except you're in denial about it. Sure, there are a lot of abuses of OOP and it is good that people are pointing them out. But to say OOP is bad and to be avoided is a bit extreme. P.S. Yes, i know this video is 3 years old, but it popped in my recommended and my inner keyboard warrior was triggered!
@erichardy6013
@erichardy6013 5 жыл бұрын
Your definition of OOP reads like just "doing things with structured data", which describes all programming in general. C becomes an OOP language. Prolog does too. Unless I'm missing something you meant, why give a new name to "programming" at all? And then how is it meaningful to say OOP is a good way to program?
@CristiNeagu
@CristiNeagu 5 жыл бұрын
@@erichardy6013 Because OOP adds those levels of polymorphism, inheritance, etc. Those are not easily achieved with traditional programming (depending on the language). And OOP is a good way to program in the same way that it is a good idea to keep your tools well sorted. A method attached to an object is only meant to work on that object. When changes are made to the data structure, it is easy to identify the methods that need to be updated. If you just have standalone procedures meant to work on a certain data structure, there's nothing actually forcing you to respect that convention. It's all implied. It's a disjointed procedure. Not to mention how hard it may be to understand that it needs to keep up with changes to the main data structure. For most things, yes, you can replace OOP with normal procedural programming. But depending on complexity, your program is going to be a confusing mess. OOP keeps everything in one place and easy to understand.
@erichardy6013
@erichardy6013 5 жыл бұрын
@@CristiNeagu so the people who are "in denial about using OOP" aren't actually using OOP just because they have structured data and functions that operate on that data. There are a set of other principles like inheritance (polymorphism is a separate point as it can be achieved in many other ways) that make up OOP and people can agree/disagree with their values without lying to themselves
@CristiNeagu
@CristiNeagu 5 жыл бұрын
@@erichardy6013 No, they are in denial because they have procedures meant to work only on certain data, they are grouped together with the data structure, except they are not in the same object.
@CristiNeagu
@CristiNeagu 5 жыл бұрын
@odd135 That's why polymorphism is a thing. Or, of it requires the exact same function, inheritance.
@ChristopherSalisburySalz
@ChristopherSalisburySalz 2 жыл бұрын
In closing you're referring to the OOP concept of encapsulation I think. I think this is possible because we do it with third-party libraries. Most programmers that program in a high-level language use several third-party libraries that handle things that would be a whole project in their own right like parsing and creating Excel spreadsheet files. You don't have an in-depth knowledge of what these libraries do to use them. You also can't harm them in any way by changes you make to your project code.
@nyscersul42
@nyscersul42 Жыл бұрын
He says exactly that, and gives a good explanation of his reasoning, in the video he mentioned at the beginning... His focus in the reasoning was almost exclusively on the encapsulation part. I disagree that oop is bad, however i agree with other comments here and there that adhering to any set of rules too strictly is bad. The best programmer can use many different approaches, in different contexts. The more i see these sorts of things, the more thankful i am to be self taught, and as a consequence, not stuck in with any particular dogma.
@nyscersul42
@nyscersul42 Жыл бұрын
If someone tells you how to use a tool, it becomes far more difficult to think of other ways to use it.
@Shneebly
@Shneebly 10 ай бұрын
Encapsulation at the module or library level is not specific to OOP. Everybody supports that. The debate is whether the more fine-grained encapsulation at the object level is useful.
@DEBIEL918
@DEBIEL918 4 жыл бұрын
"Hammers are better than axes!" *shows examples of nails to be clubbed into a board*
@nialltracey2599
@nialltracey2599 4 жыл бұрын
The problem with your analogy is that a good language should never be a single tool -- it should be a toolbox containing multiple tools. The problem is that most OO languages make OO mandatory, and you find yourself with a single tool instead of a whole box.
@wierzba1992
@wierzba1992 4 жыл бұрын
Niall Tracey your explanation lacks logic on so many levels. Use multi paradigm language like C++ then... Should a oop language follow non oop rules? Nonsense
@nialltracey2599
@nialltracey2599 4 жыл бұрын
@@wierzba1992 My point is that there shouldn't be such a thing as an OO language, as every production-level app will have features that don't make sense in OO.
@AWZool
@AWZool 4 жыл бұрын
@@nialltracey2599 If you don't need OO in your code, you can do it in an OO language (eg: programming everything in a single class, which I'd kill you for on a code review, but it's possible, and for very very simple tasks)
@dovos8572
@dovos8572 3 жыл бұрын
use the backsite of the axe as a hammer
@AntsanParcher
@AntsanParcher 8 жыл бұрын
I largely agree, but I have two objections: 1. Specialized types enable compile time checking. Having a CommandLineArgDefs type (sorry for that name, there's probably a better one) instead of a hash map makes it possible to check whether you accidentally are using some other hash map (with the same key/value types) in that context. Of course OOP doesn't do much to help you with that - something like Haskell's newtype is much more appropriate. 2. The use of polymorphism as shown by you is a matter of taste. You don't like it to do the things you've shown here and that's fine, others feel differently and that's also fine. But polymorphism has another advantage: It allows someone else to expand upon your code without having them change it. As an example, take a language that has a more complex notion of what a number may be (and sees operators just as functions with infix notation). It already has '+' defined and at a place where a programmer cannot change it (and thus cannot add to a large switch statement). If the programmer adds Complex Numbers or Surreal Numbers or anything like that without polymorphic functions would need to define a new function, like "add" maybe. With polymorphic functions the can define a new version of '+' for all relevant combinations of differently typed numbers. This has the added benefit that, in a language with proper type inference, a whole host of other functions defined on top of '+' now also may work correctly on these newly defined number types. The same goes for libraries.
@alectoperez1383
@alectoperez1383 6 жыл бұрын
Why not just have operator overloading? Then you don't need run-time polymorphism :)
@jaesangkim1930
@jaesangkim1930 6 жыл бұрын
I like your comment and agree with it to some degree at least.
@kurttruk2
@kurttruk2 4 жыл бұрын
I'm not learning anything here expect "when making choices, try not to be an idiot". Well duh! Also, learning examples often teach hard or complex concepts in overly simple examples where the complex concept is not really required. This is because using the complex techniques should be acessible WHILE the new student is a bit confused. After all the student is new to this. Best let them only have one new complex thing at a time. And that is rather hard to set up. If you don't understand why education examples of code are so weird, it might be that you are good at code and bad at teaching.
@tonikrause
@tonikrause 2 жыл бұрын
Nailed it.
@achtsekundenfurz7876
@achtsekundenfurz7876 2 жыл бұрын
Can confirm, I am bad at teaching.
@schwickmcjohnson6786
@schwickmcjohnson6786 3 жыл бұрын
Saying OOP is sucks is like saying butter knifes suck. You shouldn't use a butter knife do a steak knifes job, and you shouldn't use OOP for smaller, more specialized software.
@mycouchsmellslikesoda1625
@mycouchsmellslikesoda1625 3 жыл бұрын
"Im just gonna use a small example to demonstrate this OOP concept" "oMg YoU uSe AlL tHeSe ClAsSeS fOr SoMeThInG sO sImPlE??"
@skipfred
@skipfred 3 жыл бұрын
I like that you acknowledge right in the beginning of the video that the strongest argument for OOP is in large, complex programs, then proceed to not look at any large or complex programs and conclude that OOP is bad based on that.
@yoursubconscious1774
@yoursubconscious1774 2 жыл бұрын
He did state in the video that if anybody can find GitHub repositories with 1000+ lines of code email him and he said he’s just going to look into small examples that he found on his first search. This video is just a starter explaining it
@twiksify
@twiksify 4 жыл бұрын
Once you disregard of classes you've essentially missed out on a layer of encapsulation. How would you write a unit test for a method which depend on solely other methods? It's easier to maintain and test code that allow you to mock and verify the interaction between dependencies.
@xwtek3505
@xwtek3505 4 жыл бұрын
Similarly to testing a class which depend on other classes. You abstract the dependency out even when you use procedural programming. Alternatively, you test the dependency first. Mocking is not exclusively OOP. Also, mocking is hard, so ideally it's only used when testing for side effects. If you have to mock the entire classes, then there is something wrong with your code.
@purplevincent4454
@purplevincent4454 Жыл бұрын
One of the most annoying things of dealing with object oriented programmers is that they will never even acknowledge the fault of the paradigm because "that's not real object oriented programming bruh". Yeah, even though the name of the paradigm is OBJECT ORIENTED who would have thought you shouldn't have used an object there. There's no reason to be tacking on fields on everything and making it an object. Keep it functions and functional. Go procedural if you want, you don't need to go full immutable/functional style. Just keep it function first. Then data. Not OBJECT ORIENTED from the start. That's how you fundamentally end up with bloat. Object oriented is a paradigm that has bloat built into it from the start. And its origin comes from a fear of further change down the road. We need to be as "flexible" as possible so we over engineer everything from the very start. This type of fear has created such bloated architectures that sprawl across so many different systems and will continue for a very long time, because we can never point this out because it's "not real object oriented programming bruh".
@ratfuk9340
@ratfuk9340 Жыл бұрын
Exactly, just look at all these comments saying these are just examples of bad code, it's not OOP's fault even though multiple examples are from OOP gurus. Pure fucking cope. I don't see anyone suggesting better solutions in the OO style for any of these either, they just say the examples are bad and totally ignore the actual point which is that not everything can be neatly conceptualized nor implemented as an object.
@jeremyheiler
@jeremyheiler 8 жыл бұрын
The example where you refactor the polymorphic solution into a switch statement is a good example of cleaning up code. However, I don't think this is strictly an issue with OO; rather, it is an issue of expressivity. In essence, Item is a typed function. That is, it's an interface (a base class since this is Ruby) with a single method. This switch statement solution is a closed system because the only way to change it is to modify the code. This is an example of the expression problem. Polymorphism is one way to deal with this because instead of hardcoding the cases, the caller is required to provide the case they're interested in. I agree that this is overkill for this small example, but I think it's important to point out that this is very useful in scenarios where programmers do not control this code and need to be able to extend it. The same thing is true for the argument parser example. You're taking a general solution and making it specific. This is all well and good, but defeats the point of making the solution general. I agree that general solutions are not always useful, but they still are useful. And they don't have to be implemented in an OO-style. These issues transcend OO design patterns, which is why I brought them up.
@atelesh
@atelesh 8 жыл бұрын
Exactly!
@dejaimeneto6093
@dejaimeneto6093 8 жыл бұрын
+Jeremy Heiler This video focus on "How to rewrite OOP as procedural", and not on "How to make more reusable and extensible code by using procedural over OOP". All of his examples actually fall shorter on extensibility.
@aahnecroth
@aahnecroth 8 жыл бұрын
+Dejaime Neto yeah, because there was never the case that code had to be extended in any point of time.
@theb1rd
@theb1rd 8 жыл бұрын
Jeremy, I think your objection supports Brian's point... the exception proves the rule. A slavish devotion to extendability is the hobgoblin of OOP minds. Yes, polymorphism can be applied to provide extendability, but it is usually not a worthwhile complication to the system.
@bitwize
@bitwize 6 жыл бұрын
Polymorphism can be implemented procedurally with a table (array or hashmap) of function pointers.
@davidhunt7427
@davidhunt7427 4 жыл бұрын
Great stuff!! I graduated from college in 1978 with a Masters in Computer Science which was when the first Apple I was showing up. All languages were procedural then and rather incomprehensible when coders overused the infamous _GoTo_ statement. The introduction of structured coding techniques, in which coders wrote code with only one entrance and one exit, was a necessary godsend. Object oriented coding was a natural when creating Graphical User Interfaces within an event driven context. But I agree with Brian that their overuse can simply be confusing. Where I think Object Oriented Programming really shines is when code has to be modified and updated. If it's initially done right, OOP can be a great deal easier to change and maintain over time. The commercial computer programmer is always in an environment where the legitimate business needs of his employer are changing faster than the needs can be specified, much less having the additional time to design, code, and test such updates. And my favorite programming language is still C. It really is the closest we can come to having a high level assembler language. And for many applications, the additional runtime overhead of using OOP practices can not be justified. I really do believe that well written C code will be easier to understand by new coders on any given project than most any other programming language. The power of being able to create abstractions at will is what separates the poor programmer from the savants,.. but then the question becomes what's the easiest means to understand, implement, and maintain such abstractions in actual practice. The less abstractions one has to deal with initially, the faster the learning curve, but also the more work to create higher abstractions as later necessities demand. No one would create a single map than can simultaneously serve all the functions that a map can serve. That would simply make the original map incomprehensible. It's much the same with any intellectual tool. One more thought. As a commercial computer programmer, I always thought the most important piece of documentation I should write was what was the business need being served by the software I was writing. It always amazed me how much software was lost, not due to technical reasons, but because management changed,... and the new managers had no idea what the software was still being used for.
@albirtarsha5370
@albirtarsha5370 4 жыл бұрын
Great points! I have long thought that applications should come with a short document of intended use. This document would be like a "Quick Start" document stating how the main features are used, what is the intended workflow using these features, and exactly how this addresses customer needs. This is analogous to market a hammer as a hammer and not as a Swiss army tool.
@ThePandaGuitar
@ThePandaGuitar 4 жыл бұрын
C is not bad, how about Scheme (LISP)?
@xpusostomos
@xpusostomos 2 жыл бұрын
Simula : 1962, Smalltalk: 1972... Better get your money back for that computer science degree
@davidhunt7427
@davidhunt7427 2 жыл бұрын
@@xpusostomos Given I graduated back in 1978, I believe my Masters of Computer Science was worthy for the time. If I had to pick one favorite Computer Language today,.. it would probably be Python,.. although I don't know as much about Python as I would like,.. it seems to be exceptionally well thought of,.. even if it is interpreted rather than compiled.
@xpusostomos
@xpusostomos 2 жыл бұрын
@@davidhunt7427 not a fan of python, the lisp languages are better thought out... And older too
@scienceontheright
@scienceontheright 3 жыл бұрын
OOD and OOP are just one approach to coding solutions, not a one-size-fits-all approach. I've been coding professionally for about 30 years (C, C++, C#, Java, Python, Golang, etc), and I have to say, your premise at the beginning (3:45) is something I have never heard before, or at least, not since the mid-1990s. Requirements come first. For example, if you are trying to model a chair, then it should be a highly-specific chair as defined by the requirements and the interface(s) needed for the consumers of that class. You never build a chair class for every and all chairs now and forevermore. Instead, you might be asked to build a class that models a gaming chair that has between 4 and 8 chair legs, can swivel, and can support up to 400lbs of a single human comfortably for a maximum of 8 hours at a stretch. In other words, the requirements define the models. And if you do it right, you get clearly defined interfaces that provide concrete boundaries. It sounds like you were taught something that is impractical at best. The examples you provided are an attempt to introduce OOP, not suggest that's how it should be done in the real world. Hence, your premise for this video, in my opinion, is incorrect.
@bgdgdgdf4488
@bgdgdgdf4488 2 жыл бұрын
Yes but the problem is, that's exactly what students are taught at uni. We were using java and even then, in first grade, I was really confused at why everything needs a class. It's abstract, and it never models reality. I think the only acceptable option should be something like python or c++ where classes are optional. And even then, i think the only logical class type are dataclasses. As soon as you start mixing in functions, the whole thing begins to lose meaning.
@bgdgdgdf4488
@bgdgdgdf4488 2 жыл бұрын
See the problem in your comment about a chair is, you never model a chair in your code. We shouldn't be teaching programming principles with real world examples that have nothing at all to do with real programming. It gives people a completely wrong picture of what's going on.
@GameDevNerd
@GameDevNerd 2 жыл бұрын
This dude in 2016 was nowhere near qualified for giving insightful and enlightened industry criticism of programming paradigms and language design, lol. I've looked at his Github and other videos just to get a feel for what type of dev he was at the time and where he's gone since then. Seems he came to terms with his inability to understand OOP that early in his career and embraced OOP, because not long after this video he ended up getting really into C# and Unity development, for example, and seemed like he got better at writing code. But I can tell from his work in 2016 he didn't have a clue, but was really cocky and over-confident (as mid-level engineers tend to be when they realize they're better than the juniors and starting to grasp the tip of the iceberg of more complex topics). He went head over heels for GoLang and the "minimalist" style, which you see through the entire video. But I saw where he was even trying to make his own language and took a really naive approach to lexing and parsing it by raw, hand-written string manipulation lol. No wonder he moved on from that project, lol. He clearly learned and got better though, and ended up doing quite a bit of OOP. The video fails to land a single blow against OOP, only attack cherry-picked pieces of code from the internet, often taken out of context. But I think he dazzled viewers with the cool, confident demeanor and good speaking voice, well-crafted words (for the most part) and the pseudo-authoritative way he voiced dubious criticisms of a paradigm he hadn't even come to terms with yet. Like he attacks the practice of UML, yet has _no idea_ what it's for or how many different ways (and at how many different levels of resolution) it can be used, or that it's one system/technique for _modeling_ which is a much bigger field of vital importance to many areas of the techscape. He bashed what he called "visual tools", because all he had seen before was probably things like the visual scripting tools for "GameMaker" and "low-code" tools. He'd clearly never had any experience with the enterprise modeling tools for Visual Studio, probably never even seen how the class designer can refactor a huge project in minutes rather than days and days of hand-editing files. He attacked the UML tutorial guy for generating really bloated code which probably was a pretty bad choice for an example, but the UML tutorial was probably trying really hard not to conflate a complex modeling lesson with complex code, and opted for a trivial sort of program ... yeah, I think it wasn't a great choice, but it was a forgivable offense. Then he attacks random bits of Ruby and stuff he got from only the gods know where ... just more strawman code, low-hanging fruits, none of it even in a well-designed language or from a well-written code base (the place you _actually_ have to go if you're gonna try to cut the throat of an entire paradigm or language design). He was also clearly confused about "short code" vs "good code" ... his idea of making stuff "good" was just making it really, really small and short. That's all he attempts to do, and leads up his reveals with "All you need is this!" ... short code is not necessarily good, unfortunately, and his wasn't really that good lol. His changes to the coin flip program were still kinda awkward and goofy-looking if tiny program size and brevity were the metric of success (like the crap with swapping the two strings around lol). Then, he wanted to throw a jab at "Uncle Bob", who he viewed as an icon of OOP, and clearly felt that if he could make Uncle Bob's code look dumb, he'd somehow win the argument. I haven't been able to find the original code Uncle Bob wrote (I'll find it eventually) but it was clear he had taken it out of context. He says yeah this is stupid, he has abstract classes, I dunno what this dumb marshaling stuff is ... yeah, clearly you don't, lol. It _looked_ like Uncle Bob was making some abstract marshaling code that could be swapped around for different concrete implementations, and marshaling can be a complex thing. It's hard to say much more without knowing the purpose/intent behind it and how well it suited the needs/problem it addressed. But all he does then is turn around and "minimize" the code again, lol. Making it into something more "GoLang-like" and "minimalist", again confusing quality and brevity (which are sometimes not correlated much at all). So he _might_ have taken a well-designed and robust marshaling system and just locked it into one fixed, unchangeable implementation, lol. I'd love to find the Uncle Bob code to really find out. Overall, no good punches were thrown that landed _anywhere_ in the vicinity of OOP as a paradigm or any well-designed OOP languages. He likes going after stuff like badly written Javascript with pseudo-OOP style. Javascript isn't an actual OOP language, in my book, it's a scripting language with way too many things (a bit of everything) stuffed into it and overcooked. The minimalist, "procedural" sort of code has its uses, and you can still write code that way in an OOP language when its appropriate ... overall, it was a really silly video but it got him a lot of attention and views (succeeded there, at least) and provided a really poor take for people struggling with the challenges of learning OOP: a paradigm which is _amazing_ to work with once you have finally ascended the learning curve of scale, architecture, design and quality. And it looks like he _outgrew_ these silly dogmatic ideas and moved on with his career, because he did some better things in the following years with languages like C# ...
@penvzila
@penvzila Жыл бұрын
You see, real OOP hasn't been tried yet!
@chigozie123
@chigozie123 3 жыл бұрын
OOP has its place. FP also has it's place. Claiming that one should always be favored over the other is to be mistaking. OOP favours encapsulation, while FP favours composition. Both concepts apply equally in the pursuit of good abstractions, which is really what should matter. EDIT: I meant to say that OOP favours inheritance
@yawaramin4771
@yawaramin4771 3 жыл бұрын
> OOP favours encapsulation, while FP favours composition I think you mean 'OOP favours inheritance, while FP favours composition'? Inheritance and composition are traditionally seen as the alternative approaches to each other. Both OOP and FP _encourage_ encapsulation though. OOP with classes and FP with modules (which, if you look closely, OOP classes are basically conceptually lifted from).
@chigozie123
@chigozie123 3 жыл бұрын
@@yawaramin4771 yup that's what I meant!
@coolemur976
@coolemur976 4 жыл бұрын
10:10 would love to see how all those functions scale in a huge project and how messy that project would be compared to OOP based project. It's unnecessary to use classes until it becomes a necessity.
@kim15742
@kim15742 3 жыл бұрын
In what way would it become messy? Once the code grows you split it into multiple modules, exporting only few functions, having many supporting functions. OOP makes members basically become global functions within the scope of its methods and you have no idea what will happen to them
@coolemur976
@coolemur976 3 жыл бұрын
​@@kim15742 OOP makes sure you have your functions/methods where they belong. You will never create a class Vehicle that has method meow() in OOP. In functional programming that's way easier to mix up (to put functions in wrong modules for example). Also, OOP has many other techniques to organise the code and logic. "OOP makes members basically become global functions within the scope of its methods and you have no idea what will happen to them" - ? Can you elaborate with examples?
@kim15742
@kim15742 3 жыл бұрын
@@coolemur976 In procedural programming each procedure has defined inputs and outputs (in functional programming this is even more strict). In OOP, a method has, in addition to its parameters and return values, full reign on implicit variables outside its scope (member variables). This is the same behavior as global variables and to me behavior of a method is harder to understand than of a procedure
@coolemur976
@coolemur976 3 жыл бұрын
Member variables is better than having some global variables scattered all over the place and used all over the place. "to me behavior of a method is harder to understand than of a procedure". So for you it's harder to understand method behaviour? Perhaps this is the problem? My point was: if you understand OOP and use it right, it scales better than functional in big projects. Is it harder to understand? Maybe. That's subjective. Also, there is a reason why people take OOP studies at universities.
@kim15742
@kim15742 3 жыл бұрын
@@coolemur976 Yes, exactly. That's why you don't use global variables in procedural programming. You have a lot more control to make it understandable and well-structured for yourself. And why is the university thing an argument? OOP is compulsory, as is functional programming and procedural programming
@NovaCyn
@NovaCyn 4 жыл бұрын
9:28 that entire tangent is just... false. Config is dependency injected on line 6? similar downloader on line 7. They're instantiated only when not found in the params. Calling PatentJob.new(config: my_config) will use my_config instead of instantiating a default config. The point of Sandi's talk was how by making small *replacable* classes, you can now change the patent to use a different downloader (for example one that doesn't use FTP) or a different config (perhaps one that reads environment variables?) without any changes to the existing compiled code. I fail to see how that is possible in the procedural example. It seems we are not solving the same issue.
@bradw2k
@bradw2k Жыл бұрын
Existing compiled Ruby code, what is that? If you need a different downloader in the future, you update the code in 5 minutes. A valid reason to make a class this customizable is if there are *already* multiple downloaders that you know are going to need to be passed by various callers. If there aren't, this is textbook over-engineering. I'm not surprised to see code like this from Metz, she straight-up recommends in her book to make code that is flexible in ways that you *guess* it might need to be some day. Terrible advice for newbies that ironically leads to less maintainable code.
@NovaCyn
@NovaCyn Жыл бұрын
@@bradw2k Dependency injection like this takes less than 5 minutes. It's a good habit, and it'll cost you no time in the common case, and save you 5 minutes in the case such a change is coming later. You're right that in a ruby environment compilation isn't a concern, but having your pull request touch a small number of existing classes is nonetheless. If you disagree with this then you must be working solo. Again Sandi's talk was one that assumes such an incoming change. She updated the class specifically because there was a need to make the downloader easily replaceable. Saying that you wouldn't make the downloader easily replaceable here literally means you're not solving the issue Sandi was. Look if you like doing shotgun surgery every time there's a change then by all means. Just don't bring that stuff to a professional team.
@bradw2k
@bradw2k Жыл бұрын
I'm unprofessional and work solo, so yes that's the difference
@nicklowe_
@nicklowe_ 5 ай бұрын
5 years ago i watched that original video on OOP being bad and it blew my mind , being a university student. Honestly that video was pivotal to my career and where I am now. This one just happened to pop in my feed. Thanks
@kasperbrohusallerslev2455
@kasperbrohusallerslev2455 8 жыл бұрын
Around 9:30 you claim that Sandi does not use constructor injection, but she does. She extracts a 'config' and 'downloader' from the 'opts' parameter. The construction of other objects work as a "default value". She does this because she has a well-defined default behavior, and because 'opts' is a hashmap that might not include these name-value pairs.
@FeroChau
@FeroChau 6 жыл бұрын
8:47 Why do we need a class for FtpDownloader? Because we may have other downloader such as HttpDownloader in the future. They could both implement Idownloadable interface and only the Idownloadable is being used in other classes. Only the object construction layer should specify which class uses which concrete class. 13:14 Your code can do the same thing but it's irrelevant to the UML. The fact that you can write shorter code doesn't mean that UML is garbage. UML is used for efficient communication among developers. Also, your code is unable to be tested. You may not need to have unit tests in this small case but it's not true in a complex case. Stopped watching.
@MrCorrectify
@MrCorrectify 4 жыл бұрын
I don't know what's more embarrassing, the biased code choices he used, or his inability to understand his own examples.
@nstdspace7003
@nstdspace7003 4 жыл бұрын
Please try to develop a huge, understandable, reusable and extendible api, maybe a game engine? without oo, and then make a video where you explain why you where wrong here.
@lemmingz95
@lemmingz95 4 жыл бұрын
I mean.. large functional codebases exist. I get your point though.
@storm14k
@storm14k 4 жыл бұрын
Depends on the language and it's features to me as to how well this can be done.
@acex222
@acex222 4 жыл бұрын
John Carmack wrote an engine for DOOM 3 in Haskell.
@JamesWatsonV
@JamesWatsonV 4 жыл бұрын
@championchap you have no idea what you're talking about
@hanro50
@hanro50 4 жыл бұрын
Pretty sure both unity and unreal use C# and C++ respectively. Both are OOP languages last time I checked.
@OldSloGuy
@OldSloGuy Жыл бұрын
Could it be that OOP is simply a way of generating pseudo productivity by writing a bunch of bookkeeping code that essentially consumes labels and creates verbose code. A manager might brag about how many lines of code his programmers are producing. But, they are behind schedule, so more resources are demanded. Success by failing, more people in a bigger space, manager gets an office suite with receptionist and secretary because he is now managing dozens of people working on "the project." Lots of people dilutes the effect of gifted programmers, but more importantly, minimizes the disruptions when they move on. There is a bias against skill and creativity. Being clever leads to code that is easily misunderstood at a later date, so successful reuse is diminished. OOP is essentially a straight jacket for clever programmers. Reusable code is inefficient because there must be safeguards against theoretical conditions that the hardware is incapable of generating because the hardware may change in the future. Bloated routines don't get reused because they are so big and slow. A contractor wants to get in, get out and get paid. A bureaucrat is interested in empire building. Bureaucrats love OOP.
@pnadk
@pnadk 5 жыл бұрын
If the procedural solution is shorter and clearer, then use it. It should not even be a discussion.
@des_sun1x
@des_sun1x 5 жыл бұрын
yea
@des_sun1x
@des_sun1x 5 жыл бұрын
use shorter code
@SmartLifeEnthusiast
@SmartLifeEnthusiast 5 жыл бұрын
13:40 - What is up with the switching of the player names? ```` public void playGame(String player1, String player2) { String winner = (Math.random() < 0.5) ? player1 : player2; String flipResult = (Math.random() < 0.5) ? "heads" : "tails"; System.out.println(winner + " won with a flip op " + flipResult); } ´´´´
@tldoesntlikebread
@tldoesntlikebread 4 жыл бұрын
This sounds like less like he's dissing OOP itself and more like he's dissing people who use OOP. So what I got from this is use Objects when you actually need them like at the end where he ultimately wrote things into a constructor and called an Object so I understand what people say when they think the title is misleading or clickbaity.
@MrSanemon
@MrSanemon Жыл бұрын
Maybe OOP is used because a programmer in OOP vs a procedural programmer will always write more code...because it takes 3 times the code to write a program in OOP as it does in a procedural sense. What's funny is that I hear OOP guys say "KISS" a lot, and I don't think they know what that means. I'm not advocating for turning all programming languages into straight turing machines or anything but there comes a level of overcomplication where you're just trying to ensure job security by making sure that you're the only person who can possibly understand it.
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
Object-Oriented Programming is Garbage: 3800 SLOC example
52:48
Brian Will
Рет қаралды 235 М.
Сестра обхитрила!
00:17
Victoria Portfolio
Рет қаралды 958 М.
Mom Hack for Cooking Solo with a Little One! 🍳👶
00:15
5-Minute Crafts HOUSE
Рет қаралды 23 МЛН
Object Oriented Programming is Good | Prime Reacts
31:30
ThePrimeTime
Рет қаралды 329 М.
4 Programming Paradigms In 40 Minutes
41:28
Coding Tech
Рет қаралды 492 М.
Object Oriented Programming vs Functional Programming
18:55
Continuous Delivery
Рет қаралды 764 М.
Replacing the Unix tradition
40:46
Brian Will
Рет қаралды 127 М.
Fast Inverse Square Root - A Quake III Algorithm
20:08
Nemean
Рет қаралды 5 МЛН
"Clean" Code, Horrible Performance
22:41
Molly Rocket
Рет қаралды 929 М.
5 Signs of an Inexperienced Self-Taught Developer (and how to fix)
8:40
Dear Functional Bros
16:50
CodeAesthetic
Рет қаралды 563 М.
Object-Oriented Programming
29:02
Brian Will
Рет қаралды 745 М.