Amethyst Lemmy
  • Communities
  • Create Post
  • Create Community
  • heart
    Support Lemmy
  • search
    Search
  • Login
  • Sign Up
codeinabox@programming.dev to Programming@programming.devEnglish · 3 days ago

What Are The “Objects” in “Object-Oriented Programming”?

codemanship.wordpress.com

external-link
message-square
5
link
fedilink
4
external-link

What Are The “Objects” in “Object-Oriented Programming”?

codemanship.wordpress.com

codeinabox@programming.dev to Programming@programming.devEnglish · 3 days ago
message-square
5
link
fedilink
We’re back to this old chestnut. In one of the exercises on my Code Craft course called “The CD Warehouse”, one of the use cases is that customers can buy a CD from the warehouse.…
alert-triangle
You must log in or # to comment.
  • Cyberflunk@lemmy.world
    link
    fedilink
    arrow-up
    1
    arrow-down
    1
    ·
    15 hours ago

    bugs

  • MonkderVierte@lemmy.zip
    link
    fedilink
    arrow-up
    4
    ·
    2 days ago

    A fancy array.

  • HaraldvonBlauzahn@feddit.org
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    2 days ago

    It is a surprisingly fuzzy concept.

    Historically, OOP languages like C++ and Java have evolved from Simula. Simula was designed and used to simulate ships. From this comes the notion that OOP objects should be physical “things”. But this has not aged well.

    Simula also had the idea to build definitions by hierarchical implementation inheritance. C++ adopted that, too, and apart from usage in GUI frameworks, this has not aged well, either.

    Then there was Smalltalk, which has an entirely different concept from C++, focusing on messaging. Here, methods are messages.

    The best modern explanation I’ve read is from Sandy Metz in “Practical Object Oriented Design in Ruby”.

    https://hellread.com/2025/07/03/practical-object-oriented-design-in-ruby-by-sandi-metz/

    https://sandimetz.com/products

    What she explains is that one should group code and data so that this limits the scope of change when evolving the program.

    Then, there is the much older idea that the programmer defines data types and operations on them which guarantee invariants. It is a very powerful concept, and was already described by Edsgar Dijkstra in 1970:

    https://www.cs.utexas.edu/~EWD/transcriptions/EWD02xx/EWD249/EWD249.html

    https://seriouscomputerist.atariverse.com/media/pdf/book/Structured Programming.pdf

    https://www.informatik.uni-bremen.de/agbkb/lehre/programmiersprachen/artikel/EWD-notes-structured.pdf

    C++ uses this concept, too, in its container classes, but in a bastardized form: Invariants are suggested but rarely spelled out. You can for example iterate over elements of a container class / collection, but whether the iteraror remains valid with certain operations or not, and triggers Undefined Behavior, you are not told explictely. In contrast, for Dijkstra it was essential that operations and invariants were well-defined and written out.

  • Lucy :3@feddit.org
    link
    fedilink
    arrow-up
    11
    ·
    3 days ago

    A blob of memory, and associated pointers to functions. And a lot of assembly magic to make it work.

    • anton@lemmy.blahaj.zone
      link
      fedilink
      arrow-up
      2
      ·
      2 days ago

      Why assembly?
      Does C not allow putting the v-table in static memory/text or where is the hangup?

Programming@programming.dev

programming@programming.dev

Subscribe from Remote Instance

Create a post
You are not logged in. However you can subscribe from another Fediverse account, for example Lemmy or Mastodon. To do this, paste the following into the search field of your instance: !programming@programming.dev

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person’s post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you’re posting long videos try to add in some form of tldr for those who don’t want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



Visibility: Public
globe

This community can be federated to other instances and be posted/commented in by their users.

  • 173 users / day
  • 1.26K users / week
  • 2.36K users / month
  • 8.04K users / 6 months
  • 1 local subscriber
  • 23.1K subscribers
  • 756 Posts
  • 8.29K Comments
  • Modlog
  • mods:
  • snowe@programming.dev
  • Ategon@programming.dev
  • MaungaHikoi@lemmy.nz
  • UlrikHD@programming.dev
  • BE: 0.19.12
  • Modlog
  • Instances
  • Docs
  • Code
  • join-lemmy.org