Different for the sake of different is fine, but "preferable" is a bold statement that appears to have no evidence.
Different for the sake of different is fine, but "preferable" is a bold statement that appears to have no evidence.
Of course, it does have a lot of useful code around math, projections, etc.
This project looks like a very welcome step in the right direction, showing that d3's great math can be used with obvious, declarative syntax.
".enter" actually makes sense in terms of describing how data flows through the D3 processing pipeline.
Quite simply, there's an impedance mismatch.
> "Unfortunately, I always find D3 code surprisingly difficult to understand and extend"
I would say something different - it is very easy to extend and create various visualization. It is easy to scaffold new chart (line, pie, box-plot, heatmap etc.) and customize it to specified needs. I'd rather say that it is difficult to create a brand new type of visualization which wasn't been already developed [1] and it is easy to understand by random folk.
I'm just concerned about speed. Diffing works ok for forms but charts with 1000s of elements... let's see.
As someone who has worked with D3 and React a lot, D4 makes a lot of sense.
And the name is great!
- vs -
Declaring 'how' this structure is created
selection.enter().append("div").attr("class", "bar") .style("height", function(d){ return d + "px"; }) .style(“margin-top”, function(d){ return (100 — d) + "px"; });
enter is not imperative, but what you write just afterwards is.
It's an active verb and seems to imply an imperative style. Except it's actually declarative. The problem with d3 is that it takes a declarative system and gives it an imperative-looking API.
If I write "node.enter()" it definitely looks like I'm making the node is being made to enter if you aren't well-versed in d3.
The problem with "enter" is that nothing will happen if you simply use enter by itself. Yet it's an active verb which seems to imply that something will be made to enter.
But you still "SELECT" something to look at. A SELECT statement is, by itself, sufficient to get something to happen (for results to be fetched).
On the other hand, a D3 enter() does absolutely nothing by itself. You must do further calls for it to have any impact.
This is very off topic and ridiculous.
SELECT * FROM stuff WHERE thing=2
Of course you can't. Because every declarative process has two main steps: declare and execute. SELECT and enter() both only declare; they must then be executed against data in an engine to produce a result.