|Syntactic Confectionery Delight|
Re^4: Top Level Module Namespace Tableby ELISHEVA (Prior)
|on Oct 04, 2012 at 10:35 UTC||Need Help??|
Hidden in your "readmore" link is a comment about the Data:: namespace being the world's worst identifier. user::petdance's observations were in regard to "data" as a variable name. Variable names usually identify the content stored in the variable. I totally agree that calling content data is pretty pointless. By definition it is data. However, that is not the meaning behind the top level data namespace.
Data:: as a namespace is short for "data structures" rather than for "data content".
It's been my understanding that the Data:: space is most properly used for modules that manipulate data structures independent of content and purpose. For example, a set of list or hash navigation utilities would belong in the Data:: namespace.
While it is true that nearly all modules use some sort of data, it isn't true that all modules are focused purely on the data structure itself apart from the use case. Most modules manipulate data for a purpose and the module is focused on the larger purpose (web page generation, database extraction, report formatting, user interaction, etc, etc.). Thus not all modules belong to Data:: even though they use data.
Data:: also seems to be the home of several modules that transform one data structure into another or convert complex data structures to strings, but not all. String representations are often closely tailored to specific use cases (computer persistence vs. human readability) or recognized standards (JSON, YAML). These modules often end up in top level spaces named after the convention or use case for which they were specifically designed.
Also without Data:: we would have the problem of where to place generic transformation utilities, particularly ones that manage bi-directional transformations between two or more equivalent storage formats and internal data structures: would they belong in the source data structure? There isn't one single source structure. The target data structure? There may not be one single target structure either. A special transformation top level category? If so, what should that top level structure be called if not Data? Transformations? A namespace called Transformations:: would be as vague as Data::. In a certain sense nearly all programs involve some sort of transformation.
Another issue arises when modules are developed for complex data structuring systems, e.g. a database. One could argue that these are purely about data structure and manipulation rather than the use case. After all, a database is at heart just a fancy data structure that supports validated and possibly distributed persistence. On the other hand, if the data structuring system is large and complex enough it gets its own namespace,e.g. DBI.
But even though these larger complex systems get their own top level namespace, it would not do to have separate namespaces for each possible complex data structure. There are too many possibilities. Having a top level category dedicated as a catchall for general purpose data structure manipulation saves us from having a multitude of top level categories dedicated to specific data structures.Update: cleaned up some typos.