Message from discussion
nomenclature
Received: by 10.66.81.202 with SMTP id c10mr5776371pay.40.1349208339629;
Tue, 02 Oct 2012 13:05:39 -0700 (PDT)
Path: t10ni23606207pbh.0!nntp.google.com!npeer02.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!border3.nntp.dca.giganews.com!Xl.tags.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local2.nntp.dca.giganews.com!nntp.earthlink.com!news.earthlink.com.POSTED!not-for-mail
NNTP-Posting-Date: Tue, 02 Oct 2012 15:05:38 -0500
Date: Tue, 02 Oct 2012 13:05:41 -0700
From: Patricia Shanahan <p...@acm.org>
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:15.0) Gecko/20120907 Thunderbird/15.0.1
MIME-Version: 1.0
Newsgroups: comp.lang.java.programmer
Subject: Re: nomenclature
References: <70c1d214-71ac-478d-95d7-a5984c3dc180@googlegroups.com>
In-Reply-To: <70c1d214-71ac-478d-95d7-a5984c3dc180@googlegroups.com>
Message-ID: <uZadnYq4Mf-P1PbNnZ2dnUVZ_hadnZ2d@earthlink.com>
Lines: 22
X-Usenet-Provider: http://www.giganews.com
NNTP-Posting-Host: 70.230.206.229
X-Trace: sv3-WK6YVIi4iwFlujELZ0nrGHi7oEjYKCTln9Qe4nJxDtlsb2cC40As2YTZ/usMNoDpLJ8pFqb7+M2RMfs!LlPJy0mBQ9VOS5+sNWGOFTqJanq6Je2tZ1OejdHqxSWaZHRHvxa0+Z8G+C/Sjc6/qeoCxohcqp7N!vNlsJIVhskyLGrGezqFXJ/kuWC0gWUAdg+tjzHTSbJWavIE=
X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers
X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly
X-Postfilter: 1.3.40
Bytes: 1927
X-Original-Bytes: 1866
X-Received-Bytes: 2007
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
On 10/2/2012 12:51 PM, bob smith wrote:
> Is this sort of thing bad practice (using parameter names that are the same as my field names in the constructor)?
>
>
>
> public My_Rectangle(double x, double y, double width, double height) {
> this.x=x;
> this.y=y;
> this.width=width;
> this.height=height;
>
> }
>
Often, there is one right name for a property, like "width" for the
width of a rectangle. That is both the best possible identifier for a
private field representing the property, and the best possible
identifier for a constructor argument setting its value.
Why give one of them a different, necessarily inferior, identifier?
Patricia