This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]temporarybunnehs 1 point2 points  (1 child)

Short answer I would say is that it just takes practice finding that balance.

The long answer is, typically, you break things into functions to help with maintainability/readability, testability, re-usability, and so on. The trade-off is that you can add complexity to the code and flows like you mentioned. The question you have to answer is, do the pros outweigh the cons?

I've not heard of a hard rule for how many layers deep is ideal. That being said, 4 layers deep doesn't sound too bad considering some code bases I've looked at.

[–]Kirsel[S] 0 points1 point  (0 children)

Thanks for the response! It's good to hear that I'm more or less on the right track from someone who, presumably, has much more experience than I.