4 ms·
It's hilarious that you say bundling+compression+minification is "obsolete" and your suggested better way is "stop using HTTP, load from a filesystem." You had
by ClayFerguson 10y ago
It's hilarious that you say bundling+compression+minification is "obsolete" and your suggested better way is "stop using HTTP, load from a filesystem." You had to bend over backwards THAT ridiculously far to try and find a fault with it. The technique 99.999% of the world is moving to. so funny. And saying that JQuery's namespace ($) is a "big global variable", and therefore you hate it, will be something i'll be telling buddies about for years to come.
- WorldMaker 10y agoAll I can suggest is you try rereading my comments with an open mind. I did not say bundling+compression+minification is "obsolete", I said things had shifted in how front-end development uses those things as tools in their toolbelt. It's a very different world these days in JS and lot of "must" best practices became "when needed" best practices. All I was trying to point out was that you don't start with bundling+minification+compression, you pull in those tools as and if you need them. As for JQuery, I'm not the only engineer that sees it as a problem. It's the second sentence of the Wikipedia article summary on the Singleton pattern, for instance: « There are some who are critical of the singleton pattern and consider it to be an anti-pattern in that it is frequently used in scenarios where it is not beneficial, introduces unnecessary restrictions in situations where a sole instance of a class is not actually required, and introduces global state into an application. » -- https://en.wikipedia.org/wiki/Singleton_pattern https://en.wikipedia.org/wiki/Singleton_pattern Google for "Singleton anti pattern" for many pages of articles on the subject, if you care.
- ClayFerguson 10y ago1) Bundling: Glad you're backing off your anti-bundling position. Good move. 2) JQuery: Any JS library is better when it adds only a single variable to global scope. JQuery uses $. My app uses 'm64'. Anyway what is the better DOM-manipulation API I should be using? Do tell. It has to be an actual competitor to JQuery (i.e. lightweight pure JS library with same DOM capabilities.) 3) Singletons: I use Spring Beans on the server side to be sure I have singletons 'correct', and I use TypeScript namespaces on the browser side. The most common way people screw up singletons is related to the instantiation issues, and circular-references. By using Spring @Component and TypeScript namespaces, I avoid the exact issues you are concerned about. Based on my architecture it's literally IMPOSSIBLE to encounter those issues even if I tried.
- Kiro 10y agoNo-one has argued against bundling. You keep misreading all the comments, adding "bet you didn't know that" to the most obvious things in the world. Why is that? > Any JS library is better when it adds only a single variable to global scope. No, this is how you use jQuery in 2017: import $ from "jquery"; Simple as that. Just stop using global variables.
- ClayFerguson 10y agoBecause of the naming convention i'm using for namespaces, if I ever decide to convert to modules, adding the import statements will be straightforward and nothing will even be renamed. The namespaces would simply 'become' modules, without any editing of the implementation. This was not an accident. I designed it that way.
- Kiro 10y agoAlright. It sounds like something you should add to your TODO. What are your thoughts on for example React, Vue or Angular? Any reason you didn't go that route instead?
- ClayFerguson 10y agoI already had modules on my TODO list, implemented it, didn't like it, took it back out, and converted to TS namespaces. I have been waiting for React to emerge as a clear winner before using it. I only use libraries, APIs, languages, databases, etc. that I've concluded will still be around 10yrs into the future. I don't like Angular, and don't know Vue. If React doesn't replicate some future plans Google has for Polymer ecosystem i might try it.