From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,36a29c2860aff686 X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!postnews.google.com!p38g2000vbn.googlegroups.com!not-for-mail From: Shark8 Newsgroups: comp.lang.ada Subject: Re: (placepo) Properties Date: Mon, 6 Dec 2010 15:24:27 -0800 (PST) Organization: http://groups.google.com Message-ID: <7dccc130-1958-4d67-8b98-643a413c1c22@p38g2000vbn.googlegroups.com> References: <3b84c8e7-1a51-4a7c-9646-119f1fc51478@s4g2000yql.googlegroups.com> <4cf24d13$0$6985$9b4e6d93@newsspool4.arcor-online.net> <4cf6d91e$0$6980$9b4e6d93@newsspool4.arcor-online.net> NNTP-Posting-Host: 174.28.191.40 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1291677867 30255 127.0.0.1 (6 Dec 2010 23:24:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Mon, 6 Dec 2010 23:24:27 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: p38g2000vbn.googlegroups.com; posting-host=174.28.191.40; posting-account=lJ3JNwoAAAAQfH3VV9vttJLkThaxtTfC User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; .NET4.0E),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15826 Date: 2010-12-06T15:24:27-08:00 List-Id: On Dec 5, 9:15=A0am, "Martin Krischik" wrote: > Am 02.12.2010, 00:24 Uhr, schrieb Georg Bauhaus =A0 > : > > > I don't see how "automatic" get/set subprograms offer > > software engineering advantage, even when they are terse > > and semi-implicit and purport to avoid repetitive clutter. > > Actually they don't. Not if you can't replace the automated get/set with = a =A0 > user defined function. Especially for set this is important as set should= =A0 > check the value and notify observers of the change. I see far to many =A0 > mutators which neglect this. And get should protect the value from outsid= e =A0 > changes by by either returning the value as constant or by coping the =A0 > value. But especially in Java I often wonder why accessors and mutators = =A0 > are used at all. > > For example in Scala where accessors and mutators are automaticly =A0 > generated (without get and set prefix as Scala is functional [1]) this ha= s =A0 > come back to haunt the language as it becomes very complicated to create = =A0 > rich accessors and mutators. > > Ok, one thing is left: properties can be overridden. For example a =A0 > abstract property can be defined in an interface. > > Martin > > [1] Which makes me wonder: The set and get prefix are not needed in Ada o= r =A0 > Java - so why not do without them? > -- > Martin Krischik > mailto://krisc...@users.sourceforge.nethttps://sourceforge.net/users/kris= chik I agree that setters SHOULD ensure that the values they change [to] are valid; that was the main purpose of them!