Good tips. I think reading the logic out as a sentence is definitely a great way to realise if it will make sense to others at first glance. If it doesn't read as a proper sentence, then it likely isn't going to easily make sense to others.
Btw, small thing, but item.stock >= 0 should be item.stock > 0 as if the stock = 0 then there is no stock ;)
Good tips. I think reading the logic out as a sentence is definitely a great way to realise if it will make sense to others at first glance. If it doesn't read as a proper sentence, then it likely isn't going to easily make sense to others.
Btw, small thing, but
item.stock >= 0
should beitem.stock > 0
as if the stock = 0 then there is no stock ;)Hey, that is true! My mistake. Thanks for correcting me. I've amended the article.