CS50P - Lecture 8 - Object-Oriented Programming

preview_player
Показать описание

TABLE OF CONTENTS

00:00:00 - Introduction
00:00:24 - Object-Oriented Programming
00:01:00 - Tuples
00:18:39 - Dictionaries
00:26:45 - Classes and Objects
00:39:18 - Instance Methods
00:59:49 - Validating Attributes
01:04:25 - The String Method
01:11:13 - Custom Methods
01:15:33 - Properties, Getters and Setters
01:38:49 - Types and Classes
01:47:23 - Class Methods
02:17:29 - Inheritance
02:31:59 - Operator Overloading

An introduction to programming using a language called Python. Learn how to read and write code as well as how to test and "debug" it. Designed for students with or without prior programming experience who'd like to learn Python specifically. Learn about functions, arguments, and return values (oh my!); variables and types; conditionals and Boolean expressions; and loops. Learn how to handle exceptions, find and fix bugs, and write unit tests; use third-party libraries; validate and extract data with regular expressions; model real-world entities with classes, objects, methods, and properties; and read and write files. Hands-on opportunities for lots of practice. Exercises inspired by real-world programming problems. No software required except for a web browser, or you can write code on your own PC or Mac.

Whereas CS50x itself focuses on computer science more generally as well as programming with C, Python, SQL, and JavaScript, this course, aka CS50P, is entirely focused on programming with Python. You can take CS50P before CS50x, during CS50x, or after CS50x. But for an introduction to computer science itself, you should still take CS50x!

***

HOW TO SUBSCRIBE

HOW TO TAKE CS50

HOW TO JOIN CS50 COMMUNITIES

HOW TO FOLLOW DAVID J. MALAN

***

CS50 SHOP

***

LICENSE

CC BY-NC-SA 4.0
Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License

David J. Malan
Рекомендации по теме
Комментарии
Автор

Having spent over 100 hours across various paid and free resources, nothing matches the unique teaching style and enthusiasm of Professor David Malan. His passion and approach to teaching are truly remarkable. What makes this course unique is how he gradually sets the stage for different concepts. CS50 is absolutely the best course to learn Python.

sabouraram
Автор

How does this man have so much energy and focus to shoot at 2 hour 50 minute lecture. Incredible.

WarbossPepe
Автор

CS50 is best course out there. Malan is the best teacher I've seen . His understanding on OOP and python in general is outstanding. How lucky are these harvard students

nobertwekesa
Автор

I've been using OOP and objects for years in Python. Still learned quite a lot. Great introductory video. So, thanks!

For those who may feel a little discouraged about objects, don't worry. It's one of those things where a lightbulb has to go off and then you're like wow, now I understand. And you won't be able to control yourself, lol.

Few suggestions to help out:
• Focus on concepts, not syntax
• Concepts are too simple, that's why it's hard, it just instances
• Everything is an object including the space above your head, date/times, parking spots, lanes on a highway, a web page
• Objects are responsible for their own methods which means it's not a mechanic that changes the oil on a car, it's the car itself that changes it's own oil
• Objects are composed of other objects like a Car() which has 4x Wheel()
• Extremely important, all the data & functionality travels with the object (known as encapsulation). So, you don't keep a separate birthday list for family members. You ask the instance of the Grandma() object directly if it's her birthday. She's responsible for knowing, not you.

Fun example... Create 100x Casino() with 50x Table() with 1x Shoe() of 8x Deck() of 52x Card(). Randomly distribute the 40, 000 deck of cards amongst the casinos and various tables. Shuffle the cards for each shoe. And oh ya, each card has a unique serial number. And card #888 of 2 million+ is defective and needs to be replaced. Find the casino and table where card #888 is located. Thats the power of OOP.

alainrouleau
Автор

This was soooo good. This class took me longer than any other previous CS50P classes, but it was worth it. I love the metaphors, they are vivid and to the point. Having took CS50P for more than a month now, this course has certainly grown on me. Sometimes, when I feel down or upset in life, watching David's teaching just gives me a sense of order and inspiration. And the problem sets are equally fun, engaging and challenging. Just want to say a big thank you to the whole CS50 team.

yqhanliving
Автор

Wow David got so passionate on this one that he almost had no voice to say "This was CS50". Such enthusiasm, im so glad this got to be my first programming course ever. Thank you thank you!

javierdemendonca
Автор

The best thing that happened to me this year is CS50.

mehreentabassum
Автор

I nearly use about 6 hours to finish this OOP class. David malan explains so carefully and the example is well-designed. In some part of this video I watched it again and again. the best class in CS50P

ifzheqb
Автор

extremely engaging way to teach programming. i wish all teachers are like this. very precise, articulate, consistent and masterful. especially at the end. the most difficult concepts to comprehend (on your own) were explained like they were nothing. this guy is my hero <3

EDIT:
omg, the getter and setter explanations were amazing!! it's just now that i understand them perfectly! some people attempted to explain this here in youtube, but the topic always came out either trivial, useless, convoluted or ignorable. the professor is not only so precise to explain things line by line, but also explains the thoughts that must go through your mind while creating it. AND even went as far as creating actual examples THAT CONNECTS as a whole. talk about knowing his stuff!! omg.. it's just perfect

adfinemrising
Автор

I started my computer science journey with watching CS50 videos over two years ago, nowadays I'm using them to quickly brush up on concepts. Either way, CS50 changed my life :')

DeejayManiaNYC
Автор

Thank you so much Harvard for keeping this treasure trove for free on YouTube available for everyone. Dear Sir David J.Malan, your energy and enthusiasm just flows like a Lava when you teach and you're the best instructor I have ever seen ❤.

shakeelahmed
Автор

by far the hardest lecture week so far. I'm having difficulty trying to understand the concept of OOP. Probably will take a look at another sources on this OOP concept.

HairoHeria
Автор

Dear David,
I just watched your video on OOP and I finally understand it. Your clear explanation and examples made all the difference. Thank you so much for sharing your knowledge with us. Your teaching has made a big impact on my learning and I am grateful for it.
Best regards, from tunisa

hafsirayen
Автор

How did Mr. Malan manage to speak for 3 hours straight while giving us a thorough understanding of the topic? mind blowing

thetwinsuns
Автор

Woww ! I'm doing mentally high five. I'm glad I found CS50. The teaching skill is exceptional ! Thank you so much !!

Neojs
Автор

David is a world class educator who must surely be in the top 0.5% of python teachers on this Earth. Add that to the greatest practice labs of any python course on Earth and it becomes an undeniable fact that this is the best python course that exists anywhere on this planet.

catocross
Автор

the magic is he's saying the same thing that a lot of youtubers do, but his expression somehow make it so easy to understand It's magic !

vinhnghiang
Автор

David is such a legend as he is able to understand / decipher what his students are asking. i had a hard time understanding them :/

brucebergkamp
Автор

The best teacher I've seen so far.

absadiq
Автор

Just amazing, I’ve been trying to understand OOP for a while and here it is all explained brilliantly by David and his team. The learning cycle isn’t complete without some practice and application, so that’s what next with the assignments and my own programming needs. Many Thanks for the incredible generosity in sharing these lectures.

WalkingEng