3

I have a set of structures in an API for reading data inputs and writing data outputs. For ease of processing, there is an intermediate structure that is used for holding data as it is processed. This intermediate structure is poorly named. Is there a simple, easy to remember name for such a structure that I am overlooking? Or is there a more appropriate place to ask this question?

It feels like I am wracking my brains for the obvious.

Post note: Well, I learned something from this question. The library I have is a wrapper library of shims that use the Adapter pattern. Using the name StagingX for the structure in question still seems like a poor choice. It does not scream out to potential users that this is the structure to use for processing due to optimizations that the input structures just cannot provide.

7

Name the data structure based on what it contains. The fact that its an intermediate entity should not matter.

Also, if possible, replace the intermediate structure with a converter that can do convert between stable structure A to structure B (unless you are doing this for some rare optimization case). This way you don't have to transient object that will eventually need to be freed up or garbage collected from the heap.

If the cost of renaming / refactoring is not a lot, do not bother a lot about naming it right the first time.

Personally, if I do not know what to call something, I do not know enough about what I'm building. YMMV

  • 1
    +1 for "Personally, if I do not know what to call something, I do not know enough about what I'm building". – user949300 Feb 22 '17 at 5:50
  • 1
    "Personally, if I do not know what to call something, I do not know enough about what I'm building." – It could also be the case that the something isn't important enough to deserve a name, but the language forces you to name it. E.g. in Python, where anonymous functions are severely limited, you are sometimes forced to use named functions where you would use anonymous functions in other languages. Similarly, statically typed languages which have neither type inference nor anonymous types. Imagine the verbosity and awkwardness of LINQ query expressions in C♯ without anonymous types or … – Jörg W Mittag Feb 22 '17 at 11:15
  • … λ-expressions in Java without type inference. – Jörg W Mittag Feb 22 '17 at 11:16
  • What you're effectively talking about here is the adapter pattern. – Robbie Dee Feb 22 '17 at 15:32
  • Perhaps I was not clear. The purpose of the intermediate (staging?) structure is for processing. There is no need for an adaptor, the input could be structure A and the output also structure A. it does not matter. The processing steps are generic, so they can take an A output the intermediate structure which can be further processed producing more of the same structure and finally output to the final output structure (structure A or otherwise). I could call it GenericX or IntermediateX, where X is the thing the structure represents, but that gets a bit long. – casualcoder Feb 23 '17 at 3:04
2

In database parlance, this would commonly be known as a staging area.

Data comes in and is gradually built up and refined before being passed onto its final destination.

This is also a common name for similar activity in other industries so it might be a good fit for your purposes - assuming everyone has heard of such a concept!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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