2 – Why Use Object Oriented Programming

Yes, I would love to talk more about object oriented programming. Often I want to solve things with functions, I think I’m inclined to think that way. But I know there is value in thinking object orintendly. Why when designing a self-driving car, for example, why do we want to use object oriented programming? Object oriented programming has the advantage of being modular and testable, and that is important. But also with self-driving cars you can see the objects, they’re physical things. The more you can work with an object that’s really something you feel like you could touch, that helps define your code. And then it goes back to making good separation between one piece of code or another. Because if you have a wheel class which maybe not where we’re going here, but a wheel class, it turns, it has tread, it has all of these things. And you can have four of them, and they can be similar but not the same. And then you have a sensor class for seeing where the lanes are, which might include a camera, but that camera class might be used from other people. You can end up with a hugely complicated system, but if everything is self-contained and very object-y, very individual and encapsulated into its own separate thing, then as you change the wheels to different wheels or you go to a flying car, you can just swap that out.

%d 블로거가 이것을 좋아합니다: