Re:It Takes 6 Days to Change 1 Line of Code (2015)
by serge2k on Tuesday December 06, 2016 @08:33PM
(#13119827)
It's also easier to refactor code without magic constants, as you have compile time bugs mispelling kNaverUrl instead of runtime bugs because "ww.naver.com" in one of 10 places.
[ Parent
| on HN ]
Re:It Takes 6 Days to Change 1 Line of Code (2015)
by yongjik on Tuesday December 06, 2016 @08:51PM
(#13119890)
You have a point, but on the other hand, it is much easier to write (kNaverUrl + "index.html") than to write "www.naver.comindex.html". So it just opens door for a different kind of bugs.
Re:It Takes 6 Days to Change 1 Line of Code (2015)
by zepolen on Tuesday December 06, 2016 @09:05PM
(#13119943)
Then it becomes a function:
kNaverUrl('index.html')
Multiple functions: kNaverWwwUrl('index.html')
kNaverApiUrl('resource')
Then it get's refactored: urlGenerator('www.naver.com')('index.html')
urlGenerator('api.naver.com')('resource')
Refactored even more: urlFor('naver_www', 'index.html')
urlFor('naver_api', 'resource')
Even more! urlGeneratorFactoryFactory(.......