Deutsch English Français Italiano |
<d74b69877bccec879c19e6099bc6e29b9a711cd2.camel@gmail.com> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: wij <wyniijj5@gmail.com> Newsgroups: comp.lang.c++ Subject: Re: What is OOP? Date: Tue, 03 Dec 2024 20:43:22 +0800 Organization: A noiseless patient Spider Lines: 94 Message-ID: <d74b69877bccec879c19e6099bc6e29b9a711cd2.camel@gmail.com> References: <d8a5a0d563f0b9b78b34711d12d4975a7941f53a.camel@gmail.com> <vijc0r$33fek$2@dont-email.me> <35400604257703c65dff9e04e001868077a86801.camel@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Date: Tue, 03 Dec 2024 13:43:24 +0100 (CET) Injection-Info: dont-email.me; posting-host="a914f74ad38b4c98d46f4408245671b3"; logging-data="84144"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/ns+mHdq5gSfzYvbfp1YLm" User-Agent: Evolution 3.50.2 (3.50.2-1.fc39) Cancel-Lock: sha1:D3EOLAHu6ToHU1Gsv020yqzR++Y= In-Reply-To: <35400604257703c65dff9e04e001868077a86801.camel@gmail.com> Bytes: 4622 On Mon, 2024-12-02 at 16:27 +0800, wij wrote: > On Sun, 2024-12-01 at 20:11 -0800, Chris M. Thomasson wrote: > > On 12/1/2024 9:17 AM, wij wrote: > > > There are several understandings: > > > https://www.quora.com/As-an-experienced-OOP-programmer-in-your-opinio= n-whats-the-biggest-problem-of-OOP-object-oriented-programming > > >=20 > > > ... > > > OO can have many meaning. I took OO to mean object, the basic entity = of the > > > programming model and the operation of the object. The concept, as fo= undmental, > > > has to be solid, practical and easily usable. Otherwise, more codes a= nd efforts > > > will be needed latter to fix it, making the original goal ,practicall= y, a lie. > > > IOW, (nearly) a flawless model is all the basics. ... > > > https://sourceforge.net/projects/cscall/files/MisFiles/ClassGuideline= s.txt/download > > [...] > >=20 > > struct object > > { > > =C2=A0=C2=A0=C2=A0=C2=A0 // [...] > >=20 > > =C2=A0=C2=A0=C2=A0=C2=A0 void do_it(); > > =C2=A0=C2=A0=C2=A0=C2=A0 void wink(); > > =C2=A0=C2=A0=C2=A0=C2=A0 void laugh(); > > =C2=A0=C2=A0=C2=A0=C2=A0 void pose(); > > }; > >=20 > >=20 > > ? OOP right there in a sense? >=20 > NOPE. >=20 > Snippet from the classguidelines of libwy: > ... > =C2=A0Const member functions: > =C2=A0=C2=A0 A set of const function members, often referred to as proper= ty or attribute > =C2=A0=C2=A0 members, defines whether or not two objects function 'identi= cally'. In > =C2=A0=C2=A0 general, a minimum set of such members must exist. These mem= bers are often > =C2=A0=C2=A0 in complexity O(1), and provide the basic proofs that the cl= ass is properly > =C2=A0=C2=A0 designed. > ... >=20 > If there is no attribute members (const function member), how do we know = whether > the class is properly designed or not? So, bascially, as long as default = ctor > exists, there is a member 'bool is_default() const' to confirm it. The 2n= d > question is how do we know whether the copy constructor does its job? The= n, > there is a series of setters and getters... basically, verifiable by each= other. > If you can make the function of these sets of members concise, efficient = and > consistent, the concept of the class in your brain is probably right, oth= erwise > not right. This is the key point of libwy's OOP. >=20 > With your example (lacks ctors, but important), what is 'do_it()' and > others? You need some attribute members (getters) to confirm what those > non-const members do are exactly what they claim doing. So you also need = other > attributes e.g. is_wink(), is_laugh() and is_pose(). Then, what the copy = ctor > should do is clear. Then, assignment operator...,etc. > Whenever you have an idea, concept, try make it a 'complete' class (somet= imes=C2=A0 > the idea does not fit as a class). Follow the basic rule, then, class des= ign, > the program, will be lots easier and fun. Snippet from the classguidelines of libwy: .... Not all encapsulated is OOP. OOP with class is about the complete set of concise and efficient class fun= ctionmembers. The point is about correctness, not only of the codes but more importantly, of the concept and idea of the class. The idea is not right, hardly can the class be. If this complete set of class function members is = not doable for no good reasons, such an idea of the class should be abandoned. = OOP in class is not form only, but also semantics... Not all encapsulated is OOP.