News for hackers. Stuff that matters.
Re:In Defense of Copy and Paste by rubbingalcohol on Friday February 08, 2013 @02:58PM (#5189782)
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.

There are no comments on this comment yet.