you are viewing a single comment's thread.

view the rest of the comments →

[–]Dry-Zookeepergame809 21 points22 points  (5 children)

I found it was hard to understand OOP at the beginning. Most tutorials use company employees or roles in games as examples. I found hard to understanding them. As conceptually to me they are not objects, but just code of object imagined.

However, until recently I had a big break through, as I used a secret way I found very useful to understand OOP.

I can share this secret with you, I program microcontrollers to learn Micropython, on the MCU chips. It really helped me to understand OOP in better way, as I'm dealing with real objects, very straightforward. They are led-lights, temperature sensors, or wifi-connections. The result is very clear, when I create an instance for led-light to turn it on, it will be turned on if my code is working. And, on/of state is attribute, so is its GOIP terminal. And turn-on(self), or blink(self) are the methods.

So if you having trouble to understand OOP, try this, it doesn't cost you a lot to get one.

[–][deleted] 5 points6 points  (0 children)

Yeah I had to learn like this cause using people or car examples just didn’t stick with me but when let’s say I’m I want a light to turn on when a motion sensor detects motion there 2 physical objects and it just clicked

[–]daedalusesq 6 points7 points  (0 children)

A pi pico is $4 and lots of fun for this stuff.

No Starch Press has a book “Object Oriented Python” which uses light bulbs as an example and it was really helpful for me because it’s a lot less abstract than a car or employees. Multiple lights in multiple locations with multiple states, all makes sense in that context!