Click here to Skip to main content
15,893,663 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Multiple returns from methods or clean code flow Pin
megaadam17-Feb-19 22:15
professionalmegaadam17-Feb-19 22:15 
GeneralRe: Multiple returns from methods or clean code flow Pin
OriginalGriff17-Feb-19 22:49
mveOriginalGriff17-Feb-19 22:49 
GeneralRe: Multiple returns from methods or clean code flow Pin
megaadam18-Feb-19 2:29
professionalmegaadam18-Feb-19 2:29 
GeneralRe: Multiple returns from methods or clean code flow Pin
André Pereira18-Feb-19 4:42
André Pereira18-Feb-19 4:42 
GeneralRe: Multiple returns from methods or clean code flow Pin
milo-xml18-Feb-19 1:47
professionalmilo-xml18-Feb-19 1:47 
AnswerRe: Multiple returns from methods or clean code flow Pin
lopatir15-Feb-19 6:18
lopatir15-Feb-19 6:18 
GeneralRe: Multiple returns from methods or clean code flow Pin
André Pereira18-Feb-19 4:46
André Pereira18-Feb-19 4:46 
GeneralRe: Multiple returns from methods or clean code flow Pin
lopatir19-Feb-19 1:39
lopatir19-Feb-19 1:39 
Oh I hear you on the *nix, but as often it's the text editor that mixes spaces with tabs; i.e.
1. <return><tab> inserts a tab
... but then some editors change it to spaces, some don't...
2. <return><8 spaces>, inserts spaces
... but then some editors change that to a tab, some don't
and for more fun if it's an existing source file, some editors change only the edited lines to/from tabs and leave the untouched lines as they were, and some don't. Arrggh
(doing some C programming on Linux, pulling down code snippets, getting lots of both tab and space.)

So anyway don't blame the *nix fanbois, it's the [history of their] tools.

Worked at one company, the system admin decided the standard tab size would be 3 spaces and forced everybody to set the vi editor to honor this - All fine, except when they got source from outside the company set with the standard tab size of 8. Talk about moaning on and on, and when I suggested they really should use the standard size that everyone else on the planet used, "oh no, we won't change, it's everybody else that should change." ... idiots.

as to curly braces (and statements on same line as the if ()), as mentioned I'll normally only not use for very simple single statements, i.e. mostly return, break, continue, or perhaps a single method/function call on it's own.
i.e. "if (x == 0) return;" it's pretty clear if you want to add a statement before the return that the curlies aren't there.
anything longer (even if it's only a single function/method call but with many or long arguments) just like you I'll multi-line and wrap it in curlies for safety.)

as said it's my style, not going to claim it's better or worse than another's style.
Message Signature
(Click to edit ->)

AnswerRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 7:05
CodeWraith15-Feb-19 7:05 
AnswerRe: Multiple returns from methods or clean code flow Pin
Gerry Schmitz15-Feb-19 7:33
mveGerry Schmitz15-Feb-19 7:33 
AnswerRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 7:50
professionalZurdoDev15-Feb-19 7:50 
GeneralRe: Multiple returns from methods or clean code flow Pin
Gerry Schmitz15-Feb-19 8:08
mveGerry Schmitz15-Feb-19 8:08 
GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 8:12
professionalZurdoDev15-Feb-19 8:12 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 8:16
CodeWraith15-Feb-19 8:16 
GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 8:18
professionalZurdoDev15-Feb-19 8:18 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 8:51
CodeWraith15-Feb-19 8:51 
GeneralRe: Multiple returns from methods or clean code flow Pin
ZurdoDev15-Feb-19 9:03
professionalZurdoDev15-Feb-19 9:03 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith15-Feb-19 9:47
CodeWraith15-Feb-19 9:47 
GeneralRe: Multiple returns from methods or clean code flow Pin
kalberts17-Feb-19 22:02
kalberts17-Feb-19 22:02 
GeneralRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace15-Feb-19 10:33
Mark_Wallace15-Feb-19 10:33 
GeneralRe: Multiple returns from methods or clean code flow Pin
CodeWraith17-Feb-19 22:48
CodeWraith17-Feb-19 22:48 
GeneralRe: Multiple returns from methods or clean code flow Pin
Mark_Wallace18-Feb-19 6:52
Mark_Wallace18-Feb-19 6:52 
AnswerRe: Multiple returns from methods or clean code flow Pin
MarkTJohnson15-Feb-19 8:16
professionalMarkTJohnson15-Feb-19 8:16 
AnswerRe: Multiple returns from methods or clean code flow Pin
Maximilien15-Feb-19 8:17
Maximilien15-Feb-19 8:17 
GeneralRe: Multiple returns from methods or clean code flow Pin
  Forogar  15-Feb-19 8:24
professional  Forogar  15-Feb-19 8:24 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.