Issue 66886 - NAMESPACES for Defined Names
Summary: NAMESPACES for Defined Names
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: code (show other issues)
Version: OOo 2.0.2
Hardware: All All
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-06-30 10:38 UTC by discoleo
Modified: 2015-09-30 18:01 UTC (History)
3 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description discoleo 2006-06-30 10:38:26 UTC
NAMESPACES
----------

One of the greatest advances in C++ over C was the introduction of namespaces
(this achievement cannot be overemphasized).

How can namespaces help us?

THE PROBLEM
-----------
I often need to define a significant number of names in my spreadsheets and as a
consequence, I easily get overwhelmed by so many names. It becomes increasingly
difficult to distinguish the names, especially if defined in different sheets.

I recently worked with a multi-sheet document (>5), each sheet having between 10
and 20 names defined (>50 named ranges). I definitely needed more names, but the
work became very messy.

 - many names generate easy confusion
 - and difficult to track errors due to misidentification of names

SOLUTION
--------
 - most names are needed only in the same sheet
 - few of them will be needed in different sheets as well

So, here is a wise solution:
 - define namespaces as in C++: names are valid only within their sheet/namespace
 - set a general option USE_NAMESPACES = NO, so that users not accustomed to C++
have not to worry
 - in any individual worksheet one should be able to write:
   USE NAMESPACE <namespace_to_be_used_freely>
 - otherwise, individual names should be directly available via:
   <namespace>::<name> (or <namespace>.<name>)
 - within individual sheets allow aliases to external names similar to the C++
typedef:
   typedef <namespace>::<name> 'our_shortcut_name'

ADVANTAGES
---------
 - names become more easy to manage and use
 - when I have to define a name, I use something like:
   'meaningful_var_name'_'meaningful_sheet_ID'
 - by having namespaces this becomes significantly simplified while the size of
the names decreases, too
 - further advantage: sort names in the names list based on the sheet where it
is defined
   IF it is impossible to sort first based on the sheet, then prepend an
identifier to allow such sorting, e.g. 'sheet_nr' (1,2,3,...)
   it would be impractical to use the entire name of the sheet, but a short
identifier (like the sheet number) could be used instead, e.g.
's1':'the_first_name','s1':'the_second_name',...,'s2':'first_name_in_sheet2'
Comment 1 frank 2006-06-30 10:43:46 UTC
one for requirements
Comment 2 discoleo 2006-09-28 01:23:41 UTC
I wrote also an extensuion (complementary method) to this issue, see
http://qa.openoffice.org/issues/show_bug.cgi?id=67499

That issue describes a way to:
 - bring even more structure inside Name Definitions
 - defines a way to have 'Comments' for any defined name
 - have a greater overview of both the names and (simultaneosly) the range they
point to

That issue describes an extension to the 'Insert -> Names -> Define Names'
window, so the issue name (Headers) might be slightly misleading. See first my
third post on that issue (I have tried to make it more understandable, because
my first 2 posts on that feature were somehow more difficult to understand).
Comment 3 discoleo 2008-05-23 21:33:12 UTC
There is a far better description for this feature available on the OASIS
mailing list. David Wheeler provides additional reasons why such locally scoped
names are useful, e.g. when copying sheets, the names will still refer to the
original range instead of auto-correcting to the new sheet.

For the full discussion see:
http://lists.oasis-open.org/archives/office/200608/msg00001.html

David proposes also the necessary ODF-changes to support this feature.

This feature request seems to be supported by the Sun Spreadsheet team, too:
http://lists.oasis-open.org/archives/office/200611/msg00085.html

I hope this clarifies the issue further and also speeds the implementation up.
Comment 4 Regina Henschel 2015-09-30 18:01:42 UTC
In ODF 1.2 it is possible to restrict a name to one sheet or to make the name global. LibreOffice has implemented a UI for this.

The idea of a "comment" is different and should be put into a separate bug report.