8. Object Oriented Programming

แชร์
ฝัง
  • เผยแพร่เมื่อ 26 ต.ค. 2024

ความคิดเห็น • 304

  • @leixun
    @leixun 4 ปีที่แล้ว +221

    *My takeaways:*
    1. Object 0:59
    2. Object oriented programming (OOP) 2:05
    3. Object (continued) 3:30 - objects are data abstractions that capture 1. what attributes can represent an object 2) how can we interact with an object
    4. The advantages of OOP 7:33
    5. Class 8:55
    6. Self 15:35 and an example in 19:05
    7. Method 20:55
    8. __str__ method 27:22
    9. Special operator 32:33

    • @SulemanKhan-hm1yc
      @SulemanKhan-hm1yc 4 ปีที่แล้ว +4

      ty bhai i was looking for this

    • @rafiy7150
      @rafiy7150 3 ปีที่แล้ว +3

      we need more poeple like you

    • @leixun
      @leixun 3 ปีที่แล้ว +3

      @@rafiy7150 You are too kind!

    • @SharronDenice
      @SharronDenice 3 ปีที่แล้ว +1

      Thank you!

    • @leixun
      @leixun 3 ปีที่แล้ว +1

      @@SharronDenice You are welcome!

  • @Wander4P
    @Wander4P 3 ปีที่แล้ว +24

    This explained Python objects so much better than any online tutorial I've read. Will definitely watch more of these lectures.

  • @ayyoubm
    @ayyoubm 4 ปีที่แล้ว +493

    dude. the internet is crazy, I have been to the best universities in the whole world without leaving my room.

    • @Xlielight
      @Xlielight 4 ปีที่แล้ว +2

      yes

    • @anjalisingh-sx5ct
      @anjalisingh-sx5ct 4 ปีที่แล้ว +4

      Any resource for oops c++ please🙏

    • @amans6504
      @amans6504 3 ปีที่แล้ว +10

      @@anjalisingh-sx5ct oops are same everywhere language doesn't matter

    • @josuegisber8150
      @josuegisber8150 3 ปีที่แล้ว

      Dude, you’re right

    • @Jon_Zeku
      @Jon_Zeku 3 ปีที่แล้ว +1

      for real for real

  • @鄭心和
    @鄭心和 3 ปีที่แล้ว +16

    0:01:32 Object 0:03:33 0:05:00 0:06:00 0:08:00
    0:09:05 Creating and using your own type with classes
    0:11:28 Define your own type
    0:13:01 What are attributes ​
    0:14:44​ Defining how to create an instance of a classes 0:16:00
    0:18:49 Actually creating an instance of a classes 0:20:38
    0:22:00 Define a method for the coordinate class
    0:24:29 ​How to use a method 0:26:00 0:27:40​ 0:30:52
    0:32:36 Special operators
    0:33:59 Class "Fraction"​ 0:36:00
    0:38:08​ Class "Fraction"​ used to compute 0:39:44

  • @fauzanstster
    @fauzanstster 6 ปีที่แล้ว +89

    Thank you very much MIT, Dr Ana Bell and all of contributors and donors

  • @koonsickgreen6272
    @koonsickgreen6272 5 ปีที่แล้ว +113

    As my token of gratitude Id like to give Ana another black shirt as a present to add to her already extensive collection of black shirts.

  • @yukeyang5735
    @yukeyang5735 6 ปีที่แล้ว +16

    1. Objects comprise of 2 parts,data members and methods.
    2. In effect,methods are a special type of function,function that is exclusive to an object.
    3. By default,it would be meaningless to print an object,but we can reimplement our method by defining __str__ function.Likewise,we can implement addition,subtraction of objects and so on.
    4. OOP is actually quite prevalent in computer science because it shields the details of a complex object from the user. It is a form of abstraction which simplifies the implementation of an application.

  • @johnnyfry2
    @johnnyfry2 4 ปีที่แล้ว +18

    I know this is a three year old video, but this is really well produced and presented. This professor represents the MIT brand well. Meticulous in detail but yet, easy to understand.
    Excellent lecture. The best presentation I have seen on the subject, and I've seen a few. Thank you.

  • @akshayram6868
    @akshayram6868 3 ปีที่แล้ว +8

    Thank you so very much dr bell! After months of searches and reading books, I’m really happy to have finally understood oop in python ! You are amazing ! Thank you so very much ! And thank you MIT !

  • @conceptgraduation694
    @conceptgraduation694 8 หลายเดือนก่อน

    00:02 Object-oriented programming is about everything in Python being an object.
    02:38 Objects are data abstractions with representation and interface
    07:07 Object-oriented programming allows bundling data and interactions into packages for reusable and readable code.
    09:20 Defining and using custom classes in Python
    13:58 Creating and interacting with coordinate points in object-oriented programming
    16:28 Methods and parameters in initializing a class
    21:06 Adding methods to interact with objects
    23:14 Using dot notation to access data attributes in classes
    27:20 Defining a custom method for printing objects of a specific type in Python
    29:25 Defining the Str method for the coordinate object.
    33:58 Object Oriented Programming: Fraction object representation
    36:19 Implementing fraction object using object-oriented programming
    41:01 Object-oriented programming allows bundling similar objects with common properties and methods.

  • @erockromulan9329
    @erockromulan9329 2 ปีที่แล้ว +2

    At 20 minutes in I was blown away at how fast it suddenly clicked for me. Wow! Great job, Dr. Bell!

  • @lakshmin121
    @lakshmin121 7 ปีที่แล้ว +15

    Hi. I am a beginner in python and find this course very helpful. I think the best part (and hence probably the most challenging) is that all the needed information is well packed into a few lectures. Thanks!

  • @Matt-lc6bs
    @Matt-lc6bs 3 ปีที่แล้ว +4

    Thank you Dr. Ana Bell and MIT! The diagram and explanation at 19:30 is when I finally understood why self is needed. (I think)

    • @diegoguisasola3858
      @diegoguisasola3858 3 ปีที่แล้ว +2

      It was an "Oh, I get it now" moment for me as well lol.
      Best 41 minutes I've spent today.

  • @danrivera381
    @danrivera381 3 ปีที่แล้ว +3

    I heard once to think of OOP classes as blueprints. It made so much more sense to me that way.

  • @CLi-kn6rf
    @CLi-kn6rf 5 ปีที่แล้ว +16

    I was having trouble understanding the concept of object oriented programming and I found this. extremely useful and well explained!

    • @obli8984
      @obli8984 3 ปีที่แล้ว

      did you>

  • @uetianeinsteins204
    @uetianeinsteins204 4 ปีที่แล้ว +3

    A bundle of thanks to MIT and especially to instructor : DR. ANA BELL..|||

  • @chesq-1557
    @chesq-1557 4 ปีที่แล้ว +1

    Software engineering student here (first year, about to start my second one)
    I've been taught a bit of POO in my second semester, I've done a shit tone of data types with their own methods and such as is required by my Data Structures subject
    I'm watching this as a way to prepare for POO, a subject I'll be taught this coming year; this is my refresher and hell it feels nice to know most stuff so far if not all (I'm 9 minutes into the video)
    I'm really excited to know what my future will look like, so far it's being great (average grade of 7 out of 10, one honorary mention in a CLI orientes subject and good relationships with my classmates and professors)
    love you all!

    • @chesq-1557
      @chesq-1557 4 ปีที่แล้ว

      @@summa1749 well hello! Software engineering, for me as for many others that get into it, has been quite a surprise. First of all, most people that get into it think it's like programing but there's a difference: software engineering is about providing quality solutions to a given problem using quality software designed using engineering principals, therefore a software engineer, eventho he/she knows how to program (and trust me, you WILL program) is better suit at designing the system itself, that's why you're taught things as database modeling and all as soon as second year.
      First and second year, as in most engineering stuff, is kinda Wide, meaning it's a general purpose year where you share all of the subjects with your mates from other engineering paths that might be similar to yours. You'll be taught a lot of mathematical concepts and the basics of programing+the not so basics. You'll also be taught (probably) the fundamentals of computers as in logic gates, secuencial circuits, you'll have to build yours using lab material and all.
      Overall it's a really cool experience and I love it, as hard as it might be sometimes, you just gotta be organized aaand do exams from past years to know what is required of you.
      If you have any more questions be sure to ask them! ^-^

    • @chesq-1557
      @chesq-1557 4 ปีที่แล้ว

      @@summa1749 well if we talk about maths you're gonna have them, but most of it either is reduced to derivates/integrations of functions, which is not really difficult, you just gotta learn a couple of formulas, that and some assing series like Fibonacci and all, and that's only in the first year
      for the second year, the most maths I've used are limit aproximations at an infinite point to know the complexity of an algorithm; my personal pro-tip, as always, is to practice
      if anything, the hardest thing to do are physics problems, but that's just because I've had not so good professors, the books themselves are amazing tho
      aaand no unfortunately I'm not familiar at all with the english system :( , but as far as I know from looking it up A level is like... 16 to 18 sooo just pick any maths and physics related stuff + some programming if you can (HTML courses will NOT be that useful tho, pick C or Java, Python is kinda meh)
      again, ask whatever you feel the need to :D you can reach me more easily on twitter @memirasytecalo

  • @marsum0971
    @marsum0971 5 ปีที่แล้ว +2

    Till date , tis is the best way of teaching the class and objects concepts, typical employee class example has done nothing but creating confusion n hence failure in implementing classes when needed to many people.. Ana tis S epic tutorial.. Thanks MIT

  • @youngjordan5619
    @youngjordan5619 3 ปีที่แล้ว +6

    guys, tips for you beginners / intermiadtes:
    function is the same as method except that methods are called methods cos they are in class, but it's the same as function, function is OUTSIDE class and methods are INSIDE class. But aside that it's the same thing. Another tip is that self. You use self ALWAYS (as long it's not static method) in class methods as a first parameter, even if method do not return anything, IT MUST HAVE that 1st parameter called self (stick to self). Another example, lady showed you bad example in 25:50, there is an easy way to do it by just declaring "static method" inside class so then you could use 2 objects like c.x and zero.x. And also I'd like to add this important answet to student who asked "how do we know if it's a float/string or int", we could determine specific data type in that constructor __init__ (or call it whatever you want) by just adding simple notation like def __init__ (self, x: str, y: int): ... so now if you have mypy, it will always watch if X is string and Y int, if not then error. You dont need to add some extra code inside method as lady said, waste of lines. and Lastly important info for you, join official python discord for help/resources here: discord.gg/python and here you have some resources you can learn from / improve: pythondiscord.com/pages/resources/

    • @obli8984
      @obli8984 3 ปีที่แล้ว

      useful thanks for your valuable help

    • @soldierkatr
      @soldierkatr 2 ปีที่แล้ว

      Do you teach??

  • @RonSheely
    @RonSheely 5 ปีที่แล้ว +6

    Thank you Dr Ana Bell. Most instructive. The fraction class gave me a hint into the mysterious world of computer algebra systems and how they might work by symbolically manipulating numerator and denominator.

  • @terutherford4905
    @terutherford4905 6 ปีที่แล้ว +5

    My understanding is that the internal implementation of Python list is an array as it allows O(1) access operation in contrast to the linked list claimed by the lecture.

    • @go_learners
      @go_learners 6 ปีที่แล้ว +1

      Yeah, suppose you have a list of i elements of same data type and one element takes 4 bit of space in memory. Then python creates a pointer of 4*k to access the kth element. It doesn't matter how long is the list, it will take same time to access any element. Obviously it will take more time for nested lists.

    • @souravkumar-ue8uj
      @souravkumar-ue8uj 5 ปีที่แล้ว +2

      Correct , internal implementation of pythonic lists is array so basically it's dynamic array whereas linked list is altogether a different data structure .

    • @bdjeosjfjdskskkdjdnfbdj
      @bdjeosjfjdskskkdjdnfbdj 5 ปีที่แล้ว

      It seems like she’s referring to a custom list impl using singly linked list which is needed to teach any mod on sicp

    • @Hopetobebetter
      @Hopetobebetter 11 วันที่ผ่านมา

      @@souravkumar-ue8uj hope someone clarifies this.

  • @harshvardhanrathore7751
    @harshvardhanrathore7751 27 วันที่ผ่านมา

    Best Explanation of OOP's Python I ever seen.

  • @ShermanSitter
    @ShermanSitter 4 ปีที่แล้ว +3

    This was the BEST (by far) description of classes I have seen on the internet. Not surprisingly, but there is an obvious benefit to courses from top tier universities.

  • @zanakil
    @zanakil ปีที่แล้ว

    OOP has 4 principles : Abstraction, Encapsulation, Inheritance, Polymorphism. Nice explanation of these here.

  • @kebincui
    @kebincui ปีที่แล้ว +6

    Awesome lecture. Thanks Dr Ana Bell

  • @zlmsailor
    @zlmsailor 4 ปีที่แล้ว +6

    Anna is an awesome teacher! However the camera should probably focus on the course slides. I know I probably ask for too much for MIT Open Course. Thank you anyway and I will make donation at the end of this course.

  • @isharthrastogi782
    @isharthrastogi782 5 ปีที่แล้ว +41

    5:35 python list data isnt actually internally represented as link list. Its internally is an array

    • @ispeaknumbers
      @ispeaknumbers 4 ปีที่แล้ว +4

      Glad you pointed this out! I was confused on this coming from C to Python, and I thought of it more as a dynamic array than a linked list.

    • @sreehari563
      @sreehari563 3 ปีที่แล้ว

      I think Arrays in C might actually be represented internally as linked lists

    • @hieuvuminh1653
      @hieuvuminh1653 3 ปีที่แล้ว +4

      @@sreehari563 I'm pretty sure that's not the case. Array and linked lists are 2 different data structures and they are used in different applications. With array, the time you need to access any element is the same, whereas the deeper the element is in a linked list, the longer it takes to access that element.

    • @jtk1996
      @jtk1996 3 ปีที่แล้ว

      your answer is wrong in itself, "array" does not say anything about its internal representation.

    • @davyroger3773
      @davyroger3773 2 ปีที่แล้ว

      @@jtk1996 Contiguous blocks of memory vs non contiguous aka linked nodes/blocks of memory

  • @MrSrijanb
    @MrSrijanb 6 ปีที่แล้ว +7

    this is a very informative and fast paced course. thanks mit.

  • @abins641
    @abins641 3 ปีที่แล้ว

    Finally I understand what is class , objects and attributes. Thank you very much.

  • @fishjimmy2007
    @fishjimmy2007 5 ปีที่แล้ว +4

    oh my god. MIT best. I feel pity didn't study hard in the past

  • @user-tv6dh2jo5h
    @user-tv6dh2jo5h 4 ปีที่แล้ว +3

    Thank you MIT and Professor Ana!!! I really enjoy the lectures and I learned a lot.

  • @maximus2978
    @maximus2978 ปีที่แล้ว

    This is the best explanation of python class I had ever seems!! Thanks for the lecture.

  • @sahajthareja9415
    @sahajthareja9415 4 ปีที่แล้ว +1

    It starts to get real with this video.. Thanks MIT , Thanks Anna

  • @zigginzag584
    @zigginzag584 4 ปีที่แล้ว +1

    I feel like this could have been better explained in reverse. It wasn't until toward the end of the lecture that it really solidified in my mind that you have to instantiate, create an instance of the class by assigning a variable to an object of the class before you could use the methods on the class objects. That's unfortunate because it seems so pertinent to understanding OOP. However, I'm eternally grateful for the opportunity to be able to write this and actually know wtf I'm talking about! woo hoo for that!

  • @SatyamSingh-nq2il
    @SatyamSingh-nq2il 2 ปีที่แล้ว

    I love how she measured every word before speaking it.

  • @hlj013
    @hlj013 6 ปีที่แล้ว +29

    I would prefer that the professor be in a small window of the screen and her class content that she flashes to, be continuously displayed. I have a hard time reading and absorbing it in the short time that it is being displayed.

    • @mitocw
      @mitocw  6 ปีที่แล้ว +22

      +hlj013 These complete course materials including lecture slides and code files can be found on the OCW course site: ocw.mit.edu/6-0001F16. You can download the lecture notes and follow along with the video at your own pace.

    • @Cashman9111
      @Cashman9111 6 ปีที่แล้ว +19

      while you are right.... yeah, just pause it, genius

  • @pengxu8542
    @pengxu8542 4 ปีที่แล้ว +1

    Ana's appeal has been really consistent so far

  • @venkateshaprasads5741
    @venkateshaprasads5741 4 ปีที่แล้ว +3

    I understand what classes are.But what are the use of classes? What are the things that can be done in class but not in a normal function?

  • @4sightanalytics264
    @4sightanalytics264 3 ปีที่แล้ว +1

    This is the best explanation I have seen. Thank You Thank You.

  • @haroldgil7472
    @haroldgil7472 6 ปีที่แล้ว +1

    FYI Slide 5 says lists are represented internally as a "linked list" of cells. However, the Python docs and 6.006 state that Python lists are implemented as "arrays", not "linked lists".

    • @dinishdavis7329
      @dinishdavis7329 6 ปีที่แล้ว

      array in python ---- : mystr="hello", print mystr[1] ----this gives 'e' :). array is a data structure that stores values of same data type. in python, List store values of different data types ----list=[1,'a',"hello",1.1]

  • @wanderingfido
    @wanderingfido 7 ปีที่แล้ว +2

    I would've been too tempted to try and explain the Iterator pattern as part of this lecture, even though it's supposed to just be a class for beginners. I guess that's why I'm not a [sic] perfessor. LOL.
    But on a serious note, people should read the Gang Of Four book from 1995 called 'Design Patterns' or one of the newer editions. Although, I wouldn't try to use any of the patterns deliberately. It can get frustrating to try and follow them to the letter. The GoF book should be read just to understand developer lingo during scrum meetings. If you remember to put a role or complicated task into its own class, that'll save you. Then the role or task becomes easier to change because it's already in a separate class file. It can be that simple.

  • @anonymous.youtuber
    @anonymous.youtuber 2 ปีที่แล้ว

    What a joy it must be to teach at MIT. You get listened to, and you get asked interesting questions. Excellent teaching this is.

  • @mahsam6878
    @mahsam6878 3 ปีที่แล้ว +2

    Thank you for the awesome presentation
    And for those who might be watching this but feel like they're understanding nothing, well I had the same feeling in the first 10 minutes, but things got crystal clear as soon as she started writing her own class. So, take your notes, if you do, and keep watching the video😁

  • @fi4255
    @fi4255 4 ปีที่แล้ว +2

    Thank you very much MIT and Dr Ana Bell, really very helpful.

  • @rohithperumandla4302
    @rohithperumandla4302 5 ปีที่แล้ว +2

    Thank you Dr.Ana for your clear lecture.

  • @theshreyansjain
    @theshreyansjain ปีที่แล้ว +1

    Python lists are implemented as overallocated arrays and not linked lists

  • @ucmanhao4386
    @ucmanhao4386 7 ปีที่แล้ว +4

    Great and very understandable lecture ! Thanks, Dr.Ana Bell!

  • @lucam9806
    @lucam9806 ปีที่แล้ว

    it really makes SENSE. thank you

  • @ProfitScalpKing1
    @ProfitScalpKing1 7 ปีที่แล้ว +1

    amazing articulation. very clear and easy to grasp!! much respect!!

  • @FelipeBatistaOsilva
    @FelipeBatistaOsilva 3 ปีที่แล้ว +1

    Thank you so much for this opportunity to learn!

  • @RicardoHernandez-nd5pp
    @RicardoHernandez-nd5pp 4 ปีที่แล้ว

    MIT, a preview of what came with distance education. Thanks

  • @Damoon2543
    @Damoon2543 6 ปีที่แล้ว +2

    Firs of all I wanted to thank you for the awesome course. I also have a suggestion. I find it easier to follow when the class attributes and the function inputs are of different names. for example :
    def __init__(self, x0, y0):
    self.x = x0
    ...

    • @ravivdesai
      @ravivdesai 5 ปีที่แล้ว

      Damoon Rastegar what does x represent here vs x0?

    • @iBot.
      @iBot. 5 ปีที่แล้ว

      That would just disrupt/throw me off, but I guess you do you.

  • @LF58888
    @LF58888 2 ปีที่แล้ว

    Guess what? This is better then the 2 hour lecture from my prof

  • @wanderingfido
    @wanderingfido 7 ปีที่แล้ว +1

    This was a nice minimalistic intro to OOP in Python. But it's kinda weird that you can't 'return self(top, bott)' rather than 'return Fraction(top, bott)' as per Dr Bell's Fraction example. I just tried it in Python 2.6.6. If I recall correctly, Java lets you do that with 'this'. ...But come to think of it, Java probably allows that because you can't do Multiple Inheritance in Java.

    • @carlitors
      @carlitors 7 ปีที่แล้ว

      Interesting, hadn't thought about it.

    • @jtk1996
      @jtk1996 3 ปีที่แล้ว +1

      she is returning a new Fraction, not 'self', if you refer to __add__ and __sub__ in the Fraction class

  • @Simon-xi8tb
    @Simon-xi8tb 7 ปีที่แล้ว +1

    Why should coordinate be an object. It has no behaviour in itself, it's just a tuple of two ints. Just data. And a function to compute euclidian distance is just a function that takes two coordinates, four integers or two arrays, depending on how you decide to represent coordinates as data.

  • @abanerjee3704
    @abanerjee3704 4 ปีที่แล้ว

    Thanks MIT and Dr. Ana Bell
    🤘

  • @sreenimensa
    @sreenimensa 2 ปีที่แล้ว

    Amazing teacher!!! Makes the concept super simple and clear!!!

  • @sevos
    @sevos 4 ปีที่แล้ว +3

    Unfortunate that video title is a little misleading. I expected it to be a lecture about theory behind OOP, and it turned out to be more of a Python tutorial

  • @christiananmoh9759
    @christiananmoh9759 ปีที่แล้ว

    This is very helpful. Thank you

  • @nedbatchelder
    @nedbatchelder ปีที่แล้ว

    She says that Python lists are linked lists. They are not. Python lists are vectors of pointers to objects.

  • @sheinsoe3717
    @sheinsoe3717 4 ปีที่แล้ว

    I would kindly like to suggest that, it is probably only me or other people? this video makes me a headache because the camera is constantly moving back and forth between Dr. Ana and the PowerPoint slides. It is so so not MIT, I did not expect it from MIT. Thank you for uploading the video.

  • @oftavukcuoglu
    @oftavukcuoglu 11 หลายเดือนก่อน

    giving "list" as an example is quite confusing but other than that fantastic lecture.

  • @yvonneachieng7257
    @yvonneachieng7257 6 ปีที่แล้ว +2

    Extremely good explanations...Thank you Anna

  • @kizitobukenya6057
    @kizitobukenya6057 5 ปีที่แล้ว +1

    class Gratitude(object):
    def __init__(self, MIT, Ana):
    self.MIT = MIT
    self.Ana = Ana

  • @marthinusjansevanvuuren2774
    @marthinusjansevanvuuren2774 4 ปีที่แล้ว +2

    This was very informative and helpful. Thanks!

  • @waleedktl591
    @waleedktl591 3 ปีที่แล้ว

    Thank you internet! ❤️

  • @johanv5546
    @johanv5546 7 ปีที่แล้ว +1

    ~36:00. c = a + b. How is a and b assigned to "self" and "other", how do you know which gets assigned to what? Would appreciate an explanation what happens and where a and b values are sent.

  • @markjones2349
    @markjones2349 4 ปีที่แล้ว +2

    This OOP topic seems like a sure way to make simple programming extremely complicated to understand. I'm going to guess that most people programming at home will probably never have to use these concepts. Straight functional programming seems like as complex as I would ever need to get.

    • @jtk1996
      @jtk1996 3 ปีที่แล้ว

      so what? you watch an introduction to computer science and want to stop it at a level of "programming for dummies"?

    • @markjones2349
      @markjones2349 3 ปีที่แล้ว

      @@jtk1996 I'm not the only one who thinks OOP is too abstract and overcomplicates things. I've watched several videos from accomplished programmers who can't stand using it. How does not using OOP make you a dummy exactly? Not every concept is required to program.

  • @truongkham3845
    @truongkham3845 4 หลายเดือนก่อน

    the best i have seen😍

  • @WaveShapePlay
    @WaveShapePlay 7 ปีที่แล้ว +3

    Thank you for this great lesson in OOP!

  • @markuswalter3611
    @markuswalter3611 4 ปีที่แล้ว

    Very clear explanation, great video

  • @abhilasha100
    @abhilasha100 3 ปีที่แล้ว +1

    from where can I download the .py files and slides mentioned early in the video to follow along?

    • @mitocw
      @mitocw  3 ปีที่แล้ว +1

      The course materials can be found on MIT OpenCourseWare at: ocw.mit.edu/6-0001F16. Best wishes on your studies!

  • @PankajKumar-ji1ig
    @PankajKumar-ji1ig 2 ปีที่แล้ว

    Thank you for the lecture professor

  • @FahimKhan-vd8yp
    @FahimKhan-vd8yp 5 ปีที่แล้ว +2

    Thank You Mam!
    #just some random thought, I liked the way you said "oops" in 17:02

  • @im.austine
    @im.austine 7 ปีที่แล้ว +53

    Thanks MIT and Dr. Ana Bell for the clear lecture on OOP... Just a dry joke, I was the '404' liker for this video 😒

    • @boxxcar3768
      @boxxcar3768 6 ปีที่แล้ว

      th-cam.com/video/iGtBVeqYQKY/w-d-xo.html

  • @ZukoNtabo
    @ZukoNtabo ปีที่แล้ว

    Class can be used to contain objects and can be used

  • @spiritualitywithkids
    @spiritualitywithkids 2 ปีที่แล้ว

    Thank you so much for this awesome lect :)

  • @tonyjames1980
    @tonyjames1980 5 ปีที่แล้ว

    There is no need to derive from object class in Python3. Unless you want to teach students that Python3 always inherit from the object class

    • @47moris
      @47moris 4 ปีที่แล้ว

      tony james I remember she used Python 2 in the course

  • @kAlhooti1
    @kAlhooti1 7 ปีที่แล้ว +13

    It is 2017 and python 2 end of life is by 2020. yet a big University like MIT teaches bython 2 instead of python 3. in python 3 you do not need to specify the object in closed brackets after defnining class name. just write >> class Coordinate: . in python 2 you have to write class Coordinate (object): to make python 2 classes behaves like python 3.

    • @RC-bl2pm
      @RC-bl2pm 7 ปีที่แล้ว +3

      Holy cats! Im just learning classes in py 3 of course! and I was wondering why all my other teachers had neglected to show us specifying parent type! its because my new teachers are up to date and MIT is behind the times?!?!? Jesus Christ! So now to compare a 60,000$ MIT education versus 25$ a month on treehouse/two python books/lots of TH-cam ......happy landing where I am! The way I try and keep myself from being confused isby date of video...this one is feb 2017, but theyre teaching py2? Dude you have saved me some grief! Thanks.

    • @kAlhooti1
      @kAlhooti1 7 ปีที่แล้ว +3

      actually in python 3 you can specify parent class if you want to inherent its methods or attributes into the new class. the parent class can be a class you built or python own classes like list, dictionaries or etc. the reason python 2 uses object as parent class is to let the class behaves like python 3 classes. there was a change in python 3 in something called method resolution order. More details can be found here, th-cam.com/video/ZDa-Z5JzLYM/w-d-xo.html. However, to truly grasp the idea of OOP, you need to work on a project where OOP is used to built the codes upon which your project depends on. This website www.python-course.eu/python3_object_oriented_programming.php also is a good place to learn OOP or python in general. Good luck.

    • @LordAhmedAmr
      @LordAhmedAmr 6 ปีที่แล้ว +11

      actually from the course website it's written in the description that The class uses the Python 3.5 programming language.
      ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-0001-introduction-to-computer-science-and-programming-in-python-fall-2016/index.htm

    • @EgeOnatDoguslu
      @EgeOnatDoguslu 6 ปีที่แล้ว +10

      The sheer stupidity of this comment is immence!

    • @zufex2029
      @zufex2029 6 ปีที่แล้ว +6

      She just wants students to know how object oriented programming works. How classes are implemented etc... Nobody cares if it is python 2 or python 3, because it is absoletely irrelevant. On universities students study many old languages which aren't important today, they just learn how programming languages work.
      # I'm not native english speaker

  • @aabirbhattacharya3395
    @aabirbhattacharya3395 2 ปีที่แล้ว

    thank u for amazing lecture

  • @mymacaintwag
    @mymacaintwag 4 ปีที่แล้ว

    Object oriented code is more readable? In which parallel universe? Have you actually tried to understand object oriented code vs procedural code? How is it reusable and more readable?
    Well explained, though, but some very false statements, which most beginners would not care about.

    • @gehanameresekere1345
      @gehanameresekere1345 4 ปีที่แล้ว

      I am at minute 39:00. Adding fractions. This may be a good way to illustrate the concept but training programmers to use OO programming methods looks to be a difficult task, any business should look at the cost benefit.

  • @mohnishbelani3674
    @mohnishbelani3674 3 ปีที่แล้ว +1

    Can anyone explain how is list.sort() implemented in Python? Which sorting algorithm is used and what is its efficiency? How can I find these details?

    • @lepidoptera9337
      @lepidoptera9337 3 ปีที่แล้ว

      You read the source code. How hard is that? Or you just look it up on the web at wikipedia. It's called Timsort.

  • @15837pawimomo
    @15837pawimomo 6 ปีที่แล้ว +3

    Thank you for uploading

  • @surenganesh7609
    @surenganesh7609 5 ปีที่แล้ว +2

    thank for the informative presentation.

  • @leilab9406
    @leilab9406 5 ปีที่แล้ว +2

    First thank you for this great tutorial! In 36:00, why do we have inverse function without the leading and trailing underscores? What does it mean those underscores make a function "magical"?

    • @FahimKhan-vd8yp
      @FahimKhan-vd8yp 5 ปีที่แล้ว +4

      That is one way to say it I guess, probably a misleading way. Those underscores differentiate built-in "accessories- I might say" from those user-defined. those are like built-in functions. For example, when python interpreter sees a "+" in a script associated with this object instances (like in "c + origin"), it's going to implicitly call "__add__" function(as written on the definition of that instance's object) and act accordingly what's written on that subroutine. You could implement "adding two coordinates/fractions" in your way-like defining a function as " def add(self,other)--the exact subroutine follows--", but then you won't be able to add two instances(coordinates or fractions or whatever) using shorthand "+" notation(like frac1+frac2), you'd have to explicitly tell that frac1.add(frac2), otherwise, you'd get an error. So, __add__, __float__ etc have the traits they have because python implies that they have, not because of "underscores", the underscores just differentiate them from others, marking them special; they do not not make something special. I hope that clarifies.

    • @aydinjalilov2328
      @aydinjalilov2328 4 ปีที่แล้ว

      Because that is not built in operator but a custom function that she has designed

  • @sandipansarkar9211
    @sandipansarkar9211 3 ปีที่แล้ว

    GREAT SESSION

  • @RicardoHernandez-nd5pp
    @RicardoHernandez-nd5pp 4 ปีที่แล้ว

    Proffesor Bell. Thanks

  • @jflopezfernandez
    @jflopezfernandez 7 ปีที่แล้ว +1

    Awesome lecture, thank you so much

  • @rashidxd
    @rashidxd 7 ปีที่แล้ว +1

    i really liked her lectures ... God bless You!

  • @MrDevZero
    @MrDevZero 7 ปีที่แล้ว +1

    Thanks. Great lectures. Love it.

  • @shadowkyber2510
    @shadowkyber2510 3 ปีที่แล้ว

    The camera following her back and forth makes me dizzy, I wish you just zoomed out instead of swinging it back and forth

  • @kraj2217
    @kraj2217 4 ปีที่แล้ว

    What makes special operators special; I mean we can define them normally, right?

    • @sudeepkanda
      @sudeepkanda 4 ปีที่แล้ว +1

      Yeah.but python is providing them inbuilt as the same way as it gives all time

  • @dinhnhobao
    @dinhnhobao 6 ปีที่แล้ว

    I get the idea but why and when do we should use OOP. Why don't we just use the existent classes such as tuples, lists, dictionaries? Any examples for comparision between normal programming and OOP?

    • @shanepython
      @shanepython 6 ปีที่แล้ว

      This is a question I have had. I "get" OOP but what are real world examples of where OOP is beneficial over Procedural programming? Someone explaining that would be very helpful.

    • @quangtung2912
      @quangtung2912 5 ปีที่แล้ว

      OOP better than Procedure because of dynamic polymorphism and nothing else. Robert C Martin, the person who write famous books about OOP and SOLID, even said something similar.

  • @srimurthy7143
    @srimurthy7143 3 ปีที่แล้ว

    Thank you.

  • @linsco7s
    @linsco7s 4 ปีที่แล้ว

    Good video. Well explained.

  • @vashisht1
    @vashisht1 7 หลายเดือนก่อน

    Why these computer scientists keep one name instead of calling attributes and data...methods and functions...so confusing

  • @albiiist
    @albiiist 7 ปีที่แล้ว +1

    I Loved the lecture..

  • @tissues2441
    @tissues2441 5 ปีที่แล้ว

    This is extremely helpful

  • @stephan3694
    @stephan3694 ปีที่แล้ว

    Can you share your code about the other function implementations(sub, add, float etc....)

    • @mitocw
      @mitocw  ปีที่แล้ว +1

      Course materials, code snippets, etc. can be found on MIT OpenCourseWare at: ocw.mit.edu/6-0001F16. Best wishes on your studies!

  • @MichaelGTadesse
    @MichaelGTadesse 5 ปีที่แล้ว

    Great introduction to OOP!