Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
No, not really. Once the OP is that far, his problem is solved.

The claim that two objects behave the same (performance asside) is a testable claim. Therefore it should be tested.

I don't think that "reconsider using X" is a very useful answer to "how do I test X happened".

Presumably if we are implementing caching then caching does make a difference. Therefore a non-cached and cached implementation of the same object ought to have a statistically different performance profile. That is an assertion that can be tested. If no performance difference is observable, then we might wonder if indeed caching is happening.

I've read the above paragraph a couple of times. I still have no clue whether you're trying to make a point, or whether you're just stringing words together.

Unfortunately such a sarcastic remark does little to help me be more clear. What didn't you understand?

Perhaps a more concrete example would help? Suppose I have a Person List API. I am responsible for programming a customer analysis report using that API. As the report writer I don't really care whether caching does or does not take place. I only care that the API provides whatever information I need to select the top 10 customers of the month in what my client subjectively feels is a reasonable amount of time. Testing performance time is OK, but testing specifically for caching is not. It violates the black box principle. How I get the performance doesn't matter - neither to my customers nor to me.

Now suppose my customers don't like the performance. After doing some profiling I decide that the slow performance is due to too much paging. I decide to reduce the memory consumption of the Person List by adding caching. Not wanting to reinvent the wheel I look at several different caching libraries - some optimize for retrieval time, some optimize for memory usage. If the API lets me set the memory consumption of the cache , I care very much that the cache API does not exceed that memory threshold. I would want that claim tested. Caching is still an implementation detail. However, testing the caching library API to make sure it conforms to its promises does not violate the black box principle, because the API being tested is the caching behavior itself.

Once I am done installing the code that uses the caching library, I go back to testing the customer analysis report. Once again I don't care about caching. I only care that my changed implementation seems fast enough to my customers. It really doesn't matter why it is faster, only that it is faster.

Best, beth


In reply to Re^3: Testing objects that cache by ELISHEVA
in thread Testing objects that cache by dreadpiratepeter

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-29 09:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found