Code linearity is more desireable than keeping abstraction layers separate.

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.

Create a post

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



  • 1 user online
  • 1 user / day
  • 1 user / week
  • 1 user / month
  • 1 user / 6 months
  • 1 subscriber
  • 1.21K Posts
  • 17.8K Comments
  • Modlog