Object-Oriented Programming

  Рет қаралды 741,493

Brian Will

Brian Will

11 жыл бұрын

Part of a larger series teaching programming. See codeschool.org/

Пікірлер: 352
@DrHokeyPokey
@DrHokeyPokey 9 жыл бұрын
I learned from this video that I have been performing spaghetti-oriented programming.
@ClintCheesewood
@ClintCheesewood 8 жыл бұрын
DrHokeyPokey Pasghetti
@freebooks9265
@freebooks9265 8 жыл бұрын
+naiveyuu lol
@rusty5100
@rusty5100 7 жыл бұрын
LOL
@slamislife74
@slamislife74 7 жыл бұрын
Better that than no programming! Glad you're learning :)
@stinkebubu
@stinkebubu 6 жыл бұрын
oh dear.... kinda thought of the same thing to comment :O
@juubes5557
@juubes5557 7 жыл бұрын
"A Car is not a kind of steeringwheel", wise words.
@ccgb92
@ccgb92 4 жыл бұрын
Except a steering wheel is attached to a car.
@killistan
@killistan 2 жыл бұрын
@@ccgb92 What about cars that do not have a steering wheel?
@mattias7407
@mattias7407 2 жыл бұрын
@@killistan It has an engine, wheels and it moves, but no steering wheel? Then it's obviously a motorcycle.
@user-zb8tq5pr4x
@user-zb8tq5pr4x 2 жыл бұрын
@@mattias7407 Or a hoverboard.
@user-zb8tq5pr4x
@user-zb8tq5pr4x 2 жыл бұрын
@@mattias7407 or a train
@pr0skis
@pr0skis Жыл бұрын
This is the most clear explanation I've ever seen. Please don't quit. This channel has been a gem!
@SithLord2066
@SithLord2066 11 ай бұрын
Just when the world needed him the most... he wasn't there
@briantwill
@briantwill 11 жыл бұрын
In practice, most code is very abstract, so identifying the proper 'things' that should make up your code isn't easy (and arguably a fool's game). I would just write the code as straight procedural code, then see if you can logically group stuff into classes one at a time. The biggest thing to keep in mind is to be careful about using inheritance. In fact, you shouldn't feel obligated to use inheritance at all.
@bpaudel2239
@bpaudel2239 3 жыл бұрын
I'm trying to learn to work with classes and this is exactly the answer to the question I had in mind. I've tried for days to find the answer but nobody really seemed to ever talk about how you start writing in an object oriented way. Thank you!
@lex-fridman
@lex-fridman 2 жыл бұрын
@@bpaudel2239 Thats is where Design Patterns come into play, instead of inventing something new or reinventing the wheel, just copy existing designs and fix what does not work for your project on go. Does not really mean that you need to read and understand books before starting to code, just look at existing codes and repeat their approach. This is how juniors do when joining projects with OOP language tech-stack.
@lyrical2351
@lyrical2351 Жыл бұрын
@@lex-fridman thank you! Your comment also helps me a lot!
@hanzo2001
@hanzo2001 Жыл бұрын
Just write it as it should be, then think what needs to be modified as required by style/policy. I add one more step which is inversion of control so that I can isolate the responsibilities of a specific module. I may be doing things wrong. I'll have to reevaluate. Thanks
@hyddra8928
@hyddra8928 5 жыл бұрын
"My cat has 7 lives left, yours has 5." is this a threat.
@chocolatecoveredgummybears
@chocolatecoveredgummybears 2 жыл бұрын
lol
@zzyzx-ig9hs
@zzyzx-ig9hs 10 жыл бұрын
Yours is the first straight forward explanation of when an interface is used. Thank you.
@Kiiiizle
@Kiiiizle 10 жыл бұрын
Can I just say your presentation is brilliant I love the fact that you avoid using some of the typical terminology that others use and take time to explain what you have said , others on here try to wrap everything in once sentence and it is terribly confusing.
@CaptainAardvaark
@CaptainAardvaark 4 жыл бұрын
My favourite part of OOP-esque approaches is using mixins / multiple inheritance. Specifically to have mixins that provide a fully self-contained set of functionality, such that those mixins can be sprinkled into other classes later. Programming starts to feel like cooking, with mixins providing convenient bits of spice and flavour that gets you where you need to be.
@1cannon3
@1cannon3 2 жыл бұрын
00:00 - Definition 05:00 - encapsulation 07:45 - inheritance 12:35 - inheritance usage guide 14:05 - multiple inheritance 16:32 - overriding inheritance 18:55 - polymorphism 22:00 - constructors 22:48 - interface 25:15 - abstract class 26:25 - prototypical inheritance
@LeaderOfMetal93
@LeaderOfMetal93 10 жыл бұрын
2:30 "...create a class to represent a cat...a number for its age, or remaining lives." I died.
@jocojuri
@jocojuri 8 жыл бұрын
+Brandon G XD brilliant
@antoniolepe4670
@antoniolepe4670 5 жыл бұрын
A little bit of programmers humor ... 🤣🤣 ... nice video
@lordnoar
@lordnoar 7 жыл бұрын
This provided a GREAT crash course for a job interview, my coding is a bit rusty, but this was straight forward and legit. Thanks a lot!
@douglasoak7964
@douglasoak7964 7 жыл бұрын
prolly the best explanation of the topic i have ever seen
@ericmyrs
@ericmyrs 5 жыл бұрын
I really like your concise definition of object oriented programming. Something my OOP Professor failed to impart over an entire course, you delivered in 2:24.
@briantwill
@briantwill 11 жыл бұрын
Yes, experience makes it easier, and in time you pick up on conventions, like when to make factories, managers, singletons, and so forth.
@revillsimon
@revillsimon 5 жыл бұрын
That was a very good lecture, Brian. Thoroughly enjoyed watching it and I will be watching it for reference in future. Thank you.
@michaelkenner3289
@michaelkenner3289 10 жыл бұрын
Thankyou, after watching this video I feel like I understand not just what OOP is, but also why I would want to use it. Some of the other videos I'd seen covered the same topics but left me scratching my head about what it all actually means.
@CryptoJones
@CryptoJones 8 жыл бұрын
I needed a review for an interview, this worked great. Thanks!
@alexandreallegro6438
@alexandreallegro6438 6 жыл бұрын
Great video. Voice is not monotone, is calm a explaining it in a very soft way. I like it!
@stabMyFaceOff
@stabMyFaceOff 5 жыл бұрын
Your voice is epic and the oop refresher did me a world of good
@lemastre
@lemastre 11 жыл бұрын
Nice video. I remember this being explained overly complicated back in my student days. You keep it simple.
@imtisalqadeer
@imtisalqadeer 8 жыл бұрын
Thank you for such a nice and concise definition of important basic concepts.
@msujonbd
@msujonbd 6 жыл бұрын
Great video. The information is presented in a clear and elegant way. Thanks!
@vyasmail
@vyasmail 9 жыл бұрын
Excellent work , ur explanation is clear and precise ,pls keep on uploading new vedios .I really appreciate ur work & looking forward to learn more .
@tylerbrown9797
@tylerbrown9797 8 жыл бұрын
Very clear and effective descriptions, thank you!
@DaBBoSaH
@DaBBoSaH 10 жыл бұрын
wow that memory part and the method only being stored once is important to know!! Thanks
@spiral9316
@spiral9316 7 жыл бұрын
thanks and I prefer your monotone rather than pure marketing Blasie like tone.
@googoogaga7175
@googoogaga7175 5 жыл бұрын
I'm lost in my AP comp sci class. This video is so helpful, thank you.
@Jomster777
@Jomster777 8 жыл бұрын
He sounds a bit like the usual voice they use for Bruce Wayne. XD Awesome! The video itself was quite informative and very easy to understand.
@TheSuredood
@TheSuredood 8 жыл бұрын
STER Gaming sweet so Batman is teaching me CS
@milominderbender4632
@milominderbender4632 8 жыл бұрын
Handsome voice lol sounds manly
@keithscull8288
@keithscull8288 8 жыл бұрын
+STER Gaming Also sounds like Roy Mustang
@Zarat87
@Zarat87 8 жыл бұрын
+STER Gaming Sounds like Charlie the unicorn :p
@3dstudiomike
@3dstudiomike 5 жыл бұрын
Neil Peart! When the video first started, I thought it was Neil Peart! Awesome!
@blacklightning7227
@blacklightning7227 5 жыл бұрын
Best explanation I've ever encounter... I found myself hoping that there was a lot more time left so that I could learn more....ty
@therapturekid
@therapturekid 7 жыл бұрын
Not sure why people care about your tone of voice. If you were here to learn you would be paying attention to what he is teaching. Not debating how he sounds. He is to the point, clear, and understandable. Fantastic refresher video for those who have been out of the OOP game for awhile.
@paeden5431
@paeden5431 5 жыл бұрын
Right? His voice is not a annoying, high pitch poorly recorded voice at least. This is easy to listen to.
@duckymomo7935
@duckymomo7935 4 жыл бұрын
Jordan Moorman He’s montonic
@nikoladjordjevic4477
@nikoladjordjevic4477 4 жыл бұрын
Loved this "tutorial" :) even though it has been a year since I started with functional programming and I am probably never going back to OOP (FP is simple and I'd like to keep it that way). It was nice to see a well-explained concept in programming
@ericsuper8224
@ericsuper8224 8 жыл бұрын
Neo: Morpheus? Neo: I thought it wasn't real. Morpheus: Your mind makes it real.
@ChristianKrause89
@ChristianKrause89 10 жыл бұрын
This was very thorough! Well done.
@JeremyNasmith
@JeremyNasmith 5 жыл бұрын
My final year of comp-sci in highschool was 1993, and the main thrust was C. However I'd written a bunch of games and utilities in Qbasic on my own but owing to the limitations of arrays having to be generally of a pre-defined size, no local variables, etc., I'd begun to rewrite these in turbo-pascal. TP had the ability to define classes and use objects but at that time no course at high school nor my own research into basic, Qbasic, or C had ever come across them, my implementations stayed strictly procedural. In TP, defining linked (or doubly-linked) lists of records provided more than enough flexibility in terms of size and 'groupability' in terms of data for anything I'd previously written to be vastly improved in the ports over from Qbasic. Simply paying close attention to any possible accidental side effects meant I simply had to pass pointers to a record which needed to be updated avoiding unnecessary duplication of data. At a time when a 1G hard drive was a rarity and a 486 was fast, well this speed things up dramatically. Doubly linking lists made it unnecessary to run through the entire list from the head node to find a parent item. In fact I often kept lists in loops where tail pointed to head directly removing the constant need to check for the tail case: perhaps dangerous in that infinite loops might occur, but with careful logic these could be avoided and the increase in performance was marked on slow machines. "Inheritance" could be achieved by having a field of one record be the type of a different record. If many sprites needed the same graphics (multiple instances of monsters) a loop of the frames of the sprite's graphics stored in a looped linked list could be pointed to from a pointer stored in a field of the monster's record, eliminating storing multiple copies of the same bitmaps. Memory was at a premium after all! Perhaps I'm old-school, but I don't see any advantage to OO over an approach like this. It seems unnecessarily complicated and resource intensive, particularly for single thread, single programmer projects... I'm sure many people will argue the opposite but records, pointers, and linked lists are group able, flexible, and require no copy when passed to functions and procedures as long as you take care of your logic when changing values of fields to not produce unwanted side effects: good practice anyways, no?
@zikomo8913
@zikomo8913 5 жыл бұрын
Wow, seems interesting, even if I barely understand the technicality of your approach, being a rookie in C programming, do you have a blog or something where you can elaborate a bit more on this approach?
@KlassickG
@KlassickG 5 жыл бұрын
First year in cs so correct me if I'm wrong but dont you run into serious scalability problems with this concept? Sure everything works but its time consuming and very costly if you have even a single error in logic at any point. My current understanding is that OOP is the fundamental concept that your program should work whether it's being used for one thing or a million and it should do it in the most efficient manner
@JeremyNasmith
@JeremyNasmith 5 жыл бұрын
@@KlassickG I'm not sure that relying on OOP to safeguard against errors in logic is better than testing to ensure correct logic in the first place. Also, functions and procedures can be tested just as well as the methods of any object. So scalability aside, I don't see that testing one's own code is problematic. Now, scaling up, provided documentation (comments ) and code are clear to begin with I imagine it shouldn't be too rough to ensure code remains free of unwanted side-effects . The biggest worry might be choosing a variable name to use locally, and accidentally misspelling it to match a global variable... That'd be hard to catch for sure, but with good naming conventions agreed to it seems unlikely... But then again, I've never worked on a large scale, multi programmer project. And these days efficiency less and less of a consideration as bandwidth, RAM, processor speed etc keep improving. But still, there's something beautiful about concise clean code...
@JeremyNasmith
@JeremyNasmith 5 жыл бұрын
@@zikomo8913 I don't have a blog, sorry, and my C is suuuper rusty, but if memory serves C has pointers, yes? A linked list item in simplest form is made of a piece of data (could be a variable, an array, a record, a boolean variable, whatever) and a pointer pointing to the next item in the list. The final item points to 'null' or itself if you want a loop. The first item sometimes has a special pointer called 'head' pointing to it, but if the list is circular it isn't necessary as long as you have a pointer pointing somewhere on your list. You can read and write data to the data field of the item your index pointer points to, then set your index to point to it's item's 'next' item, thus iterating over (around) your list. You can insert or delete items, cut lists into sub-lists, etc. But you never have to make a copy of your list just to, say, pass it to a function, so for any sort of recursion it saves mucho memory. I don't know if that's clear at all: there are far better/smarter folks out there who could likely give you a way better explanation. But hope that makes it a little clearer.
@berylliosis5250
@berylliosis5250 3 жыл бұрын
Nowadays especially, linked lists (especially doubly linked) are going to result in big performance hits compared to array lists in most cases. Linked lists are slower at random access, but their biggest issues are ones of space: they add 4-16 extra bytes to each item and aren't laid out contiguously, so they lead to terrible caching problems (I think there's actually a video on this channel that mentions this). I'd argue that OOP has the advantage of syntactic sugar - I actually think it's a good enough syntactic sugar that it's a legitimate advantage. If it's used right, it's also going to help you avoid spaghetti code; it's used poorly often enough that I don't really think that one counts.
@jaehyi2009
@jaehyi2009 2 жыл бұрын
9 years later, this video is still relevant! 🔥
@etodemerzel2627
@etodemerzel2627 2 ай бұрын
3 years after this video he released "Object-Oriented Programming is Bad" video.
@flyingsquirrel3271
@flyingsquirrel3271 6 жыл бұрын
Thanks for the very helpful video! I know it's old, but I'd like to add one language specific detail: You said that "classmethod" and "static method" are the same thing. I don't know much about the other languages, but in python they aren't. Classmethods get the class itself passed in as an argument automatically, so the classfields can be accessed through that passed class within the classmethod, but static methods are really just functions within the namespaces of classes.
@zikomo8913
@zikomo8913 5 жыл бұрын
What a video, I actually started making handwritten notes, fantastic!
@riccetn
@riccetn 11 жыл бұрын
Yes and no, imperative and procedural are sometimes considered synonyms, but they really describe different concepts all together. Imperative languages is a list of statements which is executed in the order they are written (as opposite descriptions of the result without any detailed specifics of how to reach it). Procedural languages are languages with procedures (aka. functions). In fact many object oriented languages are also imperative but not as commonly procedural.
@nationanime3144
@nationanime3144 3 жыл бұрын
Respect , this is the best OOP explanation in all net , even java creators couldnt explain that shit like you did
@ihabs2150
@ihabs2150 8 жыл бұрын
What data type is used for large floating point signed values? Can you help me please?
@NoodleBerry
@NoodleBerry 2 ай бұрын
C++ and it's template deduction is nice because I don't have to pinky promise what I pass in to a for each loop has a pre increment and a deference, it'll just work if Ive actually defined those for what I pass in (and if it doesn't I'll get the world's longest error telling me about every iterator that exists)
@zzantares
@zzantares 11 жыл бұрын
I was feeling like a kid in bed while listening a tale, a very good one of course! great video thanks!
@christianherrera4729
@christianherrera4729 5 жыл бұрын
This video has to be one of the most useful for explaining this topic! I would only say that some more detailed animations and illustrations would have been even more helpful.
@anthonydevellis6708
@anthonydevellis6708 2 ай бұрын
I would say Lua is another language of note that uses prototypical inheritance. In fact, I find these dynamic languages with prototypical inheritance somewhat better for doing OOP, becasue they are more flexible.
@TheSkyManRules
@TheSkyManRules 8 жыл бұрын
I thought that you did a very good job of explaining the core concepts of object-oriented programming. You provided deep analysis of the different core concepts and used examples and simple language that everyone could understand. I do think that the video could be enhanced through the uses of more metaphors and diagrams. These visuals aids allow different types of learners to engage better in the material. Also, you could try breaking the video up into smaller segments, as it is often hard for a learner to engage for 30 minutes straight. By creating smaller sub videos, it would allow both a single leaner to take breaks and finish up when they are more engaged, and also allow people to watch specific sections if that is the area in which they need help.
@mellowyellow7523
@mellowyellow7523 2 жыл бұрын
jesus christ are you really so lazy that you can't even be bothered to hit the pause key?
@GreaterJan
@GreaterJan 2 жыл бұрын
This feels like the villain origin story
@AllPs3suck
@AllPs3suck 9 жыл бұрын
Thank you so much! 5 years of programming, and I never understood polymorphism. Once you explained overriding - something else I never understood; but to be fair I never tried to understand it - polymorphism made since. I still don't get encapsulation, though. And I learned that an abstract class *is* an interface - at least in Java. So, what exactly is the difference between the two?
@CollinBaillie
@CollinBaillie 9 жыл бұрын
If you look at the word encapsulation, it's made from the word capsule. To encapsulate something, is (more or less) to put it in a capsule. To enclose it in some logical collection, with some amount of protection.. protection of the things inside from the things outside. You don't want the outside things messing with, or getting mixed up with, the inside things. In java you have public, protected and private 'things' in a class. When you define a class, you make the capsule. When you declare fields or methods as public, protected or private, you are defining a level of protection, or what level of access outside things have to the inside things, or indeed what access inherited classes have to parent class fields or methods. (like poking a small hole in the wall of the capsule) Encapsulation is more of a concept for you to use when understanding how objects interact with other objects, rather than a functional part of the code.
@jim9689
@jim9689 2 жыл бұрын
Hi Brian- I'm confused by your example with Cat/Mammal/Animal (8:50). I see how the boxes A-to-G would distribute the way you illustrate if those boxes represent Methods, but not if a box represents a field (an instance of a cat). So while I thought you said that members are both methods and fields, for this example you only allow the members to be methods and not fields? I.e, if box A was the Field for a crocodile, it could only be present within Animal, and yet you distribute it to Mammal and Cat.
@FreeScience
@FreeScience 11 жыл бұрын
Thanks (tack). What differentiates procedural and functional languages then?
@sattm8230
@sattm8230 7 жыл бұрын
Great video. One of the easiest to understand and best organized I've come across for general OOP principles.
@phxJohn2010
@phxJohn2010 4 жыл бұрын
Thank you. This was very, very helpful!
@kevinpowers6875
@kevinpowers6875 6 жыл бұрын
Clear, concise and imaginable. Thank you very much, mister Will.
@nishabuhameedk2641
@nishabuhameedk2641 8 жыл бұрын
That moment you explained what is an Interface is just blown my mind !! Thanks a heap. :)
@locallion1218
@locallion1218 6 жыл бұрын
Best explanation of OOP
@ahmedelakrab
@ahmedelakrab 5 жыл бұрын
The site codeschool.org/ is down. Where can I find the whole series. Great tutorial by the way.
@kolto101
@kolto101 11 жыл бұрын
Very well-made video! Thank you!
@ThePanFrajer
@ThePanFrajer 7 жыл бұрын
Ignore the haters, been looking through videos to strengthen the knowledge on OOP and your video is by far the best, clear explanations, understandable examples and most importantly proper english, all these indian accents are hella annoying lol, subbed
@davidmaes12
@davidmaes12 5 жыл бұрын
Read clean code by uncle Bob, and you'll see that Brian is not very good at programming. OOP is one of the best ways to structure your code. His alternatives seem so messy to me.
@Snacksu
@Snacksu 5 жыл бұрын
Thank you this is a good refresher.
@ghollisjr
@ghollisjr 4 жыл бұрын
Class inheritance has been useful to me so seldom that I almost forget it's possible. Seems like most problems involve similar but really different types of data so that parent classes add only complexity and generic programming is a better solution.
@amakhija1
@amakhija1 7 жыл бұрын
thanks for the update, getting back into coding with Swift 3, just what I needed!
@paulsaulpaul
@paulsaulpaul 11 ай бұрын
This is perfect. I was making an animal simulator in Unity that is text based and writes to the console using Debug.Log and players can input into a text field in a serialized object. I have found a use case then for standard OOP design patterns. Next a car simulator. I was thinking of a Person class and derived from it a Male and Female, but then I have over-engineered my solution to require a generic List
@whiteboycarl1234
@whiteboycarl1234 4 жыл бұрын
can you do a difference between encapsulation and abstraction?
@c1v1lwar24
@c1v1lwar24 7 жыл бұрын
Very helpful and well explained.
@nesquikg7866
@nesquikg7866 6 жыл бұрын
Thank you for putting your knowledge on the internet for free.
@MarketsData
@MarketsData 6 жыл бұрын
Check out this vid if you'd like to broaden your base. kzbin.info/www/bejne/n3jXc4mbpr6Egbs
@terrykeyes1642
@terrykeyes1642 4 жыл бұрын
This was very helpful. Thank you
@shrutiganu2640
@shrutiganu2640 6 жыл бұрын
Thank you, this video was really helpful!
@369Shahin
@369Shahin 9 жыл бұрын
Taking CS 1 in the Fall. Learning OOP and OOD before I start the course though.
@Pauhoihoi
@Pauhoihoi 6 жыл бұрын
Just wanted to say that these explanations are spot-on, straight to the point, and very easy to understand. Great video. Thanks!
@EduardGalchenko
@EduardGalchenko 5 жыл бұрын
About class which have one parent, it's not only Python and Java and in Objective-C the same - NSObject is a parent of all classes that you will create
@zorandjipanov6492
@zorandjipanov6492 8 жыл бұрын
btw, you should do a video on design patterns next.
@watercat1248
@watercat1248 3 жыл бұрын
You really know a lot about code logic
@sanwil9
@sanwil9 5 жыл бұрын
Your voice reminds me of Archer. Great video.
@shirankao69
@shirankao69 11 жыл бұрын
Most OO classes I've seen start with too much Software Engineering right up front. For a beginner I think your approach works much better. Just code and see what patterns show up, then abstract over them. As you get used to it, you'll have a much easier time modeling before coding.
@marna_li
@marna_li Жыл бұрын
I think that James Coplien came with valid critique when he highlighted the focus on classes instead of interacting objects within a use case. Most software developers don’t seem to get OOP, sure they write classes - “Service” classes are far too common. They use DI and so. But they don’t model objects from the real-world. They would rather separate behavior from data in some pseudo-procedural module style.
@zachb1706
@zachb1706 9 ай бұрын
That's not developers getting OOP wrong, that's just OOP as it was intended
@Clockradio92
@Clockradio92 7 жыл бұрын
Why is there a picture of the death star when constructors are explained? Is something going over my head? (Helpful video btw!)
@WraithGlade
@WraithGlade 7 жыл бұрын
It's because the death star is *under construction* . That image was from when the death star was not yet finished being built. *random side-note:* One problem with the way OOP programming conceptualizes the concept of construction is that it gives you the false impression that there only can be one centralized way of building an object. In reality, you could have multiple functions for constructing the same object (even with the same data type signature) if you made the constructors be global functions external to the class. Thus, for example, in a more procedural style you could have both something like "TypeX MakeObjectOfTypeX_CartesianCoordinates(float, float)" and "TypeX MakeObjectOfTypeX_PolarCoordinates(float, float)" and both would simply be global functions that return a constructed instance of the object of TypeX (i.e. constructors are just functions that return filled out instances of the underlying data structure). In other words, constructors aren't actually special on any kind of fundamental level. OOP constructors don't allow you to do this because you can't overload a function name with two functions that have the same type signatures (e.g. "float, float" here). Under the hood, constructors are actually implemented as just global functions whose return type is a struct of the same data type as the object's fields gathered together and placed in a plain struct. Also, "methods" in OOP are also actually essentially nothing more than global functions in disguise whose first input parameter is a pointer to an object of that type named "this" which is implicitly used whenever you refer to the instance's member variables. In other words, to an extent, OOP actually obscures the syntax of what is actually going on and makes it less general from a notation standpoint. However, it does implement a "v-table" (which is how polymorphism is implemented under the hood) to enable inheritance and that is the only real fundamental difference between global procedural functions and OOP methods once you truly understand what is going on under the hood.
@Clockradio92
@Clockradio92 7 жыл бұрын
Thanks! That didn't click in my head when I first watched this video.
@sabidrahman3970
@sabidrahman3970 7 жыл бұрын
REGARDING 19:30 if i create an object like this Jack X= new Lisa(); X.foo(); which foo() will be called?
@kalikiter1
@kalikiter1 10 жыл бұрын
I am a molecular biology student trying to learn programming and this video skull fucked me into another dimension.
@kapilbadheka794
@kapilbadheka794 4 жыл бұрын
Is there a text version of this info?
@penggunaphp7297
@penggunaphp7297 8 жыл бұрын
Your voice amazing...
@sebastianviruzab7986
@sebastianviruzab7986 4 жыл бұрын
Thank you so much for this :). OOP exam tomorrow
@thesanta90
@thesanta90 10 жыл бұрын
really well done, thank you
@groupbutts
@groupbutts 10 жыл бұрын
Thx for this. Struggling through my first year programming class. This helped.
@sonicqtip
@sonicqtip 6 жыл бұрын
Am I an abstract object or an instance of a class?
@SoulofAnotherDeity
@SoulofAnotherDeity 7 жыл бұрын
Object-Oriented Programming doesn't begin with data, it begins with types. It's all about classifying and relating things into some hierarchical world-view, under the assumption that it will let you create reusable components. In actuality, this results in an extremely rigid framework that is impermeable to change, and thus leads to even less code reuse as even minor revisions cause enormous code ripples. Sure, OOP is good for modeling, but for programming, it's a nightmare that generates far more work than necessary. What programmers really want is dynamic and mutable typing. But they won't say that because it's taboo and evil for reasons that no one can sensibly explain (ego, bureaucracy, lack of preoptimization (aka. static compilation and manual memory management), the misguided belief that static typing magically eliminates some huge class of common bugs that no one can actually list, being too lazy to use a debugger or write unit tests yet not too lazy to complain about the reasons why they exist, etc.)
@janisir4529
@janisir4529 5 жыл бұрын
So you have no clue about all the best practices for OOP programing? And dynamic typing is cancer. It shifts a huge number of compilation errors to runtime, making it harder to detect errors. It's convenient occasionally, sure... But like don't.
@jasonapril4868
@jasonapril4868 5 жыл бұрын
You're both wrong. It begins with messages according to Alan Kay, who coined the term "object-oriented."
@jasonapril4868
@jasonapril4868 5 жыл бұрын
@@janisir4529: There are no "best practices." There's only bad OOP and less bad OOP. Watch Brian Will's other videos on OOP.
@janisir4529
@janisir4529 5 жыл бұрын
@@jasonapril4868 Basically what he does, is strips down the code to it's very basics, which may seem shorter, and easier to understand, but on the long run that'll be cancer to maintain.
@jasonapril4868
@jasonapril4868 5 жыл бұрын
@@janisir4529 That's quite the assumption. Would you say that about the Linux kernel?
@MaxCoplan
@MaxCoplan 5 жыл бұрын
It says this is one part of a larger series. What is the larger series?
@RamjetX
@RamjetX 4 жыл бұрын
This was very informative.
@samarthdhroov
@samarthdhroov 6 жыл бұрын
Thank you. REALLY APPRECIATE your effort of putting things so simply here.
@adilazafar7065
@adilazafar7065 3 жыл бұрын
Sir kindly help me, please tell me that if i want to create a class of game then tell me which data member i can use in my progrme through set & get function
@longx0r550
@longx0r550 6 жыл бұрын
Thanks you it help my understanding OOP better now
@ianmartin2924
@ianmartin2924 6 жыл бұрын
Thanks for your time and effort. This video was an excellent jump start.
@MagnusAnand
@MagnusAnand 4 жыл бұрын
Excellent video
@kumailn7662
@kumailn7662 5 жыл бұрын
Thanks Brian Will, video has really informative stuff. Clear some of the confusion.
@keithscull8288
@keithscull8288 8 жыл бұрын
Quick question, what if you took the idea of overriding but were calling a static method. Then say, I took the class of Kate, and inside the Kate class, which is of course extending Lisa which overrided the method, but let's say I said Jack.methodname(); Would I be calling the method from Jack, or the method override from Lisa? My guess is that if both the original method in Jack and the overrided method from Lisa were static, that the method wouldn't be overridden at all and would maintain the original Jack's version of the method, OR that it would just work it the same way as redefining a static variable, and the override WOULD work, just a redefining of the sole instance of the Jack method. Which result would it be?
@briantwill
@briantwill 8 жыл бұрын
+Keith Scull In Java at least, invoking a static method looks for the first matching method signature up the inheritance chain. So given Lisa
@keithscull8288
@keithscull8288 8 жыл бұрын
Hey my friend, I'm sorry if I'm a bother I just really want to understand this.. I understand most of what you're saying but in regards to the particular scenario, I don't understand how calling jack.foo(); will render the override of kate.foo(); if, like you said, (kate's foo method is static, and jack's is not), The problem I have with this idea is that when I tried it, the override method must have the same modifier as the original, meaning the compiler returns an error if jack and kate are not both instance methods, or if jack and kate are not both static methods, they have to be the same. So, how can your scenario of jack being non-static and kate's override method BEING static be true if they have to both be either static or both be non-staic?
@briantwill
@briantwill 8 жыл бұрын
+Keith Scull Yes, static and instance methods are unrelated and so cannot override one another. Perhaps I misunderstood your question, but I wasn't talking about any instance methods. In the scenario I described where Lisa
@ragavijay
@ragavijay 7 жыл бұрын
Concept of static is against OOP principles. Static is totally a separate entity which is not bounded to any of the object. For example, if we take Math.sqrt(n) method, the execution and result 100% depends on the parameter n. It don't have anything to do with the object of Math class. Static method is not an active participant of a class. So it can't be overrided. But static method can be used under two scenarios. (1) If we want to create a concrete method eg. Math.sqrt(). (2) If we want to create a method which operates on two or more objects (remember static method can have access to the private members of the objects as it is within the same class) eg. String.concat(String s1, String s2) - Thanks Brian for a nice video. Also correct me, if I was wrong anywhere.
@cuzsleepisthecousinofdeath
@cuzsleepisthecousinofdeath 4 жыл бұрын
5:03 Encapsulation is the notion of grouping data together with methods. And what this video says is just data hiding / access.
@Boufal10
@Boufal10 4 жыл бұрын
You seem to me mixing encapsulation with abstraction..he is right in the video
@diambarabas2624
@diambarabas2624 2 жыл бұрын
"We already covered..." about java script at 1:32 . When? Where? 😥
@adamlicavoli7697
@adamlicavoli7697 6 жыл бұрын
soothing and informative
@keithscull8288
@keithscull8288 8 жыл бұрын
I'm not as knowledgeable as the guy in this video, I'm a novice and studying to become an engineer BUT I have to say at 4:50, at least in Java, it IS true that the executions within methods are by default not varying like new instances of field/variables, however a method can be overrided, which basically let's you retweak the executions in a method.
@mushhushshutishpak7569
@mushhushshutishpak7569 10 жыл бұрын
are only methods inherited or also properties? is it inheritance only if all methods from parent to child are passed or also if it s just a subset ?
@briantwill
@briantwill 10 жыл бұрын
All members--both methods and properties--are inherited. Inheritance gives the child every member of the parent, no exceptions.
@briantwill
@briantwill 10 жыл бұрын
And be clear that the child inherits everything which the parent itself inherits from its parent. A class has everything that its ancestors have.
@briantwill
@briantwill 10 жыл бұрын
***** I think it's important to say that all of a parent's members get inherited by its children, period. Instances of a child class have all the properties and methods which instances of the parent class do. Access modifiers, however, may restrict the child itself from directly *referencing* a member inherited from its parent. The precise meaning of public / private / protected is language specific (and I believe 'default' is a term used only in Java). Code with all access modifiers removed will function precisely the same, but the idea is that they help enforce the intent of a class's author, either when instantiating that class or creating a subclass of it. Be clear that this 'enforcement' is to preserve good program structure, not for security purposes.
@rich1051414
@rich1051414 10 жыл бұрын
***** All object oriented languages will have their own differences when it comes to the specifics and syntax when actually coding, but a good generalization to the original question is that, when a class is inherited, instead of starting with a blank 'blueprint' for the class, you begin with that of the parent, and the parent starts with that of it's parent. All fields and methods, if you do not alter them in your class, will be the same as if you were to instance that of the parent instead. The ability a class's children has to change or access any of its parents fields or methods will vary based on the language, but inheriting those fields and methods is always a certainty.
@pennyl.8799
@pennyl.8799 8 жыл бұрын
Good example, the cat class with the "meow method."
@xuantruong46
@xuantruong46 8 жыл бұрын
great video, thanks so much!
Object-Oriented Programming is Garbage: 3800 SLOC example
52:48
Brian Will
Рет қаралды 227 М.
The Flaws of Inheritance
10:01
CodeAesthetic
Рет қаралды 859 М.
Угадайте концовку😂
00:11
Poopigirl
Рет қаралды 3,7 МЛН
[실시간] 전철에서 찍힌 기생생물 감염 장면 | 기생수: 더 그레이
00:15
Netflix Korea 넷플릭스 코리아
Рет қаралды 34 МЛН
STOP Using Classes In JavaScript | Prime Reacts
14:02
ThePrimeTime
Рет қаралды 203 М.
Object-Oriented Programming is Embarrassing: 4 Short Examples
28:03
Comparing C to machine language
10:02
Ben Eater
Рет қаралды 4,9 МЛН
Object-Oriented Programming is Bad
44:35
Brian Will
Рет қаралды 2,3 МЛН
Fundamental Concepts of Object Oriented Programming
9:16
Computer Science
Рет қаралды 812 М.
Object-Oriented Programming is Good*
9:45
Brian Will
Рет қаралды 142 М.
Object Oriented Programming is not what I thought - Talk by Anjana Vakil
38:51
Why Isn't Functional Programming the Norm? - Richard Feldman
46:09
Object Oriented Programming is Good | Prime Reacts
31:30
ThePrimeTime
Рет қаралды 273 М.