Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) 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.

In reply to Re^4: Top Level Module Namespace Table by ELISHEVA
in thread Top Level Module Namespace Table by Xiong

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (7)
As of 2024-04-16 19:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found