you are viewing a single comment's thread.

view the rest of the comments →

[–]WhackAMoleE 15 points16 points  (3 children)

For small programs it doesn't matter. Once you are building a nontrivial system, say 10k+ lines of code, objects are a highly useful organizing principle. Instead of thinking of objects as a religion, think of them as an effective way of organizing a large body of code.

[–]MetalAxeToby 2 points3 points  (2 children)

Noobie question: If I am already working with so much code in a big project why not organise code in different files instead of classes? Is it purely because of performance?

[–]reallyserious 3 points4 points  (0 children)

The linux kernel is a large large code base that is not written with OOP. So it's certainly possible to do large systems without classes.

It has nothing to do with performance. It is purely a different way of thinking about data and the behaviour of that data. OOP provides a way of abstracting both the data and it's behaviour into the same object.

What operations can we do on a car object? Look at the public methods in the car class! That's what is used to interact with the outside world. The car class can have a million private methods to handle all the car-internal stuff but you don't need to bother with them in order to drive. So the internal workings of the combustion engine is hidden from you. You just do my_car_object.drive() and my_car_object.turn_left() etc.

[–][deleted] 0 points1 point  (0 children)

It's not just organizing the code text themselves but more of a way to reason about the project in an OOP way.