4 ms·
"A little copying is better than a little dependency." I like this but how do you protect yourself against growing into a lot of copying?
by sleepychu 11y ago
"A little copying is better than a little dependency."
I like this but how do you protect yourself against growing into a lot of copying?
- pjmlp 11y agoApparently go generate https://blog.golang.org/generate https://blog.golang.org/generate
- shurcooL 11y agoDon't do a lot of copying.
- falcolas 11y agoPersonally, I use the rule of three. If it's copied three times, refactor it into some form of dependency. At that point, you should understand the use case, and should be able to create a reasonably designed API.
- krishicks 11y agoWhen doing this, be wary of what a friend of mine calls "misfactoring", an example of which being where you take three very similar, very readable bits of code and convert them into a single, parameterized mess that isn't understandable at all.