Click here to Skip to main content
15,890,973 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: Expression bodies vs Good Old Fashioned Functions Pin
Slow Eddie20-Dec-21 4:23
professionalSlow Eddie20-Dec-21 4:23 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
ElectronProgrammer20-Dec-21 6:03
ElectronProgrammer20-Dec-21 6:03 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
trønderen20-Dec-21 6:25
trønderen20-Dec-21 6:25 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
David O'Neil20-Dec-21 6:48
professionalDavid O'Neil20-Dec-21 6:48 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Rich Shealer21-Dec-21 2:46
Rich Shealer21-Dec-21 2:46 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
David O'Neil21-Dec-21 12:40
professionalDavid O'Neil21-Dec-21 12:40 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
James Lonero23-Dec-21 7:15
James Lonero23-Dec-21 7:15 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Marc Clifton20-Dec-21 8:46
mvaMarc Clifton20-Dec-21 8:46 
trønderen wrote:
But with the modern style of always putting braces on separate lines, always put braces around even a simple assignment if it is e.g. an if clause (so the minimum number of lines for an if statement is 4). Some people even insist on always putting blank lines before and after any 'structured' statement (such as if/else, loops etc.),


Yup. It's a code style I enforce with everyone I work with. It makes stuff a lot more readable.

If seen crap like this:

some very long long of code
if (foo == null) return;
another very long line of code

And I've completely missed the return, not to mention that there should always be a single point of return. Code should be readable and organized, and blank lines is the best way to do that given the tools we have.

Now, personally, I don't think higher level functions should ever even have code in them except to call lower level functions. But trying to enforce that behavior on people (including myself often enough) is asking too much.

My 2c!

GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Slacker00720-Dec-21 8:54
professionalSlacker00720-Dec-21 8:54 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
trønderen20-Dec-21 12:22
trønderen20-Dec-21 12:22 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Peter Adam20-Dec-21 20:30
professionalPeter Adam20-Dec-21 20:30 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
James Lonero23-Dec-21 7:39
James Lonero23-Dec-21 7:39 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
James Lonero23-Dec-21 7:12
James Lonero23-Dec-21 7:12 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Gary R. Wheeler20-Dec-21 7:14
Gary R. Wheeler20-Dec-21 7:14 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Slacker00720-Dec-21 8:59
professionalSlacker00720-Dec-21 8:59 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Leo5620-Dec-21 23:57
Leo5620-Dec-21 23:57 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
dan!sh 20-Dec-21 22:11
professional dan!sh 20-Dec-21 22:11 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
MadGerbil21-Dec-21 1:47
MadGerbil21-Dec-21 1:47 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
rjmoses21-Dec-21 10:51
professionalrjmoses21-Dec-21 10:51 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
rjmoses21-Dec-21 10:54
professionalrjmoses21-Dec-21 10:54 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
englebart21-Dec-21 13:05
professionalenglebart21-Dec-21 13:05 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Ryan Peden21-Dec-21 17:48
professionalRyan Peden21-Dec-21 17:48 
GeneralRe: Expression bodies vs Good Old Fashioned Functions Pin
Matt McGuire22-Dec-21 6:01
professionalMatt McGuire22-Dec-21 6:01 
GeneralRe: CCC 20-12-2021 - Solution Pin
pkfox20-Dec-21 2:11
professionalpkfox20-Dec-21 2:11 
GeneralRe: CCC 20-12-2021 - Solution Pin
OriginalGriff20-Dec-21 2:17
mveOriginalGriff20-Dec-21 2:17 

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.