3 ms·
> Most people just don't naturally think of processes as a composition of mappings from values in a domain to values in a codomain. This is most difficult to a
by loup-vaillant 12y ago
> Most people just don't naturally think of processes as a composition of mappings from values in a domain to values in a codomain.
This is most difficult to accept, because I do.
It's like programmers are divided into two camps: those who think procedurally, and those who think mathematically. I have noticed lately how this can influence API design, down to things as simple as this:
void latin9_to_utf8( std::string& latin9str);
std::string latin9_to_utf8(const std::string& latin9str);
The first interface is a design mistake: it encourages side effects, and requires more code to use in practice. But it is also a very natural one: you want to convert strings, so you write a function that converts strings (KISS). The second interface is better, but more convoluted: instead of just converting strings, it returns converted strings.
Guess which ended up in a real program I worked on…
- bunderbunder 12y agoCases like that are fairly straightforward. Where things really fall apart is using recursion instead of loops. Especially when the time comes to mention tail recursion.
- loup-vaillant 12y agoCase like that are straightforward, and people still manage to botch them. Which is why I suspect there is something deeply wrong, or at least fundamentally different, about the minds that produce such mistakes. Though for this particular mistake, it may have come from some misguided notion about performance (like perceived overhead of constructing a string then passing it up the stack). As for things like recursion and closures… I just avoid them because I know my colleagues will recoil in horror with such uselessly indecipherable excess of cleverness.