This may sound crazy, but hear me out. There are two ways to be successful waiting tables: having a great personality, or having exceptional time-management skills. Well, anybody who knows me will confirm that there’s no way I could support myself with personality, but I did learn how to get maximum results out of minimal effort. Give me a minute to lay some groundwork.
For those who have never worked in the restaurant industry, consider this. You’ve got a station of tables where you serve your customers. To service them effectively, you will need to go to several other areas. You’ll pick up (or make) your drinks at the bar, get your food (and possibly add garnishes) at the kitchen, and pickup other supplies and enter check-items at the wait station. Now, bear in mind, most of the work you do as a waiter, bartender, or cook takes place over the course of about 1.5 hours during lunch and 4 hours over dinner. The key to success is being able to meet the needs of your customers efficiently. So how does this translate to programming?
I'll tackle this question via analogy; consider the following:
- Station of tables equates to in-process memory
- Bar equates to the file-system
- Wait-station equates to the database
- Kitchen equates to web services/http-based resources
Efficiency in food service comes through consolidation. Let’s say I have five tables. If I take a drink order from one table, get the drink from the bar and then deliver, and my next action is to take a drink order from another table, I’ve wasted a lot of time. That trip to the bar is expensive. Now, if I can anticipate that both tables need drinks, I can take both orders and deliver them with one trip to the bar. I now have more time for servicing my other tables which translates to either more upselling, or faster turnaround. Both things lead to higher overall tips.
So let’s look at the programming parallels starting with the database (wait-station). If you take a food order from one table, can you take another food or drink order from another table? If so, this would save a trip, and considerable time. What if a table ask for a straw--another trip to the wait-station, unless you are carrying straws in your apron (caching). One could go on-and-on with these types of comparisons, all supporting the same theme: consolidate as many steps as you can.
This is a very common-sense concept, but you'd be surpised how often it's overlooked. From now on when you're typing (or better yet, planning) your code, see if there are opportunities to save a trip to the bar.