Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I precalculate data and store it in a static table and call this process 'caching' but that doesn't seem correct based on a quick dictionary search (hiding, concealing) I'm just saving the data statically to avoid the process time to make the calculation. Is there a more appropriate term/word?

I think the key words here are 'static' and 'calculated'

Probable Answers:

As a noun

(the actual output from such a process): Lookup Table

As a verb

(the process of getting there): Tabling

share|improve this question

closed as primarily opinion-based by gnat, MichaelT, GlenH7, ChrisF Mar 20 at 23:01

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise.If this question can be reworded to fit the rules in the help center, please edit the question.

    
maybe some context could help. I have a process called 'CacheSuchandSuchdata' and that's the issue, I'm not hiding concealing data, I'm just storing it precalculate and static (maybe 'precalculateSuchandSuch' ?) –  Chris Apr 27 '12 at 19:04
    
I think I'm going to continue to use the word 'cache' to mean 'a process of storing calculated views for quick retrieval' I'm open to hearing differing views. –  Chris Apr 27 '12 at 20:33
add comment

4 Answers

up vote 10 down vote accepted

While "caching" traditionally meant "hiding" something, this term has a special meaning when dealing with computer science.

What you are doing would be considered to be in-memory caching, and while "Memoization" is a more accurate term, it is not commonly used in the programming community at large. Programmers are more likely to know what you mean if you describe the action as "caching."

That said:

  • The action of "caching" simply means that you are putting data into a place where you can quickly retrieve it later. If this is all your method does, then by all means call it CacheSuchAndSuchData.
  • On the other hand, if your method is responsible for producing the data in question (either by invoking another method to build it or by retrieving it from the cache), I'd call it GetSuchAndSuchData.
  • If it's responsible for building the data, I'd call it BuildSuchAndSuchData, or CalculateSuchAndSuchData.
  • If your method is responsible for doing two or more of the above, you probably need to separate concerns better.
share|improve this answer
    
I am very interested in hearing other people's opinions about this answer. I too have always concidered the word 'cache' in terms of database storrage as tabling the calculated results of a stored procedure or view. –  Chris Apr 27 '12 at 20:20
    
I'm thinking the knee jerk reaction to assume that my assumption was incorrect may prove your answer to be right –  Chris Apr 27 '12 at 20:23
    
based on this, foldoc.org/cache the word may be 'write' –  Chris Apr 27 '12 at 20:39
add comment

A stored, pre-calculated table of data is normally called a lookup table or lookup data.

an array that replaces runtime computation with a simpler array indexing operation. The savings in terms of processing time can be significant, since retrieving a value from memory is often faster than undergoing an 'expensive' computation or input/output operation. The tables may be precalculated and stored in static program storage, calculated (or "pre-fetched") as part of a program's initialization phase (memoization), or even stored in hardware in application-specific platforms. Lookup tables are also used extensively to validate input values by matching against a list of valid (or invalid) items in an array and, in some programming languages, may include pointer functions (or offsets to labels) to process the matching input...

share|improve this answer
    
That's perfect, but this raises a question, What's the difference from 'Lookup' as far as dropdown lists? because the data I'm storing is a large data set and I'm so familiar with the term being used for short aggregate lists for data validation. –  Chris Apr 27 '12 at 18:58
1  
@Chris - I believe you are talking about database lookup tables, which in that context are tables to hold commonly used data. –  Oded Apr 27 '12 at 19:02
1  
@Chris - Saving it? Persisting it? –  Oded Apr 27 '12 at 19:04
3  
The difference between memoization and using a lookup table is that a lookup table is typically constructed ahead of time -- perhaps as a resource built into the application, or maybe computed all at once when the application starts. Memoization is more like caching: you're storing the result calculations as you do them so that you can re-use them in the future. –  Caleb Apr 27 '12 at 19:35
1  
@Chris, I think the most common verb is constructing a lookup table. –  Karl Bielefeldt Apr 27 '12 at 19:50
show 5 more comments

maybe my question would be better phrased as 'what is the 'verb' for the 'process' of storing this data. - Chris

In most Database systems ( esp RDBMS ) this is called Materializing, as in Materializing a View.

This term is the most technically relevant because it implies taking some dynamic data and calculates different data and storing it in some static location.

The actual Source and Destination are irrelevant in the abstract.

share|improve this answer
    
I could be mistaken but I thought this term applied if the source of the data was another table. –  FrustratedWithFormsDesigner Apr 27 '12 at 19:35
add comment

This process is called "Memoization"

http://en.wikipedia.org/wiki/Memoization

Noun: Memoizer
Verb: Memoize

About a year ago I created a generic Memoizer for myself.
(note: this implementation is not thread-safe)

    public class Memoizer<K, V>
    {
      private Dictionary<K, V> _memoized = new Dictionary<K, V>();
      private Func<K, V> _func;
      public Memoizer(Func<K, V> func)
      {
        _func = func;
      }

      public V GetValue(K key)
      {
        V value;
        if (_memoized.TryGetValue(key, out value))
        {
          return value;
        }
        else
        {
          value = _func(key);
          _memoized.Add(key, value);
          return value;
        }
      }
    }

It allows you to call GetValue(key) and it will either retrieve the memoized value or call your lambda (that you specify in the ctor) to calculate (and store) the value.

See https://gist.github.com/abe22dd74b4367b42fd6 for an example of using this for fibinocci.

share|improve this answer
    
maybe the proper name of the function for doing such a task would be 'table' such as TableSuchandSuchCalculatedValues? –  Chris Apr 27 '12 at 19:15
    
I see how this is the right word but I can't see naming my processes with it. "MemoizeSuchandsuchData" How say ye? –  Chris Apr 27 '12 at 19:34
1  
SuchAndSuchDataMemoizer, or why use the word memoizer in the class name at all? Why do consumers of your "SuchAndSuchData" need to know that you are memoizing? Call it "SuchAndSuchDataCalculator"/Repository, and just use a memoizer internally –  csauve Apr 27 '12 at 19:39
2  
Note that "memoization" is not for caching state (assets(customers etc)). It is for caching the results of a calculation (fibinacci/power/etc). Your "calcuation" should follow the rules of functional programming (no side effects, no external state required other than what is sent as args) –  csauve Apr 27 '12 at 19:42
4  
The question though is about pre-calculating a set of data. That's not memoization. –  Oded Apr 27 '12 at 19:54
show 2 more comments

Not the answer you're looking for? Browse other questions tagged or ask your own question.