Feeding data to processes

43 views
Skip to first unread message

Erik Assum

unread,
Jun 5, 2018, 2:53:54 AM6/5/18
to Elements of Clojure
Hi, 

In the last chapter of EoC, you talk about processes as things that pull data from their environment, process this data and finally pushes the data on to its environment again.
I find this very useful when writing code, as it creates, in my opinion a better separation of concerns.

But there seems to me there is a possible problem with this way of doing things: Consider the case where your transformation may need different sets of inputs.
In the simple case you could say that the pull-phase should pull the superset of all interesting inputs from the environment, and then hand that over to the 
transformation phase, but that might be prohibitively expensive. I guess you could also model this as the data-transformation phase to be a process itself, which is then
responsible for pulling in more data before passing this onto its transformation phase. But then the initial transformation phase becomes impure, hard to test, and susceptible
to the failure modes we reserve for the pull phases.

I guess one stumbles upon the same problem from time to time in shell-pipelines:

ps aux | grep java 

is quite simple, and I cannot quite come up with an example of a shell-pipeline which requires additional input, probably because we don't do that, since then it's not a pipeline but a program?


Anyways, I'd really appreciate it if you could shed some light on my rambling thoughts.

Erik.
Reply all
Reply to author
Forward
0 new messages