BRIEFS logo BRIEFS

Write it both ways

02/02/2021 , 2m, 8s

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 which direction 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 of those 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 method that 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 upbeat how 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 know which 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 just like 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 and yeah 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.