Discussion
Loading...

Post

Log in
  • About
  • Code of conduct
  • Privacy
  • About Bonfire
thezerobit
thezerobit
@thezerobit@anticapitalist.party  ·  activity timestamp 24 hours ago

Object oriented programming is not what some people think. There are the old books and code examples that talk about modelling "real world objects". In practice, this isn't a strong OO pattern and doesn't lead to well constructed programs. OO is best a code organization tool. I'm reading an old OOP book that *says* you should model real world objects, but the first example is "locks" where you create a protocol for interacting with locks, and you can implement different types of locks.

1/n

  • Copy link
  • Flag this post
  • Block
thezerobit
thezerobit
@thezerobit@anticapitalist.party  ·  activity timestamp 24 hours ago

The irony is that the term "lock" is just a metaphor that produces a useful name. But, a lock in code does not model a real world lock. A lock is designed to restrict access to a resource to one process thread at a time. This is not modeling real world objects. This is organizing code by having a fixed interface and multiple different implementations. It's a code organization tool that allows code to be decoupled, not a tool for modeling real world objects. n/n

#OOP #OO

  • Copy link
  • Flag this comment
  • Block

BT Free Social

BT Free is a non-profit organization founded by @ozoned@btfree.social . It's goal is for digital privacy rights, advocacy and consulting. This goal will be attained by hosting open platforms to allow others to seamlessly join the Fediverse on moderated instances or by helping others join the Fediverse.

BT Free Social: About · Code of conduct · Privacy ·
Bonfire social · 1.0.2-alpha.34 no JS en
Automatic federation enabled
Log in
Instance logo
  • Explore
  • About
  • Code of Conduct