this post was submitted on 19 Sep 2024
90 points (98.9% liked)
Programming
17364 readers
181 users here now
Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!
Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.
Hope you enjoy the instance!
Rules
Rules
- Follow the programming.dev instance rules
- Keep content related to programming in some way
- If you're posting long videos try to add in some form of tldr for those who don't want to watch videos
Wormhole
Follow the wormhole through a path of communities !webdev@programming.dev
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
95% of all "Introduction to " books tend to dedicate the first couple of chapters to the fundamentals but with a specific bias towards the language in question. Seek out a few of those at a library or online equivalent and you'll start to see patterns cropping up.
Anything that doesn't have that bias is likely to use pseudocode which looks like a programming language anyway.
Object orientation works around the concept that things in the program "know" things about themselves and how to do things for themselves rather than have some other part of the program do things to them. Commonly you'll see things like
doSomethingWith(someObject)
being the non-OO way andsomeObject.doSomething
being the OO way. That is, in the lattersomeObject
contains the knowledge of how todoSomething
, and the dot notation urges it to do whatever it is.For a silly but more concrete example,
x ← 2 + 2
is non-OO, butx ← 2.add(2)
is at least partially OO because the first 2 is expected to know how to add another 2 to itself and give out the correct answer. Presumably in whatever language that is, someone has created a method for numbers to know what to do when told toadd
. The other 2 doesn't really get a say in things. We might also have, say,elephant.putOn(hat)
, but it might not be possible tohat.putOn(elephant)
because no-one thought to teach the hat how to wear things, let alone elephants.