Post 9g5lo9jMJ0IaL7XEX2 by karen@kawen.space
(DIR) More posts by karen@kawen.space
(DIR) Post #9g5lo9jMJ0IaL7XEX2 by karen@kawen.space
2019-02-22T11:49:58.458435Z
0 likes, 0 repeats
Aren't objects just like, structs with some associated functions
(DIR) Post #9g5lzi0TCzQ9pX30bo by tealturtle@social.coop
2019-02-22T11:51:52Z
2 likes, 0 repeats
@karen My definition is that an object is a struct which contains some functions that accept the object itself as an implicit or explicit first argument called "this". Implicit e.g. Java, explicit e.g. Python.
(DIR) Post #9g5m040vNyrA5JQgN6 by kaniini@pleroma.site
2019-02-22T11:52:06.874977Z
1 likes, 0 repeats
@karen that's such a C++ way of thinking, now isn't it?
(DIR) Post #9g5m07JT7UTMJh82C0 by thorthenorseman@octodon.social
2019-02-22T11:52:03Z
1 likes, 0 repeats
@karen Yes, and inheritance, but don't tell anyone.
(DIR) Post #9g5m71JxnRB7lAeTNw by FloatingGhost@ihatebeinga.live
2019-02-22T11:53:23.652335Z
1 likes, 0 repeats
@karen pretty muchExcept they typically feature heavy use of side effects and can have inheritance from parent classes which can make them rather more complex in practice than the incredibly clean structs in elixir never ever look at enterprise java unless you want to see the gate of hell itself
(DIR) Post #9g5mEuMhXevKVGh42i by thatbrickster@shitposter.club
2019-02-22T11:53:51.565725Z
1 likes, 0 repeats
@karen Glorified structs.It makes it easier to write more convoluted code but some swear by it.
(DIR) Post #9g5mn3kf9KyVSdBanw by thorthenorseman@octodon.social
2019-02-22T12:00:30Z
1 likes, 0 repeats
@karen OOP is a tad overrated. You can write quite complex programs without inheritance. Assigning methods to types has benefits in terms of convenience, readability and structure, but my feeling is that inheritance, the main trait of OOP, isn't actually that important. If you're using a statically typed language, shared interfaces between types are probably better, since they don't force you to think about hierarchies.
(DIR) Post #9g5mxVFtkJOdermAoi by karen@kawen.space
2019-02-22T12:02:53.237813Z
0 likes, 0 repeats
@thorthenorseman sounds like it's a just a good way of making things more complicated
(DIR) Post #9g5n1ftA9a6TnM8Aq0 by calv@tanavega.xyz
2019-02-22T12:03:37.566397Z
0 likes, 0 repeats
@karen are functions on objects just function pointers in c?
(DIR) Post #9g5n3qzXqOQIoF9g1o by karen@kawen.space
2019-02-22T12:04:02.150612Z
0 likes, 0 repeats
@calv what's a function pointer
(DIR) Post #9g5n7ZHDeLDt1fC2Vc by calv@tanavega.xyz
2019-02-22T12:04:42.607175Z
0 likes, 0 repeats
@karen magicor this link explains better than i can https://www.geeksforgeeks.org/function-pointer-in-c/
(DIR) Post #9g5nf65Ogc4WL2eSDg by thorthenorseman@octodon.social
2019-02-22T12:10:15Z
1 likes, 0 repeats
@karen OOP was conceived by a Norwegian computer scientist who needed a language for simulation. He devised Simula, with OOP objects as stand-ins for physical objects. If you're, say, programming a physics engine for a video game, a hierarchy of objects makes a lot of sense, since many physical objects have shared behaviours.
(DIR) Post #9g5nveqhCrXOmqfiO8 by thorthenorseman@octodon.social
2019-02-22T12:13:20Z
1 likes, 0 repeats
@karen It makes less sense in contexts where behaviours and traits are rarely shared between types in a top-down fashion. Most business logic is just a collection of unique data structures and behaviours with little in common. In such code, you often end up with a Russian doll pattern: Many relatively hollow classes inheriting from each other, and as a programmer, you're always hunting around to find the bit that does the thing you need to change.