110
Linear code is more readable
(blog.separateconcerns.com)
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
Follow the wormhole through a path of communities !webdev@programming.dev
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 andoven.Insert
to fail; in the other case, it's possible for the kitchen to fill up with ovens, andoven.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 oforder.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.