unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Emanuel Berg <incal@dataswamp.org>
To: emacs-devel@gnu.org
Subject: is OO a model that makes models? (was: Re: another day of cutting edge Elisp (read from a file to a string))
Date: Thu, 12 Sep 2024 09:09:14 +0200	[thread overview]
Message-ID: <87r09ppcv9.fsf@dataswamp.org> (raw)
In-Reply-To: 87wmjhpfql.fsf@dataswamp.org

> OO [...]

One last thing that is important in the old-school vs modern
OO discussion, that is in old-school OO one focused more on
"solving the problem by making a model of it" - that is hard
to argue with, as that is exactly what one is doing - both in
general, applying the OO model - but also in practice, solving
the particular problem at hand by setting up neat little
objects with cute traits.

However ...

The problem was the people got a little bit locked, and not
the least neurotic, about this, they thought they were
creating a copy of reality and if everything was copied to
perfection, the problem would solve itself automatically.

People spent a lot of time arguing where to put things for
example, and the argument was always refering to reality or
whatever model one was building, and _not_ where the element
would be useful to solve its task, and, by extension, the task
of the entire program.

So to counter this one started to focus on the model not being
a model in terms of similarity, necessarily, rahter the model
is a _tool_, can it be applied, and does it work? If so, put
things wherever you want, and wherever they are available and
ready to do their job.

I must say this makes more sense, and I recommend using, if
one uses eieio, `cl-defmethod' for _everything_ that has an
object, class or whatever mentioned if only one time - only
use `defun' when there is no explicit or implicit association
to any OO induced element.

Method. Write a `cl-defmethod'. If the object instance isnt'
used, replace the name with a dash. Leave it be for some time
(often you start using it during this period, I mean with an
instance so, you revert from the dash). But if that doesn't
happen, and it still just stands there with its gaping dash,
okay, turn it into a defun since it obviously was a mistake to
assume it had anything to do with this class or any object
instances thereof.

In practice, trust me when I say, very, very few defuns are
needed, and NO `defvar' (i.e. global or dynamic/special
variables) - not a single one - is needed even big project
with many files.

OO for Emacs, it is a small miracle I was unaware of existed
in this form. Like the OO of C++ only ... more cute, is the
best word to describe it. Much more cute <3

-- 
underground experts united
https://dataswamp.org/~incal




  reply	other threads:[~2024-09-12  7:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-12  6:07 another day of cutting edge Elisp (read from a file to a string) Emanuel Berg
2024-09-12  7:09 ` Emanuel Berg [this message]
2024-09-15  2:33 ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r09ppcv9.fsf@dataswamp.org \
    --to=incal@dataswamp.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).