Hi,
I have several pipelines which have mostly the same behavior with a few differences, and I’m trying to understand the tradeoffs between them. Most of my use cases look something like this:
function do_stuff(pipeline)
if pipeline == pipeline1
specific_start = specific_start1
elseif pipeline == pipeline2
specific_start = specific_start2
end
return ThreadsX.map(values, specific_end \circ do_common_stuff \circ specific_start)
end
There are a lot of ways to organize these specific bits, such as multiple dispatch using singleton types, if-else statements as above, if-else statements within a general “specific_start” function, or using a Dict. My question is, what’s considered a best practice here? For example, in Haskell I might use pattern matching, while in an object-oriented language specific_start
would be a method of pipeline
. Is there one approach that’s preferred or significantly faster in Julia?