preload

You have to digest it

Posted by Albert Gareev on Sep 23, 2010 | Categories: Notes

To be master of any branch of knowledge,
you must master those which lie next to it;
and thus to know anything you must know all.

Oliver Wendell Holmes, Jr.

I have not failed.
I’ve just found 10,000 ways that won’t work.

Thomas Edison

Training and coaching is often a part of my job in automation.
Whether it’s a “build-up-from-scratch” project, or “make-our-test-suite-working” fix/maintenance duty, I like to share my knowledge with colleagues and help them in learning.

But sometimes I face misunderstanding. It usually comes as a question like “I only asked you to help me fixing my script, and you have,  – but why you are now telling me about all these [operators, functions, objects, API – may vary] ?”

At such point, sometimes I stop and leave to my desk. Or, if I saw sparks of interest, I suggest having a talk another convenient time, as I’m really willing to explain why.

Although the explanation is simple.

I do not consider it really fixed until the problem is fixed.

Knowing about the problem means knowing what caused it, in what environment, and in what combination of factors; what possible fixes are and what are the possible drawbacks.

If I’m asked every day to fix same types of boundary condition problems in loops, or type mismatch errors in API calls, I fix the scripts, but I do not fix the problem.

Give a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.
Chinese proverb

Now, what “fixing a problem” in terms of automation and programming means to me?

It means – I suggest taking a journey of learning and practicing, open questioning, and building a new piece of knowledge.

To demonstrate stated above with the practical example, I take a question asked many times.

“How can I replace characters in a string?”

The short answer is – use function Replace. This function is implemented in many languages, and the typical syntax is

[string] result = replace([string] source, [string] search_for, [string] replace_with)

But there is a huge difference between using “as is” and knowing how it works.

To know how it works, you need to ask and find answers to questions like

  • Does the compiler or interpreter perform automatic type casting and for what data types?
  • Does this function accept variables only, and how it treats inline expressions, especially with mixed data type?
  • Does it accept 1-byte characters only and how does it treat 2-byte characters?
  • If string data type has a limited length (for example, 255 characters, as in languages Pascal and SanScript), what happens with a call like replace(Str255long, “+”, “**) (i.e. causing it to exceed the boundary)
  • What happens if a source string is zero length, or search_for is zero length?
  • What happens if a source string or search_for or replace_with contain special or restricted characters (backslash, null-character, end-of-line, end-of-file, etc.)?
  • What happens with a call like replace(source, “+”, “++”) (i.e. replacing by multiplicating same character)?

And here’s the major trick!

Reading (or getting an answer) how it works means getting knowledge on how it is supposed to work.

If you want to really know how it works – try to make it working; practice it with your own code


  • One response to "You have to digest it"

  • Chenzhu Bai
    21st September 2013 at 21:27

    Yes, I do agree with you.

    Three years ago, When I started to learn using QTP, one of my testing application object’s property (“nodeType”) could not be found in “Identification Properties”, it occurred in “Native Properties”. And I needed to get this property and value using GetROProperty method.

    When I searched the help manual for the using of GetROProperty method, almost all the explanations told me “GetROProperty method is only used to get the object’s ‘Identification properties and values’ of the object at run-time.”

    When I tried to use it to get the Native property (“nodeType”) value, I got the error messege.

    So I asked for help to our team lead, and she told me “You can’t do that, because the document said it can only work with the ‘Identification Properties’!”

    I didn’t give up. I posted the question to the Internet and QTP forums to ask for help. Three days later, one QTP expert sent me information: “you can try this: GetROProperty (“attribute/nodeType”) …”

    And I tried and it did work …

    Sometimes, if you digest, you can get it!

    [Albert’s reply. Thanks for your story, Chenzhu.
    Though I’m not sure how asking around for help relates to my call for gaining new knowledge through practicing and experimenting..]

Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported
This work by Albert Gareev is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported.