+ 1

Code reusability best practices

What are some best practices for when to break out code into a separate file for reusability? I can think of some obvious scenarios like grouping for similarity (I.e. if I have several functions for calculating mean, median and mode of a set of numbers), or for code related to a specific class, but what are some other reasons?

22nd Oct 2018, 10:19 AM
Panayiotis Spanos
Panayiotis Spanos - avatar
2 ответов
+ 5
helps with managing organization, and modularity. I don't do it enough, it makes it difficult to find things at times. and for always-live applications, it's useful to reload a single function rather than every function.
22nd Oct 2018, 11:13 AM
Ahri Fox
Ahri Fox - avatar
0
While I appreciate that you're saying what it does and some drawbacks, what I'm asking for are for some tips/best practices. One example I ran across in my research was to group like methods into small libraries for easy re-use. I'm wondering if there are any other approaches people have to manage code re-use and best practices for managing/consolidating small code snippets. Hope this makes sense.
26th Oct 2018, 3:18 AM
Panayiotis Spanos
Panayiotis Spanos - avatar