3

For example, I usually name SessionStorage but ProductRepository... It is something mental I couldn't explain to myself. Does anybody understand the meaning of suffixes Repository and Storage? :)

Alexander
  • 287
  • 4
  • 13
  • The terms are effectively synonyms. It is even common for people to talk of a "Storage Repository." So any subtle way that you plan to distinguish them is going to be completely opinion-based. Pick the name you like best; be sure to document the purpose of the class. – Cody Gray - on strike Feb 20 '16 at 11:04

3 Answers3

3

In english...

Repository: a place, building, or receptacle where things are or may be stored.

Storage: the action or method of storing something for future use.

Ivan
  • 1,320
  • 16
  • 26
2

I guess there is no difference in that.

Think about naming for a while and you may figure that it might be important to name things containing equal concepts equally.

So if there's no conceptual difference you should go for either Storage or Repository..

jrg
  • 106
  • 4
0

I think that repository is more something "to rely on". It might keep a history of things or you store it for safekeeping. Its more like a database. While a storage is just memory where you (temporarily) park something without handing over responsibility or any special guarantees other than that you (the thread or class storing it) keep ownership and can retrieve the stored object at a later time.

Carlo Wood
  • 5,648
  • 2
  • 35
  • 47