Programming Recipes

Posted: March 9, 2011 in Programming Recipes

Hi again! When I wrote the first post of “Optimization Pills”, I didn’t realize that I’d made a terrible mistake…I had not created a “Programmig” section! Here it is! In this category I’m going to show you some “programming recipes”.

What is a “programming recipe”? – you grumbled.

I employ this expression to talk of a bunch of programming stuff: tips, tricks, books, idioms, etc. All of these things are valued when you write an application.

Suppose you’re cooking and you’d like to amaze your guests, serving some tasty dishes. Which are your possibilities?

Sure, you can think up something special, using several ingredients and precious spices. This takes time and requires creativity. But you tumble to have no time, the dinner begins in three hours and you’ve just sliced the bread!

Another choice is using a recipe, which describes all you need, including the cooking time and some comments (if you are lucky, you’ll find other intersting information like the benefit you’ll get). You just have to look for the recipes you consider appropriate (bear in mind what your guests like, if someone is allergic to some ingredients, etc) and mix the ingredients. Yum, my mouth waters!

The last choice (I write down) lies in cooking ready meals! If you’d like not to be discovered, assure none of your guests eat the same at home! This choice is really fast and safe (unless you’re not even able to heat up some pasta!).

Ok, I hope the comparison is quite clear, despite it is rough: the dinner is your application, guests (and their “preferences”) are the requirements and dishes are the “components” of your program. This components are linked in some way (generally so are the dishes in a “special” dinner). Ready meals refer to libraries or something available you can employ. Cooking a dish is the same as solving a problem in your application.

How to cook? Or rather, how to program?

Tips and tricks are excellent companions, don’t ever forget them. They are like advices your mum gives you, such as “use the bicarbonate to clean the fruits”. They can refer to either specific or general situations.

Idioms are low-level (standard) techniques to solve problems (generally simple tasks) using a programming language. Knowing the idioms associated with a programming language and how to use them is an important part of gaining fluency in that language. Think of an idiom as an action you do frequently, like “boiling the water” or “browning the onions”.

Read books to gain more knowledge of programming. A book can talk about tips and tricks, idioms, patterns, etc. In this context, a book may reference other books in which you’ll find advanced or related topics.

A library can make life easier for you, but at times it’s unuseful or unfitting. For example, you need high performance and the library “ABC” is too modular to run quickly. Sometimes the most effective way to use a library is to realize that other approaches are superior.

A programming recipe is anything useful to solve a programming issue and it includes lots of things, as you’ve just read! But keep in mind: you won’t find a recipe or a library to solve all your problems. You’ll have to use your brain and creativity, looking for new ingredients, pots, spices, etc. Your best friend is your experience, maybe enhanced by all the recipes you know!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s