[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
is OO a model that makes models? (was: Re: another day of cutting edge E
From: |
Emanuel Berg |
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 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
> 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