On Tue, Mar 3, 2020 at 11:38 PM Warren Stephens <wsteph...@prognoshealth.com> wrote:
> 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??? > I don't really understand the point you are trying to make here. To me, the upper one seems more comprehensible and represents what has been suggested in this thread many times: To factor out the individual, separable pieces of code into their own functions with their own contracts and test those. As opposed to have one long run of statements. Maybe that's an artifact of imprecise representation and abstraction - i.e. maybe I don't understand correctly what you are trying to show with what you draw out. But maybe, it's also an artifact of ideas like "comprehensibility" (just like "readability") being overwhelmingly subjective. Sure, there is a long tail of clearly bad code where enough people can agree that it's incomprehensible, that we can talk about it being "objectively" bad. But for the overwhelming majority of realistic code where these questions come up, in my experience, reasonable people can agree that either version would work fine and that it mostly comes down to personal preference. Personally, my working memory is severely limited. So, having separate functions, allows me to treat them as individual units of comprehension, that I can then compose into larger blocks, a few at a time. (also, I want to once again point out that talking about "the real world" and your "decades of experience" comes of as condescension, even if it isn't intended as such. I don't think that serves your intention to convince people of your view point) > 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 > <https://groups.google.com/d/msgid/golang-nuts/be59057f-bd56-4b57-9e23-3c59b1153a47%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- 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/CAEkBMfEHzbXZ_%2Bt9oSqyNFn9sPpr%2BL5vBZdCg82yQT7g9bbQrQ%40mail.gmail.com.