Click here to Skip to main content
15,913,467 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: brain cells fading... article discussing the use of early returns from functions... Pin
OriginalGriff23-Jan-17 22:03
mveOriginalGriff23-Jan-17 22:03 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8823-Jan-17 22:20
professionalden2k8823-Jan-17 22:20 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
User 1013254623-Jan-17 23:55
User 1013254623-Jan-17 23:55 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8823-Jan-17 23:57
professionalden2k8823-Jan-17 23:57 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
User 1013254624-Jan-17 0:09
User 1013254624-Jan-17 0:09 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8824-Jan-17 0:15
professionalden2k8824-Jan-17 0:15 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
User 1013254624-Jan-17 0:19
User 1013254624-Jan-17 0:19 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8824-Jan-17 0:25
professionalden2k8824-Jan-17 0:25 
Brent Jenkins wrote:
Your method should really focus on what it's supposed to be doing, not extraneous tasks.
Checking if it's going to plunge to a horrible and toothy death is very well part of its responsibility. Adding classes on classes on classes for a couple of operations that strongly depend on what the method is about to do on data* is a good way to create OOP spaghetti code. Been there done that got the t-shirt and I'm still maintaining that frigging mess, whose debug caused me a lot of lost hair and temper.

* I may have a parameter that should be != 0 but to the current method it does not matter, or on the other hand each other method would accept a != 0 but he needs it to be strictly > threshold. Adding a validator class and method for its conditions only is overkill. Just check them and go on. Also it help to contextualize logging and debugging wherever reflection is not an option.
CALL APOGEE, SAY AARDWOLF
GCS d--- s-/++ a- C++++ U+++ P- L- E-- W++ N++ o+ K- w+++ O? M-- V? PS+ PE- Y+ PGP t++ 5? X R++ tv-- b+ DI+++ D++ G e++>+++ h--- ++>+++ y+++*      Weapons extension: ma- k++ F+2 X

If you think 'goto' is evil, try writing an Assembly program without JMP. -- TNCaver

"Go ahead, make my day"

GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
User 1013254624-Jan-17 0:42
User 1013254624-Jan-17 0:42 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8824-Jan-17 0:49
professionalden2k8824-Jan-17 0:49 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
User 1013254624-Jan-17 0:54
User 1013254624-Jan-17 0:54 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
BillWoodruff25-Jan-17 17:49
professionalBillWoodruff25-Jan-17 17:49 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
Mark_Wallace23-Jan-17 22:48
Mark_Wallace23-Jan-17 22:48 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8823-Jan-17 23:10
professionalden2k8823-Jan-17 23:10 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
#realJSOP23-Jan-17 23:22
professional#realJSOP23-Jan-17 23:22 
GeneralRe: brain cells fading... article discussing the use of early returns from functions... Pin
den2k8823-Jan-17 23:27
professionalden2k8823-Jan-17 23:27 
GeneralRollercoaster... Pin
R. Giskard Reventlov23-Jan-17 10:52
R. Giskard Reventlov23-Jan-17 10:52 
GeneralRe: Rollercoaster... Pin
Mark_Wallace23-Jan-17 11:13
Mark_Wallace23-Jan-17 11:13 
GeneralRe: Rollercoaster... Pin
Sander Rossel23-Jan-17 11:18
professionalSander Rossel23-Jan-17 11:18 
GeneralRe: Rollercoaster... Pin
Mark_Wallace23-Jan-17 11:20
Mark_Wallace23-Jan-17 11:20 
GeneralRe: Rollercoaster... Pin
Colin Mullikin23-Jan-17 11:19
professionalColin Mullikin23-Jan-17 11:19 
GeneralRe: Rollercoaster... Pin
Mark_Wallace23-Jan-17 11:22
Mark_Wallace23-Jan-17 11:22 
GeneralRe: Rollercoaster... Pin
R. Giskard Reventlov23-Jan-17 11:38
R. Giskard Reventlov23-Jan-17 11:38 
GeneralRe: Rollercoaster... Pin
Mark_Wallace23-Jan-17 22:44
Mark_Wallace23-Jan-17 22:44 
GeneralRe: Rollercoaster... Pin
Marc Clifton23-Jan-17 13:02
mvaMarc Clifton23-Jan-17 13:02 

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.