Stefan, you communicate with us like a wise father or uncle would. I never notice any inflammatory, condescending remarks or undertones in your videos, or trying to put someone else down. This world needs more of that. Very positive, edifying channel!
People talk about OOP as if inheritance is all there is to it or is the most important aspect of it when there are so many other things that give it its identity.
@a 2345193 , True. I said almost pure because I was actually thinking of the other two examples. Ruby is the "objected enough" language to give someone a good feel for object oriented programming.
When I was first starting out I admit I'm one of those people who overused inheritance because every book and tutorial made it sound like the best thing every invented. As I started getting into more complex systems, I saw the weaknesses that you mentioned. You can end up with an unmaintainable system if you blindly use inheritance for the sake of reusability. I think the thing to remember is that inheritance does have its place. Obvious example: if you're writing any Java, you're automatically using inheritance because everything in Java inherits from Object by design. Also, I've used inheritance sparingly in the data layer where the app is interacting with the database. Basically the kind of logic that all the data classes will be using, like setting up the connection, closing connection, etc. That's one case where it makes sense.
The big problem is that in schools Java, C++, and C# are sold as "industrial" languages where thats how the "big boys" code. However, the most reusable and least error prone code is actually purely functional code with immutability. You can create functional OOP in Java by instead of writing getters and setters you would create an alternate constructor that would return a new object based on an old object and new parameters you want. This allows your code to compose more. This is actually easier in JavaScript. var newvector = makeVector(oldVector, {z:5}) rather than oldVector.setZ(5). This makes it easier to nest your new objects, and you can't get data incoherence and NullPointerExceptions (caused by sequencing your code wrongly) this way. Sequencing errors are actually more common than all other forms of type errors found by Java combined.
i would say that a mix of procedural and oop is the best just my opinion do. when you have lots of simllar stuff use oop. when you have function (not methods) that are used every where or the main function use procedural. doing pure procedural right now its really fun compered to oop.
I've been told that the main purpose of inheritance is not to "reuse code", rather than that it's purpose is to allow polymorphism. Which means that you can have multiple classes that inherit from a more generic superclass, all objects of these classes could then be used in a code that was programmed to be compatible with the superclass.
@@lilyscarlet2584 Ok buddy 💀 Next time maybe read the date before responding to a 3 year old comment. And no. Inheritance is not "compression", what you mean is called composition and is not related to inheritance, rather it is a class acting as a wrapper of another class. Inheritance is not "syntactic sugar", sure, in languages which support static dispatch the call to a class member function can in some cases be directly replaced with it's address at compile time. However as soon as you implement virtual functions and overriding, the memory representation of the object is now not just its data members, but also a pointer to the vtable of this class, which then decides what function will be called. The comment I wrote 3 years ago was more or less right, the point of inheritance is NOT to reuse code, that is just a side effect, rather than that it is used to create a logical hierarchy within your program. Before OOP and inheritance you for example couldn't easily swap a data structure with a more efficient one because everything was hard coded to a one specific data type, now you just have one generic type (e.g. Tree) from which all data structures with the same interface can inherit (e.g. AvlTree, RedBlackTree, ...). Don't listen to bs youtube videos like this one as they're often just straight up wrong or inaccurate. To understand why OOP exists and what it does you first need to understand what was used before OOP. The problem with laguages such as C which don't implement OOP by default is that there's no built-in way to associate data (structures of data) with it's behaviour (functions performing actions upon this data). Which resulted in a huge mess of error prone code with pure data structs being passed around functions. Eventually to encapsulate data and it's behaviour people started adding function pointers to their structs (see how this leads to vtables?). This lead to C++ being invented to standardize the various implementations of proto-OOP which over the years people naturally converged to while implementing it manually in C. As you can see OOP is not something that would came "top to bottom", rather it's what the industry itself converged to over many years.
@@_________________404 you talk like i dont know these things. c is perfectly fine in most cases the issue is that alot of code bases force you to use these ideologies. you should not be associating data with functions by default. data should be dumb and you have a set of operations on data. watch handmade hero which perfectly demonstrates this.
@@_________________404 also the industry is in shambles right now COM is a disaster and the entire web platform. its the patterns people are using thats the problem raii and gc are just patching over a flaw in your code architecture. the correct way to manage memory is to have a combined lifetime and not individual elements. that would alleviate the need for alot of this crap.
I agree about excessive use of inheritance. I worked with .NET and C# for many years and everything inherits ultimately from Object but the number of classes in the chain is often ridiculous. The idea of OOP actually goes back to the 1950s when it was simulated in non OOP languages, FORTRAN I think. I actually like the Python paradigm where OOP is optional, and even if you do use it it's a fairly liberal version of OOP whereas some languages (cough C# cough) are so paranoid they almost make you feel like a criminal. "How dare you try to use that method, it's PRIVATE." Has anybody noticed that most of the mainstream OOP languages were created by Scandinavians? Simula, C++, C#?
Yea ... this is an issue I have dealt with a lot in the past ... and recently! To summaries: adding more programmers, many times, won't speed up the production time. I've found that after you have 3 developers on a project, the law of 'diminishing returns', kicks in viciously. To the point, that I don't have more than 3 on a project.
That's because they need to spend half their time discussing what needs to be done, how to split the workload and how to get their code to work together.
There are many environments we work in that are nothing but structures of objects. Dot net programming for example. Inheritance is integral to developing in that environment.
so does it mean that it is less secured / if its easily breakable as you mentioned relative to other inheritance-free style of programming ? your input is highly appreciated best
@@StefanMischook is oop more or less secure as style of coding / programming relative to say any well known functional programming language, which is tends to throw less errors in production environment?
@@mikiallen7733 no. it is not. oop is actually a bad idea that has overcomplicated code bases more than necessary through obfuscation. 99% of the time procedural code is better where you have a logical flow of if/switch statements rather than classes split across multiple files. it is very hard to conceptualize the program as a whole and you often miss redundancies or have more interfaces than necessary making it hard for systems to communicate. google compression oriented programming. it goes in detail about this theory and supposes a better solution.
If you think structures and procedural coding causes spaghetti code, wait until you start using OOP. I think the biggest problem with OOP are class libraries that try to do too much. Any particular library of the past - going back to Think Class Libraries ( TCL ) - from 1987, through MFC, through CodeWarrior, through Swing, through all kinds of other things - they just made them too generic and code bloat that makes the Hindenburg look like a drug store mylar balloon.
the problem with oop is objects should never be pre supposed. it should be a natural process. code is procedural and objects arise after the fact. casey muratori coined the term compression oriented which supposes the idea that code should be compressed semantically rather than presupposing objects. that way you have working examples your objects arise from rather than trying to worry about what class things belong to. you all should read it google compression oriented programming its a good article.
I don't think of inheritance as code reuse. It's subtyping, and if code is reused, it is a lovely side-effect. Like, a book can be a physical book or an eBook.
Polymorphism is by far the most important feature of OOP. But you are not the first one to get it wrong. Inheritance as it is, is like ... whatever ... sometimes useful. Encapsulation might be the other most important part. Also, I duplicate code all the time. It is mandatory across context boundaries.
"But you are not the first one to get it wrong." One, that's subjective. What's not subjective, and very much objective.. is that the most important part, and fundamental to OO design is the idea of objects themselves; the encapsulation of methods to be closest to the data it needs to interactive with and perform operations on. *Everything* else is just a natural extension of this design concept; interfaces (inheritance), polymorphism (runtime or compile time), etc. But interfaces and polymorphism are not mutually exclusive to OOP.
@@TurboXray Yes, but other paradigms have no issue with encapsulation. Punchcards, for example, have rubber bands and bookmarks. Encapsulation is very important, true, but not specific OOP. OOP offers probably the biggest set of tools to manage complexity. The magic comes alive when you have something like DataBase.update({some: data}) and you stop caring about the implementation of update() as long as it returns an "OK". You can have 100s of forms of update for different databases. Can you do that using other paradigms and principles? Yes, obviously. Will it still be maintainable after 10 years... Probably not. In OOP you can have it somewhat maintainable if you put some grease into it. And by maintainable I mostly focus on the ability to completely change the structure beyond the "update" call.
@@TurboXray you should never have to think about objects or you are doing it wrong. objects should arise naturally not something that is planned. code is procedural and objects naturally arise as you need later on.
@@TurboXray its not vague. you write your code define your variables and functions then when you need to reuse some data set put it in a struct and pass it around and use shared stack frames.
Nope. You can search online. OOP originally was for message handling between computers. The guy wanted to mimic networks by having objects send messages to other objects.
In OOP inheritance is the first priority way to do things. It's one of the major ideas of OOP. If you can't for some reason get it, just don't use OOP language, but also don't try to downplay inheritance just because you don't understand it. "Avoid inheritance" is extremely bad advice to give and can in theory hold back people who try to learn OOP.
@@krztix Besides inheritance is not all about "reuse" of code. When I hear that term I'm like yeah, but no... With inheritance you are supposed to organize your code from simple low level classes (more like user defined "types") to more complex ones. You can and should organize your code in all programming styles, but in OOP it's much more important. The funny thing is that when you avoid inheritance in OOP code it's going to make things harder, not easier.
OOP is fundamentally about tying together data and the code which works with that data, which at a practical level involves writing classes which contain both, and then instantiating objects of that class. It is often stated that the three core principles of OOP are inheritance, encapsulation and polymorphism. However, it would be possible to design a very useful OOP language without any of those three capabilities. Even in a language which has them you don't have to use them (aside from the fact that the language might implicitly inherit from some ultimate base class).
I'm with Paul on this. Just saying "don't use inheritance" is a pretty worthless view without any context imo When thinking of a real world example of a good use of inheritance, I always refer back to the java.sql classes. As a programmer, you know what methods you can call on it, regardless of the database provider (Oracle, Sybase etc). Because they all provide their own implementation of the interfaces. So it 100% has it's uses in the right situation.
I've been told by people who earn twice as much money as me that polymorphism would be "exactly the OOP thing we all hate", and why Go's interfaces are so much better than whatever Java does. Everything comes full circle. First OOP was great and advocated for by smart people, then dumb people misunderstood it, then smart people critizised it, then it survived and now dumb people continue to "critizise" it.
Like all things in this world, everything in moderation and the application of the best tool for the job. The very basics of OOP, inheritance, encapsulation and polymorphism are all you really need. Everything else is just trendy bullshit, as the overuse of patterns and use of ORM's have shown. A well written program, in a language that allows it, will have elements of procedural (even modular), OOP and functional dotted through out. PHP is great for this. In the MVC paradigm, procedural code would normally dominate the controller scripts and the model will consist of one abstract class and many classes that derive the basic functionality from that, especially when writing database applications. Design the database first and add the business rules in the model on a per table basis. Functional elements are extremely handy for filtering, mapping and reducing data whilst keeping the original lists (arrays) intact. The view will invariably be HTML templates that accept data from the model. Things such as games programming are another kettle of fish entirely and I have no interest in those particularly. My knowledge of physics and calculus is not strong enough.
hey stefan, you always say "learning 20 mins a day 5 days a week is better than learning 100 minutes a day once a week" but what about learning and practicing 3-5 hours a day? do you think that's a healthy amount of time per day and would an average brain retain the knowledge at this pace? provided that I keep going back to the basics often to get some refreshers as i inevitably forget some stuff
Thats what i do. Try to dedícate between 4 and 6 hours a Day if i can. If im stuck with something i Just make a pause and do some other thing, play games, etc. Then you came back with a fresh mind.
Is it REALLY better organized? I dunno, man... Modularity you speak of in Classes could be emulated pretty well with opaque pointers in C. You do not need "classes" to break up your programs into reasonably sized chunks.
People confuse benefits of languages like Java with benefits of OOP. No, code in Pascal or C is spaghetti not because its lack of OOP. There are no garbage collection, no built-in data types besides array of bytes, no rich libraries, no stacktraces when program crashes. You don't understand that there was a great problem even to return something from function bigger than single number. It also was different kind of problems and different IDEs and hardware... There was ton things that made life easier and code prettier. Not OOP. Just try write code today in modern language without OOP. It would much easier, because you will not face any problem you have told will be without OOP.
garbage collection is unnecessary. if you need it you are doing your allocators wrong. watch handmade hero if you want to know how to write c proper and not have a need for any of that. all of that stuff is just patching over a flaw in your code architecture.
Don't bother. I got a CS degree, didn't learn shit, and I cannot find a job. The professors will either just read off of slides like a high schooler or jump around in a labyrinth of code. UA-camrs are far better teachers. I would say that college is nice if you need direction, but go to community college for that.
you two are right and yes i m taking courses to improve my programming skills and later to dive into ML but in my country its really hard to get even an interview for a job without a degree to most part of me i do believe that self learnings and online resources are much better than spending 4 years at a university
@@immortalnub handmade hero is a good series on youtube. it shows how to build a complete game from scratch in c++ and goes in depth on how things work.
Packaging..... The real world is so overloaded with wasteful packaging the virtual brainz followed suit..... How many layers of packaging before we even dig out the code... and then we get to the guts and find loads more boxes full of boxes full of different sweets in different wrappers.... Truly horrible in so many ways...
OOP has its uses, but Java & C# are horrible languages IMO. Dynamic languages like Ruby, Python, SmallTalk don't have all of the complexities that require factories and all have some sort of form of "closures". Instead of using objects you can use functions with their closure property as long as your object only has only a single method, and you can put data inside the function (since a function is an object in true OOP languages) for static variables that should be shared between all function calls.
@@aoeu256 oop is always bad. objects arent bad but orienting around them is. read compression oriented programming by casey muratori. its on google search
tell me a single feature of any programming language that is native to OO that hasn't been discredited or discarded or replaced by something better? NONE!!! ALL OO is history and that is why you have none of those features in Rust. Rust is safe and is 99.99% the performance of C/C++ so we are paying safety with 0.01% of performance, is worth it.
Stefan, you communicate with us like a wise father or uncle would. I never notice any inflammatory, condescending remarks or undertones in your videos, or trying to put someone else down. This world needs more of that. Very positive, edifying channel!
People talk about OOP as if inheritance is all there is to it or is the most important aspect of it when there are so many other things that give it its identity.
Ruby is an almost pure object oriented language.
Thought that would be good to mention this on this chanel
Stefan loves ruby
lol
@a 2345193 , True. I said almost pure because I was actually thinking of the other two examples. Ruby is the "objected enough" language to give someone a good feel for object oriented programming.
Python
When I was first starting out I admit I'm one of those people who overused inheritance because every book and tutorial made it sound like the best thing every invented. As I started getting into more complex systems, I saw the weaknesses that you mentioned. You can end up with an unmaintainable system if you blindly use inheritance for the sake of reusability.
I think the thing to remember is that inheritance does have its place. Obvious example: if you're writing any Java, you're automatically using inheritance because everything in Java inherits from Object by design. Also, I've used inheritance sparingly in the data layer where the app is interacting with the database. Basically the kind of logic that all the data classes will be using, like setting up the connection, closing connection, etc. That's one case where it makes sense.
The big problem is that in schools Java, C++, and C# are sold as "industrial" languages where thats how the "big boys" code. However, the most reusable and least error prone code is actually purely functional code with immutability. You can create functional OOP in Java by instead of writing getters and setters you would create an alternate constructor that would return a new object based on an old object and new parameters you want. This allows your code to compose more. This is actually easier in JavaScript. var newvector = makeVector(oldVector, {z:5}) rather than oldVector.setZ(5). This makes it easier to nest your new objects, and you can't get data incoherence and NullPointerExceptions (caused by sequencing your code wrongly) this way. Sequencing errors are actually more common than all other forms of type errors found by Java combined.
i would say that a mix of procedural and oop is the best just my opinion do. when you have lots of simllar stuff use oop. when you have function (not methods) that are used every where or the main function use procedural. doing pure procedural right now its really fun compered to oop.
I've been told that the main purpose of inheritance is not to "reuse code", rather than that it's purpose is to allow polymorphism. Which means that you can have multiple classes that inherit from a more generic superclass, all objects of these classes could then be used in a code that was programmed to be compatible with the superclass.
inheritance is just a form of compression. it is more for syntaxtic sugar than anything
@@lilyscarlet2584 Ok buddy 💀 Next time maybe read the date before responding to a 3 year old comment. And no. Inheritance is not "compression", what you mean is called composition and is not related to inheritance, rather it is a class acting as a wrapper of another class. Inheritance is not "syntactic sugar", sure, in languages which support static dispatch the call to a class member function can in some cases be directly replaced with it's address at compile time. However as soon as you implement virtual functions and overriding, the memory representation of the object is now not just its data members, but also a pointer to the vtable of this class, which then decides what function will be called. The comment I wrote 3 years ago was more or less right, the point of inheritance is NOT to reuse code, that is just a side effect, rather than that it is used to create a logical hierarchy within your program. Before OOP and inheritance you for example couldn't easily swap a data structure with a more efficient one because everything was hard coded to a one specific data type, now you just have one generic type (e.g. Tree) from which all data structures with the same interface can inherit (e.g. AvlTree, RedBlackTree, ...).
Don't listen to bs youtube videos like this one as they're often just straight up wrong or inaccurate. To understand why OOP exists and what it does you first need to understand what was used before OOP. The problem with laguages such as C which don't implement OOP by default is that there's no built-in way to associate data (structures of data) with it's behaviour (functions performing actions upon this data). Which resulted in a huge mess of error prone code with pure data structs being passed around functions. Eventually to encapsulate data and it's behaviour people started adding function pointers to their structs (see how this leads to vtables?). This lead to C++ being invented to standardize the various implementations of proto-OOP which over the years people naturally converged to while implementing it manually in C. As you can see OOP is not something that would came "top to bottom", rather it's what the industry itself converged to over many years.
@@_________________404 you talk like i dont know these things. c is perfectly fine in most cases the issue is that alot of code bases force you to use these ideologies. you should not be associating data with functions by default. data should be dumb and you have a set of operations on data. watch handmade hero which perfectly demonstrates this.
@@_________________404 also the industry is in shambles right now COM is a disaster and the entire web platform. its the patterns people are using thats the problem raii and gc are just patching over a flaw in your code architecture. the correct way to manage memory is to have a combined lifetime and not individual elements. that would alleviate the need for alot of this crap.
@@lilyscarlet2584 Yeah no. You don't know any of this as you don't even know what composition means.
I don't know why, but I love your OOP and inheritance vlogs))
What is your opinion on functional languages like F# (advantages disadvantages vs OOP C#)
"Technical reasons often time don't drive market adoption"
ua-cam.com/video/QlHf8c6Ma7o/v-deo.html
I agree about excessive use of inheritance. I worked with .NET and C# for many years and everything inherits ultimately from Object but the number of classes in the chain is often ridiculous.
The idea of OOP actually goes back to the 1950s when it was simulated in non OOP languages, FORTRAN I think. I actually like the Python paradigm where OOP is optional, and even if you do use it it's a fairly liberal version of OOP whereas some languages (cough C# cough) are so paranoid they almost make you feel like a criminal. "How dare you try to use that method, it's PRIVATE."
Has anybody noticed that most of the mainstream OOP languages were created by Scandinavians? Simula, C++, C#?
My problem of Java is that you must use OOP which its hard to track with.
Which is the video describing using interfaces instead of inheritance? I can’t find it on your channel. Thanks.
I took a class on C# this year and it’s the first programming class I’ve ever taken and it wasn’t that hard to learn. (I only know the basics though)
@Stefan, can you please comment Fred Brook's quote: "What one programmer can do in one month, two programmers can do in two months"
Yea ... this is an issue I have dealt with a lot in the past ... and recently! To summaries: adding more programmers, many times, won't speed up the production time. I've found that after you have 3 developers on a project, the law of 'diminishing returns', kicks in viciously. To the point, that I don't have more than 3 on a project.
@@StefanMischook Imo this subject deserves a separate video!
That's because they need to spend half their time discussing what needs to be done, how to split the workload and how to get their code to work together.
I'm now using SASS. Now I get why its beneficial. Maintainability!
There are many environments we work in that are nothing but structures of objects. Dot net programming for example. Inheritance is integral to developing in that environment.
so does it mean that it is less secured / if its easily breakable as you mentioned relative to other inheritance-free style of programming ? your input is highly appreciated
best
Not sure what you are asking? Can you restate?
@@StefanMischook is oop more or less secure as style of coding / programming relative to say any well known functional programming language, which is tends to throw less errors in production environment?
@@mikiallen7733 no. it is not. oop is actually a bad idea that has overcomplicated code bases more than necessary through obfuscation. 99% of the time procedural code is better where you have a logical flow of if/switch statements rather than classes split across multiple files. it is very hard to conceptualize the program as a whole and you often miss redundancies or have more interfaces than necessary making it hard for systems to communicate. google compression oriented programming. it goes in detail about this theory and supposes a better solution.
If you think structures and procedural coding causes spaghetti code, wait until you start using OOP. I think the biggest problem with OOP are class libraries that try to do too much. Any particular library of the past - going back to Think Class Libraries ( TCL ) - from 1987, through MFC, through CodeWarrior, through Swing, through all kinds of other things - they just made them too generic and code bloat that makes the Hindenburg look like a drug store mylar balloon.
the problem with oop is objects should never be pre supposed. it should be a natural process. code is procedural and objects arise after the fact. casey muratori coined the term compression oriented which supposes the idea that code should be compressed semantically rather than presupposing objects. that way you have working examples your objects arise from rather than trying to worry about what class things belong to. you all should read it google compression oriented programming its a good article.
I don't think of inheritance as code reuse.
It's subtyping, and if code is reused, it is a lovely side-effect.
Like, a book can be a physical book or an eBook.
Polymorphism is by far the most important feature of OOP. But you are not the first one to get it wrong.
Inheritance as it is, is like ... whatever ... sometimes useful. Encapsulation might be the other most important part.
Also, I duplicate code all the time. It is mandatory across context boundaries.
"But you are not the first one to get it wrong."
One, that's subjective. What's not subjective, and very much objective.. is that the most important part, and fundamental to OO design is the idea of objects themselves; the encapsulation of methods to be closest to the data it needs to interactive with and perform operations on. *Everything* else is just a natural extension of this design concept; interfaces (inheritance), polymorphism (runtime or compile time), etc. But interfaces and polymorphism are not mutually exclusive to OOP.
@@TurboXray Yes, but other paradigms have no issue with encapsulation. Punchcards, for example, have rubber bands and bookmarks. Encapsulation is very important, true, but not specific OOP.
OOP offers probably the biggest set of tools to manage complexity. The magic comes alive when you have something like DataBase.update({some: data}) and you stop caring about the implementation of update() as long as it returns an "OK". You can have 100s of forms of update for different databases. Can you do that using other paradigms and principles? Yes, obviously. Will it still be maintainable after 10 years... Probably not. In OOP you can have it somewhat maintainable if you put some grease into it. And by maintainable I mostly focus on the ability to completely change the structure beyond the "update" call.
@@TurboXray you should never have to think about objects or you are doing it wrong. objects should arise naturally not something that is planned. code is procedural and objects naturally arise as you need later on.
@@lilyscarlet2584 Thankyou for the most vague bullshit answer ever hahah. I swear, some peoples' children.. smh.
@@TurboXray its not vague. you write your code define your variables and functions then when you need to reuse some data set put it in a struct and pass it around and use shared stack frames.
Is OOPs the plural?
Well, OOPs actually means "Object-Oriented Programmings!", which doesn't make sense. So, you should probably say OOP languages instead, as Stef does.
"oops" I see what you did there haha. "oops" I did it again.
OOPS full form is Object Oriented programming System
Nope. You can search online. OOP originally was for message handling between computers. The guy wanted to mimic networks by having objects send messages to other objects.
was that "Bob's your uncle"? ha ha
@Peter Mortensen Thanks, I didn't know that expression, I thought he was referring to Robert C. Martin :)
you did not answer the question... you can write perfectly clean code with procedural language... OOP has todo with compiling external libs
In OOP inheritance is the first priority way to do things. It's one of the major ideas of OOP. If you can't for some reason get it, just don't use OOP language, but also don't try to downplay inheritance just because you don't understand it. "Avoid inheritance" is extremely bad advice to give and can in theory hold back people who try to learn OOP.
how about you tell the reasons why you are saying that rather than blindly stating your opinion
@@krztix Besides inheritance is not all about "reuse" of code. When I hear that term I'm like yeah, but no... With inheritance you are supposed to organize your code from simple low level classes (more like user defined "types") to more complex ones. You can and should organize your code in all programming styles, but in OOP it's much more important. The funny thing is that when you avoid inheritance in OOP code it's going to make things harder, not easier.
OOP is fundamentally about tying together data and the code which works with that data, which at a practical level involves writing classes which contain both, and then instantiating objects of that class.
It is often stated that the three core principles of OOP are inheritance, encapsulation and polymorphism. However, it would be possible to design a very useful OOP language without any of those three capabilities. Even in a language which has them you don't have to use them (aside from the fact that the language might implicitly inherit from some ultimate base class).
I'm with Paul on this. Just saying "don't use inheritance" is a pretty worthless view without any context imo
When thinking of a real world example of a good use of inheritance, I always refer back to the java.sql classes. As a programmer, you know what methods you can call on it, regardless of the database provider (Oracle, Sybase etc). Because they all provide their own implementation of the interfaces.
So it 100% has it's uses in the right situation.
Can I use Symfony framework for small or medium size projects?
I've been told by people who earn twice as much money as me that polymorphism would be "exactly the OOP thing we all hate", and why Go's interfaces are so much better than whatever Java does.
Everything comes full circle. First OOP was great and advocated for by smart people, then dumb people misunderstood it, then smart people critizised it, then it survived and now dumb people continue to "critizise" it.
It's just a way of categorizing code. Just like namespaces or filesystem folders.
you can categorize your code via 'including' files
Who's Down with OOP!?
Yeah you know C.....#
We all made the mistake of inheriting everything creating a hierarchy mess then we learned about object composition.
Like all things in this world, everything in moderation and the application of the best tool for the job.
The very basics of OOP, inheritance, encapsulation and polymorphism are all you really need. Everything else is just trendy bullshit, as the overuse of patterns and use of ORM's have shown.
A well written program, in a language that allows it, will have elements of procedural (even modular), OOP and functional dotted through out. PHP is great for this.
In the MVC paradigm, procedural code would normally dominate the controller scripts and the model will consist of one abstract class and many classes that derive the basic functionality from that, especially when writing database applications. Design the database first and add the business rules in the model on a per table basis.
Functional elements are extremely handy for filtering, mapping and reducing data whilst keeping the original lists (arrays) intact.
The view will invariably be HTML templates that accept data from the model.
Things such as games programming are another kettle of fish entirely and I have no interest in those particularly. My knowledge of physics and calculus is not strong enough.
When it comes to cheese and bacon; why not choose both?
y’all don’t stay for too long he gotta go to lunch
hey stefan, you always say "learning 20 mins a day 5 days a week is better than learning 100 minutes a day once a week" but what about learning and practicing 3-5 hours a day? do you think that's a healthy amount of time per day and would an average brain retain the knowledge at this pace? provided that I keep going back to the basics often to get some refreshers as i inevitably forget some stuff
Thats what i do. Try to dedícate between 4 and 6 hours a Day if i can. If im stuck with something i Just make a pause and do some other thing, play games, etc. Then you came back with a fresh mind.
and with OO you can get into Macarrones code
Inheritance for interfaces only!
i dont think i wrote a single interface or inheritance outside of educational environment
Is it REALLY better organized? I dunno, man... Modularity you speak of in Classes could be emulated pretty well with opaque pointers in C.
You do not need "classes" to break up your programs into reasonably sized chunks.
thank you
More of these nuggets uncle Stef......i like.
People confuse benefits of languages like Java with benefits of OOP.
No, code in Pascal or C is spaghetti not because its lack of OOP.
There are no garbage collection, no built-in data types besides array of bytes, no rich libraries, no stacktraces when program crashes.
You don't understand that there was a great problem even to return something from function bigger than single number.
It also was different kind of problems and different IDEs and hardware...
There was ton things that made life easier and code prettier.
Not OOP.
Just try write code today in modern language without OOP. It would much easier, because you will not face any problem you have told will be without OOP.
garbage collection is unnecessary. if you need it you are doing your allocators wrong. watch handmade hero if you want to know how to write c proper and not have a need for any of that. all of that stuff is just patching over a flaw in your code architecture.
OOP was actually invented to confuse the new programmers.
Lol
@@lukevincent4397 can you tell me? What is meaning of LMAO? I have seen this much but don't know what does it mean
@@SajeelCodes lol = lmao = lmfao = rofl
@@lukevincent4397 ohk
what is hard about oop? never get it
@@jsceo hard thing is the confusion of beginner programmers when just starting out
how good is a Cs degree to get into AI
Don't bother. I got a CS degree, didn't learn shit, and I cannot find a job.
The professors will either just read off of slides like a high schooler or jump around in a labyrinth of code. UA-camrs are far better teachers. I would say that college is nice if you need direction, but go to community college for that.
you two are right and yes i m taking courses to improve my programming skills and later to dive into ML but in my country its really hard to get even an interview for a job without a degree
to most part of me i do believe that self learnings and online resources are much better than spending 4 years at a university
@@mrmack678 Keep your programming assignments for reference. I regret not keeping mine.
@@immortalnub handmade hero is a good series on youtube. it shows how to build a complete game from scratch in c++ and goes in depth on how things work.
Great explanation! Could you link us the Inheritance video?
Cmon man... cheese all day everyday.
Looking healthy your face looks much leaner
Watch it on 4x
Did you have a wedge of bacon cheese for lunch?
OOPsie daisy
Packaging..... The real world is so overloaded with wasteful packaging the virtual brainz followed suit..... How many layers of packaging before we even dig out the code... and then we get to the guts and find loads more boxes full of boxes full of different sweets in different wrappers.... Truly horrible in so many ways...
Sksksksksksksks and i oop
no
The meme
try to scale a project without OOP , you can not. try to make a small project with OOP you can but is overkill.
scaling does not require oop. you just need to get better at programming.
@@lilyscarlet2584 that is what a person who only write scripts says.
@@fludeo1307 or c
OOP is an overly abstracted mess.....
OOP has its uses, but Java & C# are horrible languages IMO. Dynamic languages like Ruby, Python, SmallTalk don't have all of the complexities that require factories and all have some sort of form of "closures". Instead of using objects you can use functions with their closure property as long as your object only has only a single method, and you can put data inside the function (since a function is an object in true OOP languages) for static variables that should be shared between all function calls.
@@aoeu256 oop is always bad. objects arent bad but orienting around them is. read compression oriented programming by casey muratori. its on google search
Oop was invented because people got sick of functional xD
Yeah I mean nobody needs it lets just put everything in one main function😂😂
tell me a single feature of any programming language that is native to OO that hasn't been discredited or discarded or replaced by something better? NONE!!! ALL OO is history and that is why you have none of those features in Rust. Rust is safe and is 99.99% the performance of C/C++ so we are paying safety with 0.01% of performance, is worth it.
this video is utterly devoid of content
I’m like chips.
GOTO