[haiku-development] Re: AddGlue() as a metaphor behaves opposite what is expected

  • From: Axel Dörfler <axeld@xxxxxxxxxxxxxxxx>
  • To: haiku-development@xxxxxxxxxxxxx
  • Date: Sat, 25 Feb 2017 17:19:48 +0100

Am 25/02/2017 um 15:16 schrieb Brian Hill:

This may be a slight rant but I am always struggling with remembering
the proper use of the layout builder AddGlue() function.  It exhibits
a totally opposite behavior from real life glue, which is used to
stick two things together so they do not separate.  AddGlue() does
the opposite, adds an expandable space layout item so the two things
you stick the AddGlue() to can move apart.  It is probably too late
to change, but can we deprecate AddGlue() and replace it with
something else like AddEmptySpace(), AddWhiteSpace() or even
AddNegativeSpace()?

It might be misleading at first, but it's commonly called that way. Think of it this way: Since two adjacent components always stick together firmly, the glue makes them more flexible, and allows some space between the components.
Or to cite Java's description of it:
"Think of it as a kind of elastic glue — stretchy and expandable, yet taking up no space unless you pull apart the components that it is sticking to."
So it's a bit more like a rubber band.

Bye,
   Axel.

Other related posts: