[erlang-questions] Strings - deprecated functions
Thu Nov 23 21:39:11 CET 2017
On 23 Nov 2017, 17:35 +0100, Joe Armstrong <erlang@REDACTED>, wrote:
> I agree 100%
> If you make major changes to a library module that been around for a very long
> time you will break a lot of old code.
> At a first cast
> It's OK to add new functions to the module
> It's ok to fix bugs in old functions with changing the names
> But it NOT ok to remove functions or change the semantics of existing
> non-buggy functions.
> It's not as if we'll run out of module names soon. Call the new module
> strungs_v1 strings_1 or better_strings or strings_improved or
> anything you feel like but
While this sounds great, I will argue that it's not very practical. The primary problem is that somebody has now to maintain both versions of the code. And there are situation when even old code needs to change - the particular case we're probably all agree with is when security issues are discovered. If the team (which we assume is of fixed size) spends their time maintaining old code, they don't spend time developing new features. Resources are unfortunately limited.
Another downside of keeping all old implementations is that it decreases readability of code. Code is read much more often than written and should be optimised for reading. But now, each time I see strings:tokens/1 and strings_v1:tokens/1 I need to decide if they actually do the same when reading the code. And I need to do this every time I read the code. The same distinction is needed during an upgrade, but it's needed only once.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions