Hacker News new | ask | show | jobs
by dribnet 4824 days ago
> I often have this feeling when I read Mike's code, particularly D3.

Agreed - there is tons to learn in the D3 src, but I don't feel that it is written in a way friendly to casual inspection. But D3 more than makes up for this with such clear and thorough documentation that this is rarely an issue.

Random example: wondering what a d3 selection.attr returns? Reading the docs [1] is a much quicker read than scanning the source [2] and working backwards from this nested return one-liner:

    return value == null
        ? (name.local ? attrNullNS : attrNull) : (typeof value === "function"
        ? (name.local ? attrFunctionNS : attrFunction)
        : (name.local ? attrConstantNS : attrConstant));
[1] https://github.com/mbostock/d3/wiki/Selections#wiki-attr

[2] https://github.com/mbostock/d3/blob/v3.1.4/src/selection/att...