
Hello Matias, Here's a partial review, focused on the first things I observed so far. 1. The very first thing I see is a nice bold question: "What is a bimap?" However, everything that follows doesn't feel like a good answer. Is more like the explanation of the missing answer. For such a concrete question I would expect a concrete answer like: "A Bimap is a data structure that represents bidirectional relations between elements of two collections", or something like that. Furthermore, at this introductory point in the tutorial, the very first mention of "bm.left" should IMHO be closely followed by its definition, yet the statement "is signature compatible with std::map<A,B>" is a bit simplistic at that. The same goes for bm.right and 'bm' itself. 2. The next thing one sees is the nice diagram. It's so nice that it sticks and weights in the understanding of the nature of a bimap. Even if one reads through the text, the picture drives the understanding. At least that's how it works in my head. However, it's a bit misleading, and I finally figured what, IMHO, is wrong with this picture :) Bare with me... On the one hand I see two sets, X and Y (drawn as Venn diagrams), and a biyective relation (the arrows). Pretty straightforward. On the other hand I see class bimap<X,Y>, followed by set< relation<X,Y> >, which one interprets as it's true nature given the way it is presented. Now, on yet another hand, or a left foot maybe, I also see bimap<X,Y>::left, which is really a map<X,Y>, and then a bimap<X,Y>::right, which is really a map<Y,X>. Eventually, I realized one of the most important aspects of a bimap: its triality (yes, this is a word). It is at the same time a set of elements (which happen to be relations), a map from left to right, and a map from right to left. Thus, set< relation<X,Y> > is not the only true nature of a bimap even though it stands up-front in the picture. In fact, it could be argued that the reverse view is the whole point of bimap<>. It's the reason of its existence. That is, the set< relation<X,Y> > nature of it, even if useful and novel, is secondary. One could have the same for an ordinary map for that matter. So, on the one hand, I would focus the presentation on the symmetric views first, then extend it to incorporate the (secondary) set-of-relations interface. So, let's see the pictorialization of the two symmetric maps. In the current picture, you see the left map sightly on top of the set X, and the right map slightly on top of the set Y. Bur this draws the subconscious association between the left map and X and the right map and Y. However, a map is a relation, so *both* elements are part of a map. Therefore, the picture should better relate both X and Y to each of the maps. Furthermore, these maps overlay each other over the same data structure, they are not just two disjoint maps. I noticed that part of the confusion comes from the fact that each map is enclosed in disjoint ballons, and, actually, those ballons have no real iconic value (they don't represent anything useful by themselves). The maps could be drawn at both sides of the sets and the ballons could be drawn to enclose both sets, such that at the intersection of both ballons, you see "the bimap" (the two sets and the relations between them). Also, to further guide the role of each map as a directed view of the relation, I would use two colors and two single-headed arrows, one of each color, instead of one double-headed arrow as it is now. Finally, I would put the set< relation<X,Y> > role at the bottom, to move the focus away from it, and its ballon would also enclose the two sets. In the end, there are three ballons all intersecting at the region containing the Veen diagrams, expressing the fact that a bimap<> offers three views over the same thing. 4.The following is from the second tutorial page (headed "The Tutorial") 4.a.It says: "New concepts are however presented to extend the mapping framework to bidirectional maps" That is confusing because at that point of the reading, there is no such thing as "a mapping framework". I would say "the std map class" instead. 4.b. The expression "new framework" is also confusing. A "new" something must relate to an "old" soemthing, and boost::bimap, IMO, should NOT be seen as something "new" while std::map as something old. I would say "the Bimap framework" instead (this applies to many other pages in the docs) 4.d. Here's the first time the expression "set type" is used. This expression is used all over the documentation but there is problem: the term "set" is not defined so one is forced to imagine its definition. Is it an STL set? Is it a mathematical set? Does it have special requirements? Granted, one eventually realizes you meant a mathematical set instead of an STL set, but even then, Bimap is purposedly designed to relax all such requirements, even uniqueness, so I think a better word for this concept is "collection". The reason is that you can actually use a vector for this type, which can hardly be considered as representing a mathematical set (because it doesn't guarantee uniqueness). 5. Here's an analysis of the "standard mapping framework" picture (following the same ideas as before); 5.a.The ballow should enclose both Venn diagrams since a map contains both elements. 5.b.The words "first/second" on top of std::map are confusing IMO. I would remove them. 5.c.In a std::map there is no explicit "set type" for the collection of keys, so at this point the label to it is confusing. I would removed it. 6. After the picture you read "this is not wrong.". What isn't? 7. In the introduction of the standard mapping framework, the idea of a map seen as an overlay of two "set types" is presented, but unfortunately quite superficially. This way of looking at it great, but is also a bit novel since the "standard framework" doesn't speak of left and right sets at all. Thus, besides what I mentioned before about replacing "set" by "collection", I think you should add an entire page explicitely presenting the idea, at a conceptual level, that a map is the overlay of two collections. Much before the standard mapping framework is introduced. That's all for now.. but there's more. Best regards And as promised: !!! vamos vamos, Argentina !! ------ Fernando Cacciola SciSoft http://certuscode.wordpress.com http://fcacciola.50webs.com http://fcacciola.wordpress.com

Fernando Cacciola wrote:
[partial review]
This review means that I would like Bimap to be included in Boost? Would you mind answering the following questions: - What is your evaluation of the design? - What is your evaluation of the implementation? - What is your evaluation of the documentation? - What is your evaluation of the potential usefulness of the library? - Did you try to use the library? With what compiler? Did you have any problems? - How much effort did you put into your evaluation? A glance? A quick reading? In-depth study? - Are you knowledgeable about the problem domain? Regards, Ion

"Ion Gaztañaga" <igaztanaga@gmail.com> wrote in message news:45E0A057.7000501@gmail.com...
Fernando Cacciola wrote:
[partial review]
This review means that I would like Bimap to be included in Boost?
In the previous post, before the present partial review, I already voted to Accept it. As for the rest of the questions, this is as I said a partial review. Just be patient :) Best Fernando Cacciola

Fernando Cacciola wrote:
"Ion Gaztañaga" <igaztanaga@gmail.com> wrote in message news:45E0A057.7000501@gmail.com...
Fernando Cacciola wrote:
[partial review]
This review means that I would like Bimap to be included in Boost?
In the previous post, before the present partial review, I already voted to Accept it.
Sorry, my fault! I'll be patient ;-) Regards, Ion
As for the rest of the questions, this is as I said a partial review.
Just be patient :)
Best
Fernando Cacciola
------------------------------------------------------------------------
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

On 2/23/07, Fernando Cacciola <fernando_cacciola@hotmail.com> wrote:
Hello Matias,
Here's a partial review, focused on the first things I observed so far. 1. The very first thing I see is a nice bold question: "What is a bimap?" However, everything that follows doesn't feel like a good answer. Is more like the explanation of the missing answer. For such a concrete question I would expect a concrete answer like: "A Bimap is a data structure that represents bidirectional relations between elements of two collections", or something like that.
Reading it again, I was left with your same feeling. I will answer that question. :)
Furthermore, at this introductory point in the tutorial, the very first mention of "bm.left" should IMHO be closely followed by its definition, yet the statement "is signature compatible with std::map<A,B>" is a bit simplistic at that. The same goes for bm.right and 'bm' itself.
It has to be simple because it is a one minute tutorial, but I think it can be good to expend a paragraph at this point.
2. The next thing one sees is the nice diagram. It's so nice that it sticks and weights in the understanding of the nature of a bimap. Even if one reads through the text, the picture drives the understanding. At least that's how it works in my head. However, it's a bit misleading, and I finally figured what, IMHO, is wrong with this picture :) Bare with me... ... In the end, there are three ballons all intersecting at the region containing the Veen diagrams, expressing the fact that a bimap<> offers three views over the same thing.
Here it is a link to your modified version: http://matias.capeletto.googlepages.com/simple.bimap.2.png 1) I like the new big balloons, you were right about that. 2) I am not sure about the two colored arrows. 3) I do not like the fact that the label for the "above" view is now at the "bottom" of the picture, but as you said now you look at the sides first. Maybe we can leave it above but make it smaller and achieve the same effect.
4.The following is from the second tutorial page (headed "The Tutorial")
4.a.It says:
"New concepts are however presented to extend the mapping framework to bidirectional maps"
That is confusing because at that point of the reading, there is no such thing as "a mapping framework". I would say "the std map class" instead.
Will it be OK to replace it for "to extend the standard mapping framework"?
4.b.
The expression "new framework" is also confusing. A "new" something must relate to an "old" soemthing, and boost::bimap, IMO, should NOT be seen as something "new" while std::map as something old. I would say "the Bimap framework" instead (this applies to many other pages in the docs)
Do you think that the word "new" will make people believe that this framework will replace the standard one?
4.d.
Here's the first time the expression "set type" is used. This expression is used all over the documentation but there is problem: the term "set" is not defined so one is forced to imagine its definition. Is it an STL set? Is it a mathematical set? Does it have special requirements?
Granted, one eventually realizes you meant a mathematical set instead of an STL set, but even then, Bimap is purposedly designed to relax all such requirements, even uniqueness, so I think a better word for this concept is "collection".
The reason is that you can actually use a vector for this type, which can hardly be considered as representing a mathematical set (because it doesn't guarantee uniqueness).
I used collection at some point and then change it to "set". I can not recall the reason for this switch right now. It may be better to roll back this decision.
5. Here's an analysis of the "standard mapping framework" picture (following the same ideas as before);
5.a.The ballow should enclose both Venn diagrams since a map contains both elements.
Ok.
5.b.The words "first/second" on top of std::map are confusing IMO. I would remove them.
Why do you think they are confusing?
5.c.In a std::map there is no explicit "set type" for the collection of keys, so at this point the label to it is confusing. I would removed it.
But the picture is not about std::map, it is about the standard mapping framework that includes std::multimap, std::unordered_map, etc... The label std::map could be replaced for "standard map"
6. After the picture you read "this is not wrong.". What isn't?
The framework. But the phrase can be better. I wanted to say that in many use cases, when you only need to see the mapping from the left side, it is better to use the standard maps. As a side note you can use a unconstrained_set_of typedef bimap<A,unconstrained_set_of<B>> bimap_type. to achieve almost the same performance of the standard map, and if later you need to look from the right side, you can change the typedef.
7. In the introduction of the standard mapping framework, the idea of a map seen as an overlay of two "set types" is presented, but unfortunately quite superficially. This way of looking at it great, but is also a bit novel since the "standard framework" doesn't speak of left and right sets at all. Thus, besides what I mentioned before about replacing "set" by "collection", I think you should add an entire page explicitely presenting the idea, at a conceptual level, that a map is the overlay of two collections. Much before the standard mapping framework is introduced.
Yes, I will do it. This concept must be clear from the beginning.
That's all for now.. but there's more.
Thanks a lot! Best regards Matias

Matias Capeletto wrote:
On 2/23/07, Fernando Cacciola <fernando_cacciola@hotmail.com> wrote:
Hello Matias,
Furthermore, at this introductory point in the tutorial, the very first mention of "bm.left" should IMHO be closely followed by its definition, yet the statement "is signature compatible with std::map<A,B>" is a bit simplistic at that. The same goes for bm.right and 'bm' itself.
It has to be simple because it is a one minute tutorial, but I think it can be good to expend a paragraph at this point.
OK. Focus on what exactly "signture compatible" means. That's actually one of those terms that convey an idea concisely, but diffusedly at the same time. One interprets that each and every member function has the same signature, but then wonders, is exactly like that? I would make that clear.
2. The next thing one sees is the nice diagram. It's so nice that it sticks and weights in the understanding of the nature of a bimap. Even if one reads through the text, the picture drives the understanding. At least that's how it works in my head. However, it's a bit misleading, and I finally figured what, IMHO, is wrong with this picture :) Bare with me... ... In the end, there are three ballons all intersecting at the region containing the Veen diagrams, expressing the fact that a bimap<> offers three views over the same thing.
Here it is a link to your modified version: http://matias.capeletto.googlepages.com/simple.bimap.2.png
1) I like the new big balloons, you were right about that.
Great
2) I am not sure about the two colored arrows.
I was thinking that the legends for the left/right maps were colored accordingly.
3) I do not like the fact that the label for the "above" view is now at the "bottom" of the picture, but as you said now you look at the sides first. Maybe we can leave it above but make it smaller and achieve the same effect.
Fine with me. But notice that you have a strong idea that this view is "above" (judging from other posts) That's actually artificial. Is not as natural as the left/right view (because then Venn's are physically left/right). It's OK to present it like that if you wish, but keep in mind that is an artificial POV that you just have choosen.
4.The following is from the second tutorial page (headed "The Tutorial")
4.a.It says:
"New concepts are however presented to extend the mapping framework to bidirectional maps"
That is confusing because at that point of the reading, there is no such thing as "a mapping framework". I would say "the std map class" instead.
Will it be OK to replace it for "to extend the standard mapping framework"?
The problem is that the concept of a "standard mapping framework" isn't sufficiently standard, so you can't just speak of it as if it where an implicitely defined term. So, I would phrase it like that, but also, and before, I would spend a page-or a couple of paragraphs-formally presenting "the standard mapping framework".
4.b.
The expression "new framework" is also confusing. A "new" something must relate to an "old" soemthing, and boost::bimap, IMO, should NOT be seen as something "new" while std::map as something old. I would say "the Bimap framework" instead (this applies to many other pages in the docs)
Do you think that the word "new" will make people believe that this framework will replace the standard one?
Somewhat, yes. I think you don't need the qualification at all, you can just address your framework directly.
5.b.The words "first/second" on top of std::map are confusing IMO. I would remove them.
Why do you think they are confusing?
Becasue there nothing *directly* being first or second in a map. Except the pair type that is used in some of its member functions. ALso, what does it adds to the understanding of what you are trying to show?
5.c.In a std::map there is no explicit "set type" for the collection of keys, so at this point the label to it is confusing. I would removed it.
But the picture is not about std::map, it is about the standard mapping framework that includes std::multimap, std::unordered_map, etc... The label std::map could be replaced for "standard map"
And in such a "standard framework" there isn't any explicit "set type". OTOH, it's a good idea to think of it that way, but then you need to present it that way in the docs before this picture is shown.
6. After the picture you read "this is not wrong.". What isn't?
The framework. But the phrase can be better. I wanted to say that in many use cases, when you only need to see the mapping from the left side, it is better to use the standard maps.
Then say so.
As a side note you can use a unconstrained_set_of typedef bimap<A,unconstrained_set_of<B>> bimap_type. to achieve almost the same performance of the standard map, and if later you need to look from the right side, you can change the typedef.
Btw, you can do so dynamically (that is, over an already constructed and filled bimap), or do you mean that you can define another bimap type that uses a different collection type? I couldn't tell that from the minitutorial. Well, the review period is over and I haven't got the time to go over the rest of it... I will anyway try to get involved in the ongoing discussions though. Best Fernando
participants (4)
-
Fernando Cacciola
-
igaztanaga@gmail.com
-
Ion Gaztañaga
-
Matias Capeletto