My 1st and 2nd OOP class definitions (aka What is an OOP class definition?)
WHAT IS OOPS?
The Metaphor / Analogy / Model Problem of defining "Classes"
---^^^--- OOP Object Oriented Programming: Fall Asleep to Boring Facts for Sleep
---^^^--- Python OOP Tutorial 1: Classes and Instances
---^^^--- Real Python -- Object-Oriented Programming (OOP) in Python
---^^^--- James Clare -- Playlist = Object Orientation [19 videos]
- ---^^^--- Pydantic Tutorials playlist [10 videos]
---^^^--- Corey Schafer -- Python OOP Tutorial 1: Classes and Instances
- ---^^^--- Playlists -- Python OOP Tutorials - Working with Classes
---^^^--- (DG) = Data Guru -- Python OOP Part -1 Concepts Explained | Class, Object & Inheritance Made Easy (Beginner to Advanced)
---^^^--- Turn on CC !!!
- ---^^^--- (DG) Python OOPS Part -2 | Polymorphism in Python Explained (context based)
- ---^^^--- (DG) Python OOP Part - 3 | Encapsulation in Python Explained
- ---^^^--- (DG) Part - 4 Abstraction in Python Explained
- ---^^^--- (DG)
---^^^---
---^^^---
---^^^---
Wiki = Object-oriented programming
Google = object oriented programming
Reddit = object oriented programming
YouTube = object oriented programming in python
MIT course = Object Oriented Programming
Wiki = Object-oriented programming
Google = object oriented programming
Reddit = object oriented programming
YouTube = object oriented programming in python
MIT course = Object Oriented Programming
Wiki = Object-oriented programming
The underlying ideas for both my 1st and second OOP projects are explained (here). I successfully implemented the loop tracker first and my second project --not yet finshed-- will be the Abbreviation Xpander (class AbbvXpander():) But first, let's discuss some basics:
(1) What is a "class"?
(2) What is an "object"? (The original plan was 'messaging' as explained here)
(1) What is a "class"?
(2) What is an "object"? (The original plan was 'messaging' as explained here)
[Note to self: How to find all locations of character in string? (Google Answer here) (YT Answer here)
Re Gemini answer: wow clever, use enumerate ]
Re Gemini answer: wow clever, use enumerate ]
The Metaphor / Analogy / Model Problem of defining "Classes"
The map is NOT the territory and similarly, the "class" is not the "object".
Moreover, the term "object" is intuitively seen as a container of "attributes". Example: A car "object" is easily understood to being a container of related descriptive attributes such as: engine size/power, fuel efficiency in miles/gallon, passenger capacity, cargo capacity, and so on.
Rename the concept of object as being a "widget" and we may instead consider it as being a container of related "methods" (aka functions), The car widget may contain methods such as: accelerate, decelerate, brake to a stop, change direction of steering (e.g. left/ right/ degrees), change transmission setting (e.g. park, neutral, reverse, fwd gear number), honk the horn (a form of communication) and so on.
A hybrid object/widget may be considered as a container of related "methods" and "attributes".
Various online tutorials use many different analogies, metaphors and models for explaining what a "class" is within the realm of OOP. These include the cookie-cutter analogy, the human/person versus Bob analogy, the "vehicle" versus "car" versus "My Ford 350 pickup" analogy, "computer" versus "laptop" versus "components within" analogy, and so on.
Here, in this post, we will imagine a small scale construction company that specializes in building family homes based on floor plans depicted in blueprints/ templates.
This hypothetical construction company will have a constructor crew that actually builds each "instance" of its repertoire of family homes (e.g., 1 story, 2 story, basic home, luxury home, etc.). In Python, the work done by this "constructor" crew is defined by the __init__() function. The output of the init dunder (double underline function) is called the "instantiated object"
The constructed family house will have various characteristics ("attributes") and functional capabilities ("methods). Examples of attributes may include: (a) number of bedrooms, (b) number of bathrooms, (c) number and categories of other kinds of rooms or other spaces, (d) dimensions and orientations of the rooms/ spaces, (e) number of stories and locations within each story of the rooms/ spaces, (f) and so on.
Separate from the definition of the "family home" class, the construction company can be its own "class" and its attributes can include the various pieces of equipment (e.g., scaffolding, ladders, etc.) that it uses in building homes as well as the techniques ("methods") used for building its outputted objects (the homes)
The built / instantiated family homes / objects are not static things. Instead they provide services like: (a) powering lights and other electric devices; (b) maintaining comfortable air temperatures via HVAC subsystems; (c) providing security via locking of doors and windows plus an electronic security monitoring subsystem; (d) providing cold storage facilities via refrigerators, (e) ... see functions ("methods") supported by the family home (here). See YT results (here and more specifically here) These will be the "methods" supported by the instantiated objects (the built homes) See here and more specifically here [See AI-Konic vids here]
TO BE CONTINUED ... SEE BELOW MORE TO EXPLORE
Rename the concept of object as being a "widget" and we may instead consider it as being a container of related "methods" (aka functions), The car widget may contain methods such as: accelerate, decelerate, brake to a stop, change direction of steering (e.g. left/ right/ degrees), change transmission setting (e.g. park, neutral, reverse, fwd gear number), honk the horn (a form of communication) and so on.
The Basics
MORE TO EXPLORE
---^^^--- CS50P - Lecture 8 - Object-Oriented Programming---^^^--- OOP Object Oriented Programming: Fall Asleep to Boring Facts for Sleep
---^^^--- Python OOP Tutorial 1: Classes and Instances
---^^^--- Real Python -- Object-Oriented Programming (OOP) in Python
---^^^--- James Clare -- Playlist = Object Orientation [19 videos]
- ---^^^--- Pydantic Tutorials playlist [10 videos]
- ---^^^--- Playlists -- Python OOP Tutorials - Working with Classes
---^^^--- (DG) = Data Guru -- Python OOP Part -1 Concepts Explained | Class, Object & Inheritance Made Easy (Beginner to Advanced)
---^^^--- Turn on CC !!!
- ---^^^--- (DG) Python OOPS Part -2 | Polymorphism in Python Explained (context based)
- ---^^^--- (DG) Python OOP Part - 3 | Encapsulation in Python Explained
- ---^^^--- (DG) Part - 4 Abstraction in Python Explained
- ---^^^--- (DG)
---^^^---
---^^^---
---^^^---
(B1) = b001 -- Python Classes in 1 Minute!
---^^^--- Python Class Inheritance
---^^^---
---^^^---
---^^^---
---^^^---
---^^^--- Python Class Inheritance
---^^^---
---^^^---
---^^^---
---^^^---
(DSwB) = Data Science with Bappy [turn on CC to better understand with accent]
---^^^--- Master Python Object-Oriented Programming (OOP) in 5 Hours
---^^^--- Data Structures And Algorithms In Python [play list 13 videos ]
---^^^--- Don't Start Coding Without Doing This❌ | 5 Effective Tips to Learn Coding
---^^^---
---^^^---
---^^^---
---^^^--- Data Structures And Algorithms In Python [play list 13 videos ]
---^^^--- Don't Start Coding Without Doing This❌ | 5 Effective Tips to Learn Coding
---^^^---
---^^^---
---^^^---
(Sp) = Silent Psychology-- Smartest People Think in Analogies
---^^^--- You’re Not As Intelligent As You Think: 10 Signs
---^^^--- You’re Not As Intelligent As You Believe [Dunning-Krugger effect ?]
---^^^---
---^^^--- You’re Not As Intelligent As You Believe [Dunning-Krugger effect ?]
---^^^---




Comments
Post a Comment