4 ms·
> JavaScript became popular because of the browser That is a very popular perspective. In the past I have seen this sentiment used heavily by people who hate J
by austincheney 5y ago
> JavaScript became popular because of the browser
That is a very popular perspective. In the past I have seen this sentiment used heavily by people who hate JavaScript as a means to rationalize how JavaScript could have become popular at all.
Unfortunately this sentiment is disqualified by data.
The browser became a popular platform in the late 90s and early 2000s as business and social interest on the web grew. JavaScript has been around cross-platform in a mostly consistent way since 1998 due to the publication of early current standards.
This did not make JavaScript popular though. JavaScript would not become popular for more than a decade later.
In 2008 a couple of things happened. Chrome launched offering the first JavaScript JIT. Before this JavaScript was hundreds of times slower than it is now. Also, jQuery started gaining popularity at this time which allowed employers to hire any dumbass off the street to write in it. Douglas Crockford also heavily evangelized the language for its expensive capabilities: functions as first class citizens, optional OOP (easily ignored/bypassed), native lexical scope.
A little after that around 2009/2010 Node.js launched and GitHub became common knowledge. It’s about this time that JavaScript exploded in popularity. The web was already popular for more than a decade before this.
> Functional programming is less popular because no major successful platform has adopted a functional language as the preferred language.
I would argue functional programming is incredibly popular but less common in the workplace because OOP conventions are what’s taught at school.
- antris 5y ago> I would argue functional programming is incredibly popular but less common in the workplace It would help if someone defined what constitutes "using functional programming". I mean, this is functional programming: function add(a, b) { return a + b } From my experience, every developer does functional programming to a certain extent, it's just the extent that varies.
- iainmerrick 5y agoYes, that's functional programming! I think you're right to say that many programmers use FP much of the time. The modern trend is definitely to borrow many FP techniques and use them inside an imperative shell. Your example is strict FP, where a and b are fully evaluated before add() executes. There's also non-strict FP, where everything uses lazy evaluation by default. That has some big advantages but also a few pitfalls, and generally makes things significantly weirder when compared to imperative languages. Pure FP is where you only have functions and expressions, no variables at all. I think that's where most mainstream programmers draw the line -- sometimes you just want to store something somewhere, without being forced to jump through what seem like weird hoops. The original elevator pitch for Haskell was that it's a "non-strict, purely functional" language (aimed a unifying a bunch of different research languages, plus the proprietary language Miranda).
- hasmanean 5y agoFunctions were invented by functional languages…but they originally were a lot more flexible than the way most procedural languages use them now. Let’s try rewriting your example this way add = function(a,b) { + a b } Why is this better? Because + is a function, and add is an object, so you can then refactor the code to say this add = + Try doing that in C. As I see it the code for some programs has a high degree of symmetry (ie repeated patterns), and the best language is a notation the let’s you capture that the best. If you find yourself cutting, pasting and modifying things slightly each time, then your language is holding you back. Test-script code is the best example of this…particularly hardware tests. You have the same code copied and pasted dozens of hundreds of times. Thoreau once said that government is best that governs least. That language is best that makes you type the least.
- kaba0 5y ago> add = + > Try doing that in C. Function pointers. They are abused to no avail in C programs. It has the original callback hell, not JS. (And that is mainly because C has no proper way for abstractions)
- zone411 5y agoThis shows JavaScript as being popular since at least 2004 (beginning of the dataset) https://trends.google.com/trends/explore?date=all&q=javascript,jquery,ajax,Node.js https://trends.google.com/trends/explore?date=all&q=javascri... and this is closer to my recollection.
- juki 5y ago> Unfortunately this sentiment is disqualified by data. Your comment seems to support, rather than disprove, the claim. JS was around for years without much success before the browser became a popular platform for applications. People used to only write applications for the server or for platforms like Java and Flash that were just embedded as plugins in the browser. They only started using JS after improvements to browsers made it a better platform than the alternatives.
- kryptiskt 5y agoJavascript became mainstream with the Web 2.0/AJAX hype of 2004. It was still Google's "fault", but it was the slick Google Maps site (and also GMail) and not Chrome that was the inciting factor. With an assist from Microsoft's Web Outlook and XMLHttpRequest. Really, the reason Chrome invested heavily in optimizing Javascript was because it had started to be widely used in more than trivial scripts.