3 ms·
I think the flow you write should always be the way you work with code. First make sure it works, then look how to improve it, what parts are expressing similar
by janpieterz 11y ago
I think the flow you write should always be the way you work with code. First make sure it works, then look how to improve it, what parts are expressing similar behavior, what parts are different etc. If I remember correctly this is also what Robert Martin advises in Clean Code [1]. And it makes sense, worrying too much over what the abstractions are going to be is only going to slow you down.
I normally go even a bit further (certainly on the frontend) and leave duplication until I wrote something 3 or 4 times (or until it has stayed there for a little while). This ensures that when I do write my abstracted component I'm actually making sure it is something that can, at least within that app, be re-used.
I do re-use React components between different projects but am also using the same Bootstrap theme so this makes a lot of components really easy to re-use.
[1]: https://www.goodreads.com/book/show/3735293-clean-code https://www.goodreads.com/book/show/3735293-clean-code