As anyone who's done it knows, shopping for food in Hong Kong can be a pain. It happens all the time - you go into a market expecting to see an essential ingredient that the shop had on your previous visit, only to find it's sold out.
My food stylist and I plan at least a week in advance the three or four dishes we prepare for the Post Magazine recipe photo shoots that take place once or twice a month. Both of us trawl through food markets for fun in our spare time, so the dishes we plan to cook are inspired by the season and what we see when we shop. Even though between us we visit at least six markets, we never know until the day before the shoot whether we're going to find everything on our list - the fresh ingredients we spotted only a day or two earlier might not be available when we need them.
So, out of necessity, we improvise, something I also do when I'm cooking for friends. In a way, it's easier for the home cook to do that than it is for restaurant chefs with rigid menus that are changed only four times a year (although not all chefs are like that; some change their menus much more frequently, even daily). As long as you're not announcing to the world (or your dinner guests) every ingredient they're going to be served, you can improvise with impunity.
It's safest, though, to substitute like for like. If you want to make a dish of braised beef brisket, but the market is sold out of the meat, don't try to substitute beef tenderloin just because it, too, is a boneless hunk of meat - the two require entirely different cooking methods. Instead, pick another cut of meat that needs to be cooked low and slow, such as oxtail, ribs or beef cheeks.
If you do decide to change the main course because you can't find a key ingredient, you might also need to change the starters and side dishes. While mashed potato would be a delicious side dish to go with the sticky, collagen-rich gravy of a braised brisket, potatoes dauphinoise would be a good substitute if you decide to make roast beef tenderloin instead. The ingredients are similar: potatoes, butter and cream, but the creamy, gooey richness of the dauphinoise would be a better match with the lighter texture and flavour of the tenderloin.
When cooking, I improvise constantly with ingredients on my shelves. If I'm out of one spice or herb, I'll use another I have on hand; if I don't have fresh chilli to use in a sauce, I'll substitute one of the many types of chilli sauce I do have. The key is knowing which flavours are compatible, and substituting judiciously - if I only have rosemary when a recipe calls for thyme, I'll use less of the former, because it's so much stronger. If a recipe calls for anchovies and I don't have any, I'll use fish sauce instead; if I'm out of vinegar, I'll use fresh lemon juice. Changing things around as needed can be a lot of fun- it won't be exactly the same as the original, but sometimes it'll be even better.