Cohesion an naming

Published on 2 July 2013.

Today’s thought is about the relation between naming and cohesion.

I just watched a live-streamed hangout initiated by J. B. Rainsberger where the topic of conversation was coupling and cohesion.

At one point, Dale Emery said something about to naming and cohesion. When you think about what to name things, you see if they are related or not.

When I heard this I came to think about an exercise I read about where you were supposed to color a piece of code with three colors: red if you don’t understand it, yellow if you do understand it but it doesn’t have anything to do directly with the problem you are solving, it is infrastructure that makes your life easier, and green if you understand the code and it deals directly with the problem you are trying to solve. If you do that you can try to extract all but the green parts to a different module. Then your original piece of code will be highly cohesive.

Site proudly generated by Hakyll.