Prefer duplication over the wrong abstraction (2016)
31–40 of 375 posts
Re: Prefer duplication over the wrong abstraction (2016)
#32Code duplication is the wrong abstraction too -- unless it's not really code duplication but code that only happens to be similar for some really "unstable" reason.
But beyond that, any stable abstraction is better than duplicated code.
Re: Prefer duplication over the wrong abstraction (2016)
#33Re: Prefer duplication over the wrong abstraction (2016)
#34Re: Prefer duplication over the wrong abstraction (2016)
#35No it's not. This has always been a needlessly iconoclastic rather than sensible suggestion. At the very least it is not once you're working at the wrong kind of scale. Once you have an awkward number of customers (more than five and less than a hundred), maintaining duplicated code that should have been abstracted and modularised will only seem cheap if you don't mind that you burn through even junior employees at a…
If you haven't figured out a good abstraction at 5-100 customers, God help you.
Re: Prefer duplication over the wrong abstraction (2016)
#36Mike's talk argues that code solutions need not be modelled on the real world, and that different data creates different problems, which need different solutions. I can't do the talk justice, but it's had a big impact on me.
Brian's talk is about abstraction generally, and how it's difficult to find the "right" abstraction.
Re: Prefer duplication over the wrong abstraction (2016)
#37Duplication is fine, triplication and above is the issue.
It's of course possible to functional-ize segments of logic, but then the question of state mutation must be brought up. How isolated are these changes from other parts of the code / system state. Can this be run in parallel or is it something that must be serial? What potential race conditions exist?
Re: Prefer duplication over the wrong abstraction (2016)
#38I used to struggle with abstractions back in my OOP days but since moving pretty much to a purely functional approach I find that code duplication is rare. Just have a function and call it in two parts. The main abstraction issue is then data structures but with TypeScript interfaces being duck typing essentially I run into few problems there as well. So code duplication because of abstraction issues is rare. Code du…