3
Nexion
8y

No matter how many times I have to rewrite functional code, no one will ever convince me that dynamically creating JavaScript with data binding templating languages is a good idea (JSP, php, etc)

Comments
  • 0
    I actually did some reading on this and while I agree with you in most cases, on major websites like Netflix, it's a great idea, because it allows for modular a/b testing with the public to ensure everything works before adding it to the codebase. It also allows for smaller file sizes and smaller, easier-to-manage modules.
  • 0
    You should return different views for a/b testing. Each view would have its own JavaScript associated to it, not adding JavaScript based on values from your controller. What I'm talking about is like adding event handlers with JSP for loops and stuff.
  • 0
    @Nexion oh, yeah that sounds like more trouble than it's worth. I'd personally just type it manually or take a shortcut with something like

    var elements=[".class1","#id1","h1",...];
    for (var i=0;i<elements.length;i++) {
    document.querySelector(elements[i]).addEventListener("someEvent",someFunction);
    }
Add Comment