It is not possible to infer the intent of a chunk of code purely from
the expressions. You can see what it does, not what it meant to do.
One way of labeling the intent is to put that code in a function. A
well chosen name can let someone determine what the function was
intended to do, and fix it if it is doing something else. You can also
test that intention holds for some reasonable set of values, and
people can expand that set of values if they find ones for which that
function seems to do something else.

So, if the choice you propose is between an function with a series of
steps, all in line, vs a function with a series of named steps that
are elsewhere, then yes, I'll go with you're option one because I'd
rather read.

  func (a *thing) processThing() error{
    a.tidyTheThing()
    a.mungeTheThing()
    a.augmentTheThing()
  }

Than a function of potentially unbounded length which is just a frenzy
of activity on that thing.

The problem is that you are advocating for what most people would
consider to be the day 1 programming experience, where experience and
industry best practice has show us that it is better to structure
things more clearly. You are the first person I've seen actually
advocate for this approach, where my own experience, and the
experience of every text I've read, advocates for the opposite.

On Tue, 3 Mar 2020 at 22:38, Warren Stephens
<wsteph...@prognoshealth.com> wrote:
>
> rog,
>
> Very well said -- but everyone keeps talking about improving the 
> maintainability without talking about the "comprehensiblity".
>
> Look at the 2 things below.  Which is more quickly comprehensible?  We cannot 
> conceive of a way to have the upper one and still test each piece???
>
> Warren
>
> AAA
> BBB
>    www
> CCC
>    xxx
>       yyy
> DDD
>    zzz
>
> ===========
>
> AAA
> BBB
> www
> CCC
> xxx
> yyy
> DDD
> zzz
>
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to golang-nuts+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/golang-nuts/be59057f-bd56-4b57-9e23-3c59b1153a47%40googlegroups.com.



-- 
Tristan Colgate-McFarlane
----
  "You can get all your daily vitamins from 52 pints of guiness, and a
glass of milk"

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/CAPGZSG%2B6KbYTOxeThC6PcxskGSXckebPb%2BUmJ6acp_e%3DRFO%3DRg%40mail.gmail.com.

Reply via email to