Sunday, August 31, 2014

Kitchen Testing

The messy lab of a mad scientist smiling triumphantly.
~ Kitchen Testing Can Be Like This ~
Once in a while when chatting about working with mods, I'll use the term, "kitchen testing". It's just one of my folksy sayings that's come about over the years. What I mean by "kitchen testing" is learning by trial-an-error; just do something and see what happens.

Many years ago, the author of a houseplant-tips book that I was reading, referred to his tips and techniques as "kitchen tested". (If I recall correctly, the book was "Mohter Earth's Hassle-Free Indoor Plant Book" by Lynn and Joel Rapp.) From reading the book and the way I grew up, I understood that "kitchen tested" meant learning by trial-and-error with simple experiments done in the kitchen.

No fancy apparatus, no sensitive scientific instruments, no framed PhD diplomas; just a terracotta pot, potting soil, a houseplant, and water.

What I know about working with mods for Minetest doesn't come from a fancy education but from "kitchen testing".

Pick a mod, open it's code in a text editor, change some stuff, load the mod into Minetest and see what happens. Then take note of the outcome, try something different in the mod's code, rinse-and-repeat the process. I may not know how and why something does what it does but I learn what works and what doesn't.

I can't emphasize enough how important it is to take notes during this process and to put them into the code as comments. Your notes will help you and others in the future. Don't worry about cluttering-up the code with your comments. Computer code by its very nature is cryptic and arcane to the average person. Comments in code can be the interpreters and translators for us non-geeks. "Kitchen testing" is about keeping things simple to understand and code comments can go a long way to help that.

So, in the end, even though kitchen testing may not be fancy and scientific (though there are times when I do feel like a mad scientist), it is still learning by trying things out and experimenting with ideas and what-ifs.



About Comments
Be civil and show some class toward your fellow commenters.

Trolls will be ignored as will posts containing swear-words or alternate spellings of swear words.

Comment, Comment, Comment

A pencil writing on lined paper as a reminder to write comments in your code.
~ Add Comments to Your Code ~
I was concerned that too many comments in code would slow down the code so I did a little Internet research.

This is what I found.

The short version: comment, comment, comment.

The long version. Code that has 1,000,000 lines in it will load slightly slower than code that has 10 lines in it. We're dealing with microseconds here. You can get ridiculous and split hairs down to the 0.00000001th of a second or you can get on with life. There are so many other factors that come into play when running code that your comments won't even make a dent compared to the other stuff.

In my reading I often came across coders inferring that not commenting your code was a greater sin and a sign of shoddy, unprofessional code.

Code comments are notes to yourself and others that may be helpful. The value of those notes far outweighs any infinitesimal performance hit they may cause.



About Comments
Be civil and show some class toward your fellow commenters.

Trolls will be ignored as will posts containing swear-words or alternate spellings of swear words.