Examples of doing it wrong first, with the goal of

I just caught myself doing what I do a lot, and wanted to summarize it, express it, share it and see who else is following this general practice to find other examples of situations where this may be relevant.

In general, the practice is to do something wrong first, in order to establish that everything else is right before the current task.

What I was trying to do, in particular, was to find examples in our code base where the dojo TextArea widget was used. I knew (because I had it in front of me - proof of existence) that the TextBox widget was present in at least one file. So I first looked at what I knew:

grep -r digit.form.TextBox | grep -v CBN

This was wrong: I made a general mistake (for me) by leaving a star, so I fixed this:

grep -r digit.form.TextBox * | Grep -v svn

who did not find any results! A quick comparison with the file I was looking at showed me that I mistakenly wrote "dijit":

grep -r dijit.form.TextBox * | Grep -v svn

And now I got the results. Cool; doing it wrong at first for the purpose meant that my request was right, except for finding the wrong thing, so now I could build the correct request:

grep -r dijit.form.TextArea * | Grep -v svn

and be sure that when this did not give me any results, it was because there were no such files, and not because I distorted the request.

I will add three other examples as answers; add others you know about.

+4
source share
7 answers

FER

Red-green refactoring of a test-based development cycle may be an archetype of this practice. With red, demonstrate that functionality does not exist; then create it and demonstrate that you did it by seeing the green bar.

+4
source

http://support.microsoft.com/kb/275085

This VBA procedure disables the "subdatasheets" property for each table in your MS Access database. The user is instructed to verify that error handling is set to "Break only on unprocessed errors." The routine identifies tables that need to be corrected as a result of an error. I'm not sure if this exactly matches your question, but I'm always curious that the error is used in error-free mode.

+1
source

Here is an example from VBA :

I also use the camel case when I change my variables. ThisIsAnExampleOfCamelCase. As soon as I exit the VBA code line if Access doesn't change the lowercase variable in case of a camel, I know that I have a typo. [OR, Option Explicit is not installed, this is the subject of the message.]

I also use this trick at least several times per hour.

+1
source

arrange - assert - act - approve

I sometimes like in my tests to add a counter statement before an action to show that the action is actually responsible for creating the desired result demonstrated by the final statement.

0
source

If you doubt my spelling and my control of editor spells

We use many editors. Many of them highlight misspelled words when I type them, and some don't. I rely on automatic spell checking, but I can’t always remember if the moment editor has this option. So I enter, say, “circuitx” and hit the space. If it is highlighted, I will back up the space and the “x” and type in another space - and find out that I wrote the diagram correctly, but if it is not, I copy this word and paste it into the well-known -checker spell to make sure that I did.

0
source

I’m not sure if this is the best way to act, since it doesn’t prevent you from using the final command incorrectly, for example by typing “TestArea” or something like that instead of “TextArea” (your finger just has to slip a little for such an error).

IMHO, the best way is to run your “final” command, but first in two sample files: one that contains the requested text, the other that doesn't.

In other words, instead of running a "similar" command, run the real one, but on top of the "similar" data.

0
source

(Not sure if it would be nice to try for real!)

For example, you can give the system testing to users and tell them that the password to run is “Apple”.

You know that users are fully prepared and ready to test (everything is installed and connected to the databases) when they contact you and say that the password does not work (this is actually “orange”).

0
source

All Articles