I’m trying to replace “method should have few lines” with “method should have few phases"
-
-
Replying to @penelope_zone
Go makes getting small line counts very difficult, but line count isn’t the measure of what the method is doing
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
Here phase is defined by repeated semantically similar units of work
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
I just refactored a large sailboat conditional to a flat guard structure
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
Conceptually that method has one phase: do these validation steps and check for errors
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
The method that calls it, however, has multiple phases, parse json, set up error store, check for errors, return errors
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
In some languages, it’s easy to get down to “single line method”, and all that really indicates is that method is probably composed
1 reply 0 retweets 0 likes -
Replying to @penelope_zone
In Go, it isn’t easy to get to single line method, but it’s still worth fighting to ensure that method is composed.
2 replies 0 retweets 0 likes -
Replying to @penelope_zone
maybe I should submit a talk to
@abstractionscon /cc@eileencodes3 replies 0 retweets 1 like
@samphippen PITTSBURGH COME TO PITTSBURGH
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.