3 ms·
Each method has its own innate complexity, the complexity of "whats this method do? when do I use it? Why would I use this method instead of a different method
by philosopher1234 7y ago
Each method has its own innate complexity, the complexity of "whats this method do? when do I use it? Why would I use this method instead of a different method in this class? Now I have to dive into this method to read its implementation which pulls me out of the reading context I was in before"
Also, your point about the meaning beyond the code can be served by a comment, which drops the constraint of "don't make it too long" and "write in camel case", and also allows inline code reading!
There's a time and a place for everything. I reccomend "A Philosophy of Software Design" for a book that elaborates on the idea of "less and longer methods tend to be better than many concise methods".
What you want to make short/simple is the API, rather than the implementation!
- sbergot 7y agoA function has a well defined scope, parameters and output. A comment does not. A function name describes an intention. Within the scope of this function, someone can check whether the intention is respected by the implementation. If this function calls other functions, just assume that they are working as their name suggests. If that is not the case, fix those other functions later. This has been my overall approach to maintaining code. To such extent that I design things around the possible names I can find. Some call that DDD. I call that respecting my team mates. Without writing and naming function, this is not possible. Languages such as J and K are fine for single developers & prototypes but really bad for bigger projects.