Skip to main content
wording improved
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassedtwo other functions.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two functionfunctions for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

To make the different levels of abstraction more transparent, it is often a good a idea to give a function like runTrafficAndCheckIfItPassed a different name, one which summarizes the combined actions under one concise term. If you cannot come up with such a name, then alas, let the name as it is now, naming things is one of the toughest tasks in software development ;-)

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

To make the different levels of abstraction more transparent, it is often a good a idea to give a function like runTrafficAndCheckIfItPassed a different name, one which summarizes the combined actions under one concise term. If you cannot come up with such a name, then alas, let the name as it is now, naming things is one of the toughest tasks in software development ;-)

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to two other functions.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two functions for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

To make the different levels of abstraction more transparent, it is often a good a idea to give a function like runTrafficAndCheckIfItPassed a different name, one which summarizes the combined actions under one concise term. If you cannot come up with such a name, then alas, let the name as it is now, naming things is one of the toughest tasks in software development ;-)

You find a good example in this older SE post.

edited body
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

To make the different levels of abstraction more transparent, it is often a good a idea to give a function like runTrafficAndCheckIfItPassed a different name, one which summarizes the combined actions under one concise term. If you cannot come up with such a name, then alas, let the name as it is now, naming things is one of the toughest tasks in software development ;-)

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

To make the different levels of abstraction more transparent, it is often a good a idea to give a function like runTrafficAndCheckIfItPassed a different name, one which summarizes the combined actions under one concise term. If you cannot come up with such a name, then alas, let the name as it is now, naming things is one of the toughest tasks in software development ;-)

You find a good example in this older SE post.

edited body
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level consist usually consist of lots of single commands, actions and steps on a lower level.

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level consist usually of lots of single commands, actions and steps on a lower level.

You find a good example in this older SE post.

Though the name gives a different impression, the function runTrafficAndCheckIfItPassed does only "one thing" in the "clean code sense": it coordinates the calls to runTraffic and checkIfTrafficPassed.

The operational code for those two actions included, however, is in runTraffic and checkIfTrafficPassed, which are two function for which we can assume they "do one thing" as well, but on a lower level of abstraction.

To apply the "do one thing" metapher correctly, one needs to take different levels of abstraction into account. Things which may be seen as one operation on a higher level usually consist of lots of single commands, actions and steps on a lower level.

You find a good example in this older SE post.

added 171 characters in body
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625
Loading
Source Link
Doc Brown
  • 220.7k
  • 35
  • 410
  • 625
Loading