Re: Re: Why is 'else' demanded?
zhanghongliang <[email protected]> Thu, 13 Jun 2013 11:34:13 +0800
| Newsgroups | gmane.comp.programming.refactoring |
|---|---|
| Message-ID | <[email protected]> |
Maybe what I want to say is I don't want to write else statements, e.g.=0D
=0D
mapHandler=0D
.bind('shareInfo', function (ev, newVal) {=0D
this.encapsulateShareInfo();=0D
this.addLoadMap(newVal);=0D
this.handleMarkers();=0D
this.setInfoWindowAndCenter(newVal);=0D
})=0D
...=0D
=0D
the code before refactor is:=0D
=0D
mapHandler=0D
.bind('shareInfo', function (ev, newVal) {=0D
if ($.isEmptyObject(newVal)) {=0D
followDev.attr('isPollGps', true);=0D
return;=0D
}=0D
=0D
if (this.ini) {=0D
this.iniMapPage();=0D
followDev.attr('isPollGps', true);=0D
this.ini =3D false=0D
}=0D
if (this.curInfo =3D=3D this.shareInfo) {=0D
return;=0D
}=0D
this.handleMarkers();=0D
this.setInfoWindowAndCenter(newVal);=0D
})=0D
=0D
the earlier code included several else statements and the complicated logic=
.=0D
=0D
=0D
=0D
=0D
Best regards,=0D
ZhangHong-liang=0D
=0D
=0D
=0D
=E5=BC=A0=E7=BA=A2=E4=BA=AE =0D
=0D
M:18640223030=0D
DL: 010=EF=BC=8D82870058=0D
=E4=B8=8A=E6=B5=B7=E9=9B=B7=E8=85=BE=E8=BD=AF=E4=BB=B6=E6=9C=89=E9=99=90=E5=
=85=AC=E5=8F=B8 (ShangHai Raxtone Limited Company)=0D
=E5=8C=97=E4=BA=AC=E5=B8=82=E6=B5=B7=E6=B7=80=E5=8C=BA=E4=B8=AD=E5=85=B3=E6=
=9D=91=E5=BD=A9=E5=92=8C=E5=9D=8A=E8=B7=AF11=E5=8F=B7=E5=8D=8E=E4=B8=80=E6=
=8E=A7=E8=82=A1=E5=A4=A7=E5=8E=A6201=E5=AE=A4 (Room 201, Buliding HuaYi con=
trol, No.11, CaiHeFang Road, Beijing , China)=0D
Fax:82870098=0D
=0D
=0D
From: Colby Callahan=0D
Date: 2013-06-10 22:15=0D
To: refactoring=0D
Subject: Re: [refactoring] Why is 'else' demanded?=0D
=0D
The else never gets executed or looked at in the case the if statement is=
=0D
true, so what exactly is the problem with it and what do you replace it=0D
with?=0D
=0D
On Sun, Jun 9, 2013 at 12:02 PM, =E5=BC=A0=E7=BA=A2=E4=BA=AE <zhanghonglian=
[email protected]> wrote:=0D
=0D
> **=0D
>=0D
>=0D
> I have a problem. Why is there always else key word in a language? Since =
I=0D
> can use return to stop the process of a flow. I hate to see else statemen=
t=0D
> and I see I can never use else statement that only increase the complexit=
y=0D
> of program.=0D
>=0D
> A if statement stands for a condition that should be unique, and it shoul=
d=0D
> has no relation with anything else. So a language does not need else and =
it=0D
> should not appear in a program.=0D
>=0D
> Sent from my iPad=0D
> =0D
>=0D
=0D
-- =0D
Please let me know if there is anything else I can do to assist you,=0D
Colby Callahan=0D
Web Developer=0D
Recognition Specialties=0D
NiceBadge.com=0D
541.476.3166=0D
=0D
[Non-text portions of this message have been removed]=0D
=0D
=0D
[Non-text portions of this message have been removed]
------------------------------------
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/refactoring/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/refactoring/join
(Yahoo! ID required)
<*> To change settings via email:
[email protected]=20
[email protected]
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/