views:

40

answers:

1

After having written thousands and thousands of lines of code in a given language, you end up having your own personal templates. This is, code structures that you repeatedly use to address the same problems, or express the same ideas.

Most of these "personal templates" are polished versions of simple solutions, cleaner or easier ways to do things, that you discover over time.

I was thinking about my own personal templates today, and I grew curious as to what other people's practices were. What do you say, fellow Stack Overflow-ers, we share war stories?

For example, in C, whenever I have to find an empty slot in a fixed array of slots for whatevers, I always use these two lines:

for (i = found = 0; i < MAX_WHATEVER; i++)
    if ( (found = isEmpty(array[i])) ) break;

Then I can test the value of found, and use the index i.

What "personal templates" do you guys have?

A: 

My personal template is: when I answer to a non-question I give a non-answer. Like this. :)

vulkanino
But... that IS an answer! (:
LukeN