110
Linear code is more readable (blog.separateconcerns.com)
you are viewing a single comment's thread
view the rest of the comments
[-] fubo@lemmy.world 5 points 1 year ago

What worries me is that neither version handles any errors whatsoever.

What happens if the oven never gets hot, because the gas interface has been brought down for maintenance? Now we've allocated a raw pizza that will never be baked. Since we never time out or check errors here, eventually the customer will time out waiting for a pizza and switch to our competitor.

Are we really allocating a new oven for each pizza? Probably not; oven may be a singleton. In one case, it's possible for the oven to fill up with pizzas and oven.Insert to fail; in the other case, it's possible for the kitchen to fill up with ovens, and oven.New to fail. Lacking error checking, we're eventually going to get one or another kind of oven overflow.

What happens if order.kind is "fuck you"? We don't put any toppings on the pizza; but (in code not shown) the value of order.kind probably still gets printed on the receipt. So some poor schmuck gets delivered a none pizza with fuck you. Like so many other Internet services, our pizza service can be exploited for harassment.

this post was submitted on 15 Sep 2023
110 points (89.9% liked)

Programming

17314 readers
252 users here now

Welcome to the main community in programming.dev! Feel free to post anything relating to programming here!

Cross posting is strongly encouraged in the instance. If you feel your post or another person's post makes sense in another community cross post into it.

Hope you enjoy the instance!

Rules

Rules

  • Follow the programming.dev instance rules
  • Keep content related to programming in some way
  • If you're posting long videos try to add in some form of tldr for those who don't want to watch videos

Wormhole

Follow the wormhole through a path of communities !webdev@programming.dev



founded 1 year ago
MODERATORS