dominictarr / through

simple way to create a ReadableWritable stream that works
Other
669 stars 64 forks source link

through versus Transform in node 0.10+ #20

Open jeromew opened 10 years ago

jeromew commented 10 years ago

Hello,

As I understand it this project has existed since long before the Streams2 API landed in node 0.10

I have a hard time understanding the difference between throughand the now native Transform implementation (http://nodejs.org/api/stream.html#stream_class_stream_transform_1)

is compat with node 0.8 really such a big thing now ? couldn't through be implemented more simply as a wrapper to Tranform where

through(write, end)
<=>
Transform({objectMode: true})
 _write = write
 _end = end

I hope my question makes sense

dominictarr commented 10 years ago

Almost.

If you want a stream2 version of a through-like api checkout through2

streams1 are a lot simpler than streams2, with much less code, and streams1 still works. Basically, I see very little to be gained by rewriting this when streams1 stuff still works fine.

jeromew commented 10 years ago

Thank you for you answer. I understand.

I am a firm believer of the stream approach to things (congratulations on event-stream it is a great project I discovered it through gulp).

corner cases in streaming code are always complex and there are so many ways to do it wrong; The benefit I see to stream2 is purely from a developer usability perspective as having one standardized way is simpler to grasp than 2 different ways that have to keep interoperable.

It already takes time to choose npm modules in the node ecosystem ; finding quality stream modules is even harder (except yours of course ;-) and I think it is hard to expect that new developers will create quality stream modules by following examples I there are 2 ways of doing things.

Learning by example in this stream field is hard because of those 2 APIs and I wish everything was streams1 or stream2 but not "stream1.5"

If you need help in de-fragmenting this I can probably spend some time on it.

would it make sense ? you seem to be very involved in the stream community in node. Am I the only one thinking that this fragmentation slows the learning of new contributors ?