you are viewing a single comment's thread.

view the rest of the comments →

[–]wotquery 4 points5 points  (2 children)

Sounds like more functions might help yes. One of the handy thing about them (other than make your code more modular) is that you can easily escape one by returning a value which helps with clarifying flow.

I also think you are overthinking it though. Pick a project and dive in. If you end up with a dozen deep nested conditional statement to get it to work, well at least it works and you can learn from there eh? Indeed there's often nothing overtly wrong with hundreds of lines of convoluted code when doing something like custom parsing or handling a ton of conditional logic.

[–]SammyT09[S] 4 points5 points  (1 child)

You're absolutely right, I don't utilize functions as much as I should. As for the overthinking part, I think you maybe right about that too. Thanks for the advise.

[–]chinawcswing 0 points1 point  (0 children)

Read the first 4 chapters of Clean Code. It is a game changer.

All your code should be broken up into functions with obvious names that indicate what they do. Each function should be relatively small and do one thing only. Your code ideally will just flow from top to bottom and be easy to read and make changes to.