Re: Multiple returns vs. Single exit
Attila Szegedi <[email protected]> Sun, 30 Dec 2007 23:40:29 +0100
| Newsgroups | gmane.comp.windows.devel.java.advanced |
|---|---|
| Message-ID | <[email protected]> |
On 2007.12.30., at 23:05, Rob Griffin wrote: > Oh, and as far as return goes, in Eclipse you can give the return > keyword a different colour and attribute to all other keywords to > make it stand out. I have return underlined and in a deeper colour > that the other keywords. You can glance at any method and > immediately see where it returns. Ooh... Can't you format it to blink? ;-) Seriously, that's a very good idea (not the blinking, but your original, mind you) -- it's just putting the technology advances available in modern times to good use :-). I too have different colors for local variables and object members (among other things), so it is very easy to keep in mind which one are you dealing with where. And if you'd ever bungle it and do, say, a self-assignment in a property setter (the usual mistake I used to do in old days), any decent IDE and compiler will report a warning anyway. Not to speak of FindBugs. Attila. > > > -----Original Message----- > From: Discussion of advanced Java topics. [mailto:[email protected] > ] On Behalf Of Rob Griffin > Sent: Monday, 31 December 2007 8:59 AM > To: [email protected] > Subject: Re: [ADVANCED-JAVA] Multiple returns vs. Single exit > > I use the syntax colouring feature of Eclipse to differentiate class > member variables, method parameters and static fields and methods. I > also have members underlined and method parameters italisized. My > screen is very colourful but I find it extremely helpful. When I > look at code on another programmer's computer I feel that I'm really > missing vital information. > > Rob Griffin. > > -----Original Message----- > From: Discussion of advanced Java topics. [mailto:[email protected] > ] On Behalf Of Frank Harper > Sent: Saturday, 29 December 2007 8:55 AM > To: [email protected] > Subject: Re: [ADVANCED-JAVA] Multiple returns vs. Single exit > > I actually like and use the convention of adding the "m_" prefix for > members, I think it makes reading unfamiliar code much easier. > > Frank Harper > > On Dec 28, 2007 10:49 PM, Attila Szegedi <[email protected]> wrote: > >> On 2007.12.28., at 21:47, Mark Gorokhov wrote: >> >>> Dmitry Beransky wrote: >>>> Does it have to be an "either-or" decision? Whichever approach >>>> makes >>>> the code more readable in a given situation is the one you should >>>> use. >>> >>> There is no "either-or" in our coding standards. We must use a >>> single >>> return, no Hungarian notation (but "m_" is mandated), and so on. >> >> Heh - that's already partly Hungarian notation then. Charles probably >> doesn't read this list, so I don't think I'm running the risk of >> scorn >> next time I bump into him, but Hungarian notation is totally >> meaningless for a reasonably strongly typed language such as Java. It >> was sort-of okay for C where you could accidentally cast, say, a >> lpszFoo to iBar (but even there, a decent compiler would've warned >> you). >> >>> >>> >>> We are reworking old code to meet our new coding standards. >> >> Ask your manager to provide you with a cost/benefit analysis they >> performed before deciding on this grandious waste of time. If it >> doesn't exist, or doesn't convince you (I doubt it will), you can >> choose between: >> - trying to bring them to common sense >> - silent desperation >> - looking around for a new job. >> >> I'm honestly sad to read such stories in 2007 (nearly 2008). >> >> Attila. >> >>> >>> >>> Mark G. =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com