|
|
|
|
|
by Zababa
1808 days ago
|
|
I've always found this advice confusing and contradicting. Higher level to lower level doesn't read like a book. To make it read like a book (or an essay), you have to "flatten the tree", do something like: void get_opinion_of_uncle_bob() { prepare_mind(); opinion my_opinion = get_opinion(UNCLE_BOB); return my_opinion; } void prepare_mind() { get_coffee(); sit(); } void get_coffee() { / ... / } void sit() { place(butt, seat); } void place(auto object_to_place, auto to_be_placed_on) { move_away_from_obstacles(where_to_place); put_object_on(to_place, to_be_placed_on); } void move_away_from_obstacles(auto what_to_move_away) { / .... / } void get_opinion(int on_whom) { / .... / if (on_whom == UNCLE_BOB) { return create_opinion("too many short functions"); } } |
|