Comment

Comment by koolba

That was my take as well. It's like seeing code with the same constant inlined in multiple places rather than centralized:

    // Use some inlined string as a magic code value:
    doStuff("Some Magic Code");
    
    ...
    
    // Later on same inlined string:
    doOtherStuff("Some Magic Code");
versus:

    // Define it once:
    const GOOD_NAME_FOR_MAGIC_CODE = "Some Magic Code";
    
    // Use it:
    doStuff(GOOD_NAME_FOR_MAGIC_CODE);
    
    ...
    
    // Use it somewhere else:
    doOtherStuff(GOOD_NAME_FOR_MAGIC_CODE);
   
If that triggers an "ah-ha!" moment for you then you've likely got bigger problems.
parent koolba 9 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton