Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^4: Top Level Module Namespace Table

by ELISHEVA (Prior)
on Oct 04, 2012 at 10:35 UTC ( #997215=note: print w/replies, xml ) Need Help??

in reply to Re^3: Top Level Module Namespace Table
in thread Top Level Module Namespace Table

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.

Replies are listed 'Best First'.
Re^5: Top Level Module Namespace Table
by Xiong (Hermit) on Nov 04, 2012 at 02:54 UTC

    In C, a data structure is called a (variant) struct; and if Perlers called a data structure a struct then I would urge a top-level namespace of Struct::. But since that's not the case, I don't have a ready solution. Perhaps we should start calling them structs. This would be easier than trying to mumble around HoHoA... erm, HoAoH... erm, object-like-thing.

    We have the more flexible data structures; they have the shorter name that requires less disambiguation.

    Death only closes a Man's Reputation, and determines it as good or bad. —Joseph Addison

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://997215]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (4)
As of 2023-03-22 19:17 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (60 votes). Check out past polls.