|
|
|
|
|
by ropejumper
541 days ago
|
|
Because now you have to jump around in order to see the sequence of events, which can be very frustrating if you have to constantly switch between two of these functions. Plus, if we're dealing with a "long list of tasks" that can't be broken up in reusable chunks, it probably means that you need to share some context, which is way easier to do if you're in the same scope. One thing I find useful is to structure it in blocks instead, so you can share things but also contain what you don't want shared. So e.g. in rust you could do this: let shared_computation = do_shared_computation();
let result_one = {
let result = do_useful_things();
other_things(&shared_computation);
result
}
...
I think it's a nice middleground. But you still can't write modular tests. But maybe you don't have to, because again, this is just a long list of tasks you need to do that conceptually can't be broken down, so maybe it's better to just test the whole thing as a unit. |
|