Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I really really like this take. Refactoring is usually pitched as something that is completely orthogonal to solving the actual problem you were given. I think too many of us (clearly, I'm projecting) are weary of anyone else going on a refactoring spree because we see it break down things that were just fine separate. Often with only "warm fuzzies" being the actual gain. The progression shown in this post is really really good.


Agreed. This is -- or should be -- called "premature refactoring."


I don't even think it's always premature refactoring. Sometimes it is just stupid refactoring.

A correlating result to stupid refactoring is the existence of over-generalized functions that try to do so much that they need an absolute crap-ton of parameters passed in and still end up locking you down to a limited set of functionality. Adobe's ColdFusion scripting language (anyone remember that) used to have functions that would automatically generate huge and specific pieces of client-side JavaScript functionality. Stuff to the effect of:

  cfCreateShoppingCartWithPopupSummaryWhenUserHoversOverLink({
    supportsPaypal: true,
    dontShowLinkOnCategoryPage: true,
    doShowLinkOnProducePage: false, ...},
    'myShoppingCartElement',
    ...)
Okay maybe I'm embellishing a little bit. But the end result was loading hundreds of kilobytes of proprietary JavaScript libraries to support these weird built-in functions that would create very specific bits of client-side functionality that would then need a billion parameters passed in to allow remotely useful customization. Maybe it would have been better to just learn JavaScript instead of being locked in this way.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: