Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Why I don't use...

Why I don't use...

I'm numbering my arguments just to be able to reference them. Order does not reflect priority.

jQuery

  1. It's monolithic.

  2. It's huge, both in terms of complexity and in resulting file size.

  3. It has a dumb API: the only door to jQuery is a global jQuery (also aliased $) function. This means that very different use cases require the same API call, delegating the responsibility of detecting the desired use case to the function. This results in the jQuery function being unnecessarily complex and slow.

    Think for a second that you use the same function to perform many different things that you would otherwise be able to express at coding time, not run time:

    // Select a single element by its ID
    $("#header")
    
    // Select many elements by their class
    $(".sticky")
    
    // Parse HTML and create new elements
    $("<div>")
    
    // Wrap an existing DOM element, probably for doing things like attaching events
    $(<DOM element>)
    
    // A unique use case: wrapping document for later binding of the ready event.
    $(document)

Rails

  1. It's monolithic. Some elements can be taken out, with extra effort, but everything still depends on a huge monolithic dependency, ActiveSupport.

Usual replies

"But tool X is changing towards a more (modular|scalable|modern) approach"

Sure, but the practices that tool X encouraged for so long mean that:

  1. Adoption of the new, shiny version will either be very slow or never happen. Old applications and plugins won't work on the new version out of the box.

  2. The practices that tool X encouraged for so long created a mindset on developers which is very hard to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment