Posts

Showing posts with the label refactoring

The Perils of Refactoring Typos

Image
/via http://www.commitstrip.com/en/2018/11/26/if-its-not-broken/ Funny cartoon, but the whole " Don’t refactor  craetionDtae ”, thing is a bit far-fetched, right You’d probably fix that typo without thinking twice about it, right? Wellllll, maybe not. After all, this might actually be something that is exposed to users (it’s in the API. Yay), so you need to refactor this  and  the documentation, but that’s OK, you can do that, right? Wellllll, maybe not. Because, now that you look, you notice that you’ve got  two  sets of typos,  craetionDtae  and  craetionDate , which means that refactoring means that you need to update  both  of these in the code  and  the docs, so now it’s  4  things that need to be changed, but it’s ok, you’ve got that, you can do it, right? Wellllll, maybe not. Because, now that you really look, you realize that  craetionDate  also exists as  craetionDates  (becaus...

Erlang - Why so many (seemingly identical) tools?

Image
Ever wondered why many of the erlang modules provide seemingly similar functionality (" functionality". ho ho ho ) using different functions? Why there are so many tools that seemingly do pretty much the same thing? Consider that you could just use lists :map / 2 instead of lists :foreach / 2 , and ignore the result if all you cared about were side-effects.  e.g. lists:foreach(fun(X) -> do_something_to_a_file_named_(X) end, [a,b,c]) could just as easily be done as _Ignore = lists:map(fun(X) -> do_something_to_a_file_named_(X) end, [a,b,c]) Yeah, yeah. I know. Its stupid.  But you could do it, no?  Come to think of it, I'd bet that any number of people are actually doing it even as we speak - given that its not actually wrong , y'know?  It doesn't stop there - consider the following in the lists module     ⁃    lists : sum / 1 could just as easily be done using just a wee bit more code using lists :foldl / 3  ...