You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Paul Gear <pa...@gear.dyndns.org> on 2004/06/03 14:44:27 UTC

Collections: MultiMap status?

Hi folks,

Just wondering what the present preferred API for using maps that allow
multiple keys is.

The tasks list for Commons Collections says:
	MultiMap subpackage implementing a revised interface

Where should i go if i want to work on this?

And another small question: why the restriction on spaces rather than
tabs in submitted code?  Are you trying to torture everyone who uses vi
correctly?  :-)
-- 
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.

Re: [Collections] MultiMap status?

Posted by Paul Gear <pa...@gear.dyndns.org>.
Simon Kitching wrote:
> ...
> I'll bite. Tabs in source code are a major nuisance.
> 
> The code is only readable (ie indenting not badly stuffed up) when
> viewed with exactly the same tab settings used by the author of the
> code.
>
> The default tab setting is equivalent to 8 spaces. That's certainly what
> you see if you use "more" or view the output of "cvs diff" or similar.
> But almost no-one uses tab settings of 8 in their editors, because it is
> far too much indentation for normal source code. People usually set tabs
> to render as equivalent to 2, 3 or 4 spaces in their editor. And then
> when they put a "hard tab" char into the document they are editing the
> text looks fine. But when someone else looks at it with "more", or uses
> an editor with different settings, the code looks like ****.
> 
> The simple fix for all this is to require all source code to be indented
> using spaces, not tabs. It is then guaranteed to be consistently
> indented regardless of what tool is used to view it, and what the local
> OS and editor settings are.
> 
> Most editors have an option to use "soft tabs", so that when the tab key
> is pressed 2,3,4, or whatever spaces are inserted into the file. 

So you're saying that this is all about catering for those editors which
make insufficient distinction between tabs and indents?

That is why i asked if you are trying to torture everyone who uses vi
correctly.  Vi distinguishes between tabs (using the tab key, and
controlled by the 'set tabstop' command) and indents (using Ctrl-D and
Ctrl-T and controlled by the 'set shiftwidth' command), and creates
indents using the correct number of tabs and spaces.  IIRC, emacs does
the same.

Why are people still worrying about stuff which was solved 15 years ago
by the standard editing tools?

-- 
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.

Re: [Collections] MultiMap status?

Posted by Simon Kitching <si...@ecnetwork.co.nz>.
On Fri, 2004-06-04 at 22:11, Paul Gear wrote:
> Stephen Colebourne wrote:
> > From: "Paul Gear" <pa...@gear.dyndns.org>
> > 
> 
> No takers on my question about spaces rather than tabs?

I'll bite. Tabs in source code are a major nuisance.

The code is only readable (ie indenting not badly stuffed up) when
viewed with exactly the same tab settings used by the author of the
code.

The default tab setting is equivalent to 8 spaces. That's certainly what
you see if you use "more" or view the output of "cvs diff" or similar.
But almost no-one uses tab settings of 8 in their editors, because it is
far too much indentation for normal source code. People usually set tabs
to render as equivalent to 2, 3 or 4 spaces in their editor. And then
when they put a "hard tab" char into the document they are editing the
text looks fine. But when someone else looks at it with "more", or uses
an editor with different settings, the code looks like ****.

The simple fix for all this is to require all source code to be indented
using spaces, not tabs. It is then guaranteed to be consistently
indented regardless of what tool is used to view it, and what the local
OS and editor settings are.

Most editors have an option to use "soft tabs", so that when the tab key
is pressed 2,3,4, or whatever spaces are inserted into the file. 


Regards,

Simon


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Collections] MultiMap status?

Posted by Paul Gear <pa...@gear.dyndns.org>.
Tim Reilly wrote:
> Maybe this article helps?
> I pointed people to it when we made it a convention to follow at work:
> 
> http://www.jwz.org/doc/tabs-vs-spaces.html
> 
> [Admittedly, it wasn't a real issue for us. We all used Eclipse anyhow, but
> I wanted us to follow Jakarta code conventions in case there was something
> for us to give back.]

OK - thanks for all your help.  I'm not expecting to contribute anything
at the moment, so i think i'll leave off mangling all of my files,
especially when vi already has a more intelligent method of handling tabs.

-- 
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.

RE: [Collections] MultiMap status?

Posted by Tim Reilly <ti...@consultant.com>.
Maybe this article helps?
I pointed people to it when we made it a convention to follow at work:

http://www.jwz.org/doc/tabs-vs-spaces.html

[Admittedly, it wasn't a real issue for us. We all used Eclipse anyhow, but
I wanted us to follow Jakarta code conventions in case there was something
for us to give back.]



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Collections] MultiMap status?

Posted by Phil Steitz <ph...@steitz.com>.
matthew.hawthorne wrote:
> Paul Gear wrote:
> 
>> No takers on my question about spaces rather than tabs?
> 
> 
> 
> I think it's because tabs are interpreted, and thus represented
> in different ways in different editors, on different platforms.  If this
> isn't true, then I have no idea.
> 
Another reason that we do not like tabs in sources committed to CVS is 
that the commit diff emails containing tabs are harder to read.

Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Collections] MultiMap status?

Posted by "matthew.hawthorne" <ma...@apache.org>.
Paul Gear wrote:
> No takers on my question about spaces rather than tabs?


I think it's because tabs are interpreted, and thus represented
in different ways in different editors, on different platforms.  If this
isn't true, then I have no idea.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Collections] MultiMap status?

Posted by Paul Gear <pa...@gear.dyndns.org>.
Stephen Colebourne wrote:
> From: "Paul Gear" <pa...@gear.dyndns.org>
> 
>>I couldn't find any documentation that indicated the above classes
> 
> existed.  Which package are they in?  That's why i started asking about
> the task list.
> 
> You will need to obtain the latest CVS contents. MultiKey is in keyvalue
> package. MultiKeyMap is in the map package.

OK - thanks.  I've checked it out and will have a looksie.

No takers on my question about spaces rather than tabs?

-- 
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.

Re: [Collections] MultiMap status?

Posted by Stephen Colebourne <sc...@btopenworld.com>.
From: "Paul Gear" <pa...@gear.dyndns.org>
>I couldn't find any documentation that indicated the above classes
existed.  Which package are they in?  That's why i started asking about
the task list.

You will need to obtain the latest CVS contents. MultiKey is in keyvalue
package. MultiKeyMap is in the map package.

Stephen



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Collections] MultiMap status?

Posted by Paul Gear <pa...@gear.dyndns.org>.
Stephen Colebourne wrote:
> MultiMap is an interface for multiple values mapped to one key.
> 
> MultiHashMap is the sole implementation, and has had new methods added in
> v3.1 (soon).
> 
> MultiKey is a standalone key class that can be used in any collection to
> store multiple keys/objects in one object.
> 
> MultiKeyMap is a new v3.1 class that provides an ideal API for mapping
> multiple keys to one value.
> 
> The tasks list is clearly a bit out of date, and I wouldn't particularly
> want to go down the subpackage route now.
> 
> Did you have a use case not covered by the above?

I couldn't find any documentation that indicated the above classes
existed.  Which package are they in?  That's why i started asking about
the task list.

-- 
Paul
http://paulgear.webhop.net
-- 
Think context!  Using accepted quoting conventions makes
your email easier to understand.  Learn how at
<http://www.netmeister.org/news/learn2quote.html>.

Re: [Collections] MultiMap status?

Posted by Stephen Colebourne <sc...@btopenworld.com>.
MultiMap is an interface for multiple values mapped to one key.

MultiHashMap is the sole implementation, and has had new methods added in
v3.1 (soon).

MultiKey is a standalone key class that can be used in any collection to
store multiple keys/objects in one object.

MultiKeyMap is a new v3.1 class that provides an ideal API for mapping
multiple keys to one value.

The tasks list is clearly a bit out of date, and I wouldn't particularly
want to go down the subpackage route now.

Did you have a use case not covered by the above?

Stephen


----- Original Message -----
From: "Paul Gear" <pa...@gear.dyndns.org>
> Just wondering what the present preferred API for using maps that allow
multiple keys is.

> The tasks list for Commons Collections says:
 MultiMap subpackage implementing a revised interface

> Where should i go if i want to work on this?

And another small question: why the restriction on spaces rather than
tabs in submitted code?  Are you trying to torture everyone who uses vi
correctly?  :-)



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org