3 ms·
The author doesn't go into enough detail about the nature of the blocks of code (how big, what they do) as that will most certainly have an effect on the decisi
by allenu 8y ago
The author doesn't go into enough detail about the nature of the blocks of code (how big, what they do) as that will most certainly have an effect on the decision to break it up into functions.
I think if A, B, C, D, and E are mutating functions then yes, it may be sillier to break them up if they are all contribute to a core, almost atomic mutation. However, if they were functional, breaking them up may actually make sense and be more readable.
let a = A(x)
let b = B(a, y)
let c = C(b)
let d = D(c)
let e = E(d, z)
Then you can unit test each function and read each one in isolation to understand what transformation is being done on the data.
- rumcajz 8y agoCautionary tale: https://news.ycombinator.com/item?id=18832382 https://news.ycombinator.com/item?id=18832382