3 ms·
Would it be far fetched to say object oriented programming is inspired by nature/physics? And thus, "more natural" than, let's say, procedural programming. An
by Gehinnn 3y ago
Would it be far fetched to say object oriented programming is inspired by nature/physics?
And thus, "more natural" than, let's say, procedural programming.
Animals can be modeled nicely with objects/classes.
Physical objects do have internal private state and public interfaces. Also in nature, usually, you have multiple similar objects that work the same but have different internal state.
- bruce343434 3y agoThat might have been what Alan Kay was going for with his "cells of an organism" thing, yes. But even if you're not inspired by biology, it might just come up "naturally". Separating your data into structs, then operations on those structs, and not wanting to deal with all kinds of bookkeeping all the time, letting things manage their own - separation of concerns, aka single responsibility principle. I think automatic memory management might be a big example of this. Who wants to bother with this malloc/free stuff all the time? Who wants to keep track of ownership everywhere? Instead, have a dedicated subsystem handle it. That allows a higher signal to noise ratio in all the rest of the code that would otherwise be polluted with malloc/free. It also removes the entire class of bugs that can happen when you inevitably forget either of those. But having memory management in and of itself isn't "OOP". It's just an example of one of the principles that people tout when they talk of "OOP". Those principles can and do apply broadly. Was Alan Kay thinking of all this? I really don't know. All I know is that the dude digs biology.
- meheleventyone 3y agoI think more that messaging was the fundamental part. Modularization and composition is pretty common in most paradigms. I actually looked this up the other day for a different comment but this is Alan Kay's own words on the subject: https://lists.squeakfoundation.org/pipermail/squeak-dev/1998-October/017019.html https://lists.squeakfoundation.org/pipermail/squeak-dev/1998... It's a concept I really like and use quite a bit in game development at the inter/intra-entity communication level even if below that I'd pick a more performant substrate.
- kragen 3y agothis is an excellent essay; thank you for finding the link
- igouy 3y ago"Object-Oriented Software Systems" Byte Magazine 1981 https://archive.org/details/byte-magazine-1981-08/page/n75/mode/1up https://archive.org/details/byte-magazine-1981-08/page/n75/m... "Design Principles Behind Smalltalk" Byte Magazine 1981 https://archive.org/details/byte-magazine-1981-08/page/n299/mode/1up https://archive.org/details/byte-magazine-1981-08/page/n299/...