From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Emanuel Berg Newsgroups: gmane.emacs.devel 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 Message-ID: <87r09ppcv9.fsf@dataswamp.org> References: <87wmjhpfql.fsf@dataswamp.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6848"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:0CrKhZW8/vPIajawD17zZe2izv8= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Sep 12 10:26:07 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sof9T-0001ar-L7 for ged-emacs-devel@m.gmane-mx.org; Thu, 12 Sep 2024 10:26:07 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sof95-0001rk-VN; Thu, 12 Sep 2024 04:25:44 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodxP-0001JZ-3D for emacs-devel@gnu.org; Thu, 12 Sep 2024 03:09:35 -0400 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sodxK-0004yT-Tn for emacs-devel@gnu.org; Thu, 12 Sep 2024 03:09:34 -0400 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1sodxG-00062t-NC for emacs-devel@gnu.org; Thu, 12 Sep 2024 09:09:26 +0200 X-Injected-Via-Gmane: http://gmane.org/ Mail-Followup-To: emacs-devel@gnu.org Mail-Copies-To: never Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -15 X-Spam_score: -1.6 X-Spam_bar: - X-Spam_report: (-1.6 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.25, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Thu, 12 Sep 2024 04:25:42 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:323556 Archived-At: > 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