r/learnprogramming • u/DatabaseMother5141 • 20d ago
Suggestions regarding programming
I'm 18. I'm currently learning Java and I feel I'm unable to understand stuff in it, especially object oriented programming. The practice feels like I'm falling behind.
18
Upvotes
View all comments
1
u/Traditional_Vast9419 20d ago
A Class is hard to understand before learning structs in C. Basically, before OOP, everyone used composition to design their applications with C structs. Using each struct as the first argument of their relevant functions became such a common design choice that Java just combined structs, and their relevant functions, into classes with methods. This connection allows for inheritance (as opposed to composition): another class to inherit the encapsulated methods of any other class to make large substructures with less code.
Basically, it's really complicated, especially if you don't know C. Hopefully my explanation was a little helpful, but don't sweat if it made no sense. Just keep at it and it will eventually click. I'm, personally, not a fan of OOP because composition is, overall, far simpler, and substructures can be envoked by an enum and switch statement. It's still a cool skill.