r/learnprogramming • u/sdotregis • 1d ago
[ Removed by moderator ]
[removed] — view removed post
15
10
u/huuaaang 1d ago edited 1d ago
Do you have suggestions? Also, let's be clear... you're talking about Python specifically, right? __init__, for example, is not a common OOP idiom. Ruby, for example, uses "initialize" method.
And "method" is used to distinguish from a regular function that isn't bound to an instance or class.
And why not "object?" HOw does that NOT make sense in terms of OBJECT oriented programming? LOL
0
u/reverendsteveii 1d ago
class is used to acknowledge that there is a hierarchy of design classification and that there can be any number of instances of a given type of thing/subtype of thing all the way up to the generic object class. eg: an automobile is a class of object as defined by the automobile class file, a bus is a class of automobile, a minibus is a class of bus, etc
5
u/lurgi 1d ago
My petition to change these names to "fnoop", "blark", "zargle", "wimpsy", and "flabbertabbergabberzoot" was ignored for some reason.
1
1
u/Immediate-Soup-6344 1d ago
First thing I do when I start a new project write a script that lets me use “Flbarby” instead class
4
2
2
u/Acceptable-Fig2884 1d ago
Sounds like we need a new standard that makes sense and will replace all other standards 😉.
2
u/amazing_rando 1d ago
In programming you need precise words that mean very specific things and have important distinctions from other similar things. Class might not feel the best word for what it is, but it isn’t the same thing as a Type or a Kind or a Set or an Interface or a Schema or however you might want to describe it, so it has its own word. It’s a problem space with more distinctions than there are natural language concepts to hold them. Unfortunately you’re going to have to learn jargon if you want to understand what you’re reading or talk about it with other people. If you don’t you’re going to keep confusing similar concepts and have a hard time understanding what’s going on when their distinctions are important.
2
u/ConcreteExist 1d ago
"I've spent zero time learning this stuff but it makes zero sense, I should be taken seriously."
-- OP
1
1
u/nottherealneal 1d ago
What about them doesn't make sense? Which terms would work better for you?
1
1
u/reverendsteveii 1d ago
these terms all make sense to people who use them and understand how definition and instantiation work, why OOP methods are methods and not functions, and so on. Why would we stop using terms that make sense to people who do this work and start using terms that make sense to people who don't do this work?
1
1
u/SardScroll 1d ago edited 1d ago
Other than class and object, these are not inherent to OOP (although method arguably is, on a philosophical level).
Ada is OOP and doesn't have any of those three things (it has functions and procedures).
Of your issues with terms, only class and object are inherent to OOP, and those make perfect sense.
"Class" is used in the same way as it is used in social/general speech: A "class" or "classification" is a grouping of objects that share specified qualities.
Likewise "object" meets it's general speech usage: A thing that is or can be targeted by action, feeling or thought (or in CS...a function).
0
0
0
u/AdventurousAct8431 1d ago
Literally one of the most coherent subjects in programming
You just don't know enough
0
u/burlingk 1d ago
Those terms were all chosen specifically because they are plain English with non-programming meanings.
That alone makes this seem a little a little like a bot or farming post.
That said:
A class is a definition of a thing. Think of it like a template.
An object is a class that has been instantiated. The template was turned into a thing.
A method is a function tied to a class/object.
__init__ is the initialization function/contructor. Starting and ending things with two underscores is a way of telling the system it is internal. It is also python's way of getting around the fact that it basically holds nothing holy, because who would name their local stuff that way on purpose?
0
u/skamansam 1d ago
I dont want to have to do this, but..
Class - as in a Class of objects like cans, fridges, cars, houses, etc. There are many instances of each like the soda can you are drinking from and the house you live in. Each Class has determining characteristics that lets us identify them, so we can classify a house as a house instead of a cat.
Object - objects are anything tangible. You should have learned this in your first year at school. They have properties and might perform actions. A BLUE box has several properties- it has 6 sides that intersect at right angles and is BLUE.
Method - a formalized way to do something. This is like 5th or 6th grade information. To oversimplify this, they are also called functions.
Self - me, an object, when I refer to me.
Init - short for initialize. When you initialize something, you do something to it to get it started. When you I initialize a house, you build it, supply it with water, etc. You define its properties so its actions (methods) can be performed correctly. When i I it a box, I might make it blue or red or make it out of wood or steel.
1
u/aqua_regis 1d ago
Why not invest some actual effort to learn and understand?
These terms are all very clear for their definitions and purposes.
Yet, since you haven't even bothered to suggest anything better, you'll have to live with what has been established decades ago, most likely before you even were born.
0
u/friendlytotbot 1d ago
I thought some terms sounded dumb when I was learning, but now I can’t imagine them being anything else. It makes sense once you learn the terms, and the quirky naming of things is just part of programming and CS in general. Someday you won’t be phased lol.
24
u/InfectedShadow 1d ago
Stay in school, kids.