if statements and "We'll cross that bridge when we come to it"

if statements and "We'll cross that bridge when we come to it"

Released Thursday, 27th May 2021
Good episode? Give it some love!
if statements and "We'll cross that bridge when we come to it"

if statements and "We'll cross that bridge when we come to it"

if statements and "We'll cross that bridge when we come to it"

if statements and "We'll cross that bridge when we come to it"

Thursday, 27th May 2021
Good episode? Give it some love!
Rate Episode

Good morning or afternoon or evening friends, I wanted to talk today abouta saying that my wife has I think when my kids grow up they're gonnaremember my mom always used to say this and and so what she says is we'llcross that bridge when we come to it now, of course this isn't like anoriginal saying but she just says it a lot and what she's saying is thatshe doesn't want to make these decisions right now or use up the mentalenergy to decide whether or not.She wants to let the kids do a certain thing or whatever and I've taken tosaying it myself, um and what I'll often say is if you want me to answernow, I'll just say no so why don't you wait until I'm able to think aboutthis but it was I was thinking about this in the context of programming andthat's kind of what doing calculations within an if statement or the rightside of a ternary operator something that's kind of what that's like, sosometimes I will have a block.Of code where I'm doing some calculations and then I have an if statementthat says if such and such then use the value of those calculationsotherwise do nothing or otherwise do something else and so if you do yourcalculations first, then you're kind of crossing the bridge before you cameto it you're making a calculation for a value for which you may notactually need at all if you don't end up going into the consequent andactually using that value and and so I get instead you put the calculationwithin the if block or what we call the consequent then.Then you're crossing the bridge when you come to it you don't actually needto make that calculation until you actually need to get that value nowthere are I explain this to my wife last night and I thought oh that wouldbe a good thing for three minutes with Kenton and she said well now whatare the situations in which you would ever want to do the calculationbefore, you know, you actually need it and I said well, sometimes it can beuseful just for the way the code is structured you do all the calculationsup here, sometimes it's easy to calculate one thing while you'recalculating another thing even ifYou may not need both of those things andso there are reasons where you might want to cross the bridge before youcome to it, but I I think in those situations you want to make sure thatyou're not ending up with a performance problem of some kind so mentoringcan help out a lot so at the end of the day it comes down to readabilityand what's the most readable and then the exception is for those timeswhere it's a performance problem then then you do things anyway justthought it was kind of interesting analogy or metaphor.Hope you're having a nice day, we'll talk to you later.

Show More
Rate

Join Podchaser to...

  • Rate podcasts and episodes
  • Follow podcasts and creators
  • Create podcast and episode lists
  • & much more

Episode Tags

Do you host or manage this podcast?
Claim and edit this page to your liking.
,

Unlock more with Podchaser Pro

  • Audience Insights
  • Contact Information
  • Demographics
  • Charts
  • Sponsor History
  • and More!
Pro Features