Write it both ways - a podcast by Kent C. Dodds

from 2021-02-02T18:07:43

:: ::

Hello friends, so today I'm driving so that's the background noise you're
hearing but I wanted to talk about how I make a decision about whichdirection to go when I'm talking about like writing code in multiple ways
so like when the writing code there's like infinite ways to do things and
you really can just slice this in any direction that you choose and lots ofthose decisions are pretty arbitrary and,Yeah just like it's not so cut and
dry it's subjective and so the best method that I've found now sometimes
you can't really do this, but if it's for like a you know, utility function
or a handful of utility functions or something like that the best methodthat I've found for fixing or determining the best approach is to just take
both approaches and so this may take a little bit of time depending upbeathow big the thing is, but you just build it one way and now you have a good
idea of what the requirements are for.That method of madness and then you build it in the other way and you get
an idea of what that looks like and then you have way more context to knowwhich way is the better approach for whatever you're trying to accomplish
and so it may be it will take a little bit more time, but it's I I think
that it's worth the investment if you're concerned that one way might be
better than the other and sometimes if it if it's just like a small utility
function like the one that inspired me to talk about this today was justlike a 20 line function and so like it.
Didn't take me a whole lot of time to try both and then you know comment
out one coming in the other and just see which way I liked it better andyeah and and so like you don't have to just always go with the first way
that works. I think we do this a lot and we don't really have to do it that
way so anyway.I hope that is marginally useful to you at least and really interesting and
insightful to you at best and yeah take care.

Further episodes of 3 Minutes with Kent

Further podcasts by Kent C. Dodds

Website of Kent C. Dodds