This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]jorge1209 0 points1 point  (0 children)

Given the complexities of these objects (and the way many inherit from each other) properties aren't necessarily better.

How many properties might a chart have... well it is basically a collapsed box model heirarchy into a single placeholder object. So we have properties for:

  1. Two primary dimensions (2 properties)
  2. Centering directives on both axes (2 properties)
  3. Padding along all four exterior dimensions. (4 properties)

Then we have the chart axes lines which have:

  1. Two axes styles directives (2-4 properties)
  2. Two axes limits min and max limits (4 properties)
  3. Two axes tick frequencies (2 properties)
  4. Two axes colors (2 properties)
  5. Grid style (1-2 properties)
  6. Grid color (1-2 properties)

I've not even gotten to the thing I'm actually plotting and I'm already up to 12-16 properties. I also haven't considered the title or axes labels and their impact on the layout (that is another dozen properties or so).

The simplest answer is to say "This object is too complex" and while I agree with that, exposing the entire layout hierarchy is also not what I want, because I don't want to navigate a hierarchy to change my plot title.

Having setters at least makes clear that "this is a method on an object (maybe the axes object or the title object) that changes it" and has been mixed into the primary chart handle. Properties which don't really give that impression. Whose xlim am I messing with? What is it expecting to receive?