Skip to main content

How to order functions in source code?

When writing code a tree of functions emerges. I make sure, that each level of that tree is on the same level of abstraction. Source files are linear. So how to linearize that tree? It turns out that a depth-first approach is easier to write and a breadth-first approach is easier to read. The latter it groups the function on same level of abstraction together. Jumping via a ctrl+click removes all the downsides. So write functions in depth-first and refactor to breadth-first. Someday I will write a tool that reorders from on the other. This makes extending easier - regarding the order of the functions.

Comments

Popular posts from this blog

Futureproof Software

From here:  https://dzone.com/articles/the-secrets-of-futureproof-software Self-healing Self-patching, or more broadly, self-updating Backward compatibility Dynamic adaptation/ability to evolve over time Intent-based Made up of reusable futureproof components

Choose Projects you do NOT do!

Inspiration from FluentC++ Choose which project NOT to work on. Be clear what you want and which projects are toxic. Keep the Hedgehog-concept in mind. Be sure that you are a) deeply passionate about the project b) the project can be the best in the world quality c) you can earn money with it If one of the three points is not met and not realistic soon don't do the project. Play around with it privately. Maybe you can pivot there so that it meets the criteria.