This is how it feels to learn Javascript in 2016
-
@Arantor said in This is how it feels to learn Javascript in 2016:
@Rhywden said in This is how it feels to learn Javascript in 2016:
This particular add-on is easily documented, easily understood and even makes understanding the purpose of the code easier for me.
FTFY
If you're layering multiple paradigms and libraries/frameworks together at once, it can bite you in unexpected ways and as any fule kno, there's nothing more permanent than temporary: just because only you will maintain this now doesn't mean it still won't be in use after you leave whereupon someone else will have to maintain it. And will likely as not curse you for it.
Since I know exactly what it does, I still don't see the reason for those handwringing proclamations of doom you guys insist on shouting at the top of your lungs.
Again, it's documented and easy to understand. Plus, the fallback to the "pure code" which @cartman82 praises to the heavens still works as well.
I think you've become so jaded that you're now inisting on immediately damning each new idea.
-
@Rhywden said in This is how it feels to learn Javascript in 2016:
it's documented and easy to understand
Then show us the code and the docs.
-
@Rhywden said in This is how it feels to learn Javascript in 2016:
I think you've become so jaded that you're now inisting on immediately damning each new idea.
It saves a lot of time!
-
@Rhywden said in This is how it feels to learn Javascript in 2016:
Yes, and that I'm "fighting" those conventions, for that we only have your word.
We just read your posts telling us about your fighting.
-
@Rhywden Uh... yeah, let's go with that. Let's assume that that is actually my problem as opposed to the actual criticism I have of multiple different libraries and frameworks and paradigms colliding and then having to wade through all of them to figure out which one is stomping on the other's territory, usually because of someone writing 'clever and easy to understand code'.
But sure, let's just assume the rest of us are all jaded fuckwits who can't possibly ever see another's perspective. I begin to understand Lucas' attitude, which is frankly a horrifying prospect for me.
-
@Arantor Again, this is not for a huge company where someone else then has to support the code.
This is solely something written and maintained by me. And I was able to understand the code in 5 seconds.
I'm not sure what should prohibit me from understanding the code in this time at a later date.
This is not "line-noise Perl code" we're talking about here.
And, again, all the alternative coding styles still work. So it's clearly not "stomping on anything".
-
@cartman82 said in This is how it feels to learn Javascript in 2016:
"I AM AN ARTISTE, CARTMAN! HISTORY WILL CHERISH MY BRILLIANCE! MY CODE WILL LIVE FOREVER!"
You must be the most minmaxed INT over WIS type of person I've ever seen. I don't know how old you are, but for your sake, I hope you're under 25.
Almost certainly. He has not yet learned that 3 years from now, code you wrote 3 years ago can be considered "other people's code" for any value of "now" or any current age.
-
@Arantor said in This is how it feels to learn Javascript in 2016:
I begin to understand Lucas' attitude,
You should have a drink to celebrate that enlightenment ... Maybe even more then one
-
@Luhmann said in This is how it feels to learn Javascript in 2016:
@Arantor said in This is how it feels to learn Javascript in 2016:
I begin to understand Lucas' attitude,
You should have a drink to celebrate that enlightenment ... Maybe even more then one
Have a drink. Have more drinks. Then have one more drink.
-
@Dragnslcr Yes, that's about how you get lucas-drunk :D I see no grammar issues whatsoever
-
@masonwheeler said in This is how it feels to learn Javascript in 2016:
@cartman82 said in This is how it feels to learn Javascript in 2016:
"I AM AN ARTISTE, CARTMAN! HISTORY WILL CHERISH MY BRILLIANCE! MY CODE WILL LIVE FOREVER!"
You must be the most minmaxed INT over WIS type of person I've ever seen. I don't know how old you are, but for your sake, I hope you're under 25.
Almost certainly. He has not yet learned that 3 years from now, code you wrote 3 years ago can be considered "other people's code" for any value of "now" or any current age.
In which case it doesn't matter what language or framework I choose...
-
@Rhywden No, in which case you should pick the language and/or framework that it's easiest to pick up a complete stranger's code and understand it.
-
The big choice of libraries, without clear indication of what exactly they do, is indeed demotivating.
But I assume that once one has chosen their libraries, it should be much easier to follow the documentation then?I don't do any serious web-dev myself but for many other fields of programming like numerics, GUI, games I have known tools that work well and don't need to reevaluate all other available software unless there is a big change in how this kind of task is being accomplished.
-
@Adynathos said in This is how it feels to learn Javascript in 2016:
But I assume that once one has chosen their libraries, it should be much easier to follow the documentation then?
Provided the documentation is there and is of decent quality. And that the given framework doesn't bend Javascript over so badly that no amount of documentation will help you, since at that point you're writing in a different language. And that in a year all those libraries are still there and maintained, instead of being "soo 2016".
-
@Adynathos said in This is how it feels to learn Javascript in 2016:
without clear indication of what exactly they do,
I think the problem is they all try to do a little bit of everything.
-
@anonymous234 said in This is how it feels to learn Javascript in 2016:
@Adynathos said in This is how it feels to learn Javascript in 2016:
without clear indication of what exactly they do,
I think the problem is they all try to do a little bit of everything.
Or, more precisely, instead of building up on top of the industry standards and enhancing them, easing the transition between one framework and another, each JS framework just says "fuck it, we're gonna start from scratch and do everything better". And all your knowledge becomes obsolete.
-
@Yamikuronue said in This is how it feels to learn Javascript in 2016:
@Rhywden No, in which case you should pick the language and/or framework that it's easiest to pick up a complete stranger's code and understand it.
Funnily enough, what I'm talking about does make it easier to pick up and understand.
Hence my confusion why some people are loudly proclaiming Doom and Gloom.
-
@Maciejasjmj said in This is how it feels to learn Javascript in 2016:
since at that point you're writing in a different language
I hope that will be possible soon with web-assembly :)
@Maciejasjmj said in This is how it feels to learn Javascript in 2016:
building up on top of the industry standards
That is why I find the Polymer library promising. Currently its mostly running on JS but they are trying to get browsers to implement web-components natively. It is already done in Chromium and that works visibly faster than the JS version.
Of course there might be various other problems with this lib, but thats not my area of expertise.
-
@Adynathos said in This is how it feels to learn Javascript in 2016:
I hope that will be possible soon with web-assembly
Anything that isn't Javascript, FFS. Could you imagine that in the native world? You have Java, C#, C++, functional languages like Haskell, oddballs like Prolog, whatever Apple is putting out now... and they all compile down to some ancient version of COBOL.
That's how webdev currently works. You take a totally unsuited, weakly typed, not too performant scripting language and twist and bend it into a lingua franca of the web. It's ridiculous, and I hope our children will laugh at us for putting up with it.
-
@Rhywden said in This is how it feels to learn Javascript in 2016:
Just two days ago I argued with a developer whose plugin for Babel is supposed to make one-way and two-way bindings easy in React
that's the original claim, right? The suspicion is that in three years you won't remember how React itself works, so building your tower on firm foundations is better than shoring it up later.
Also: fuck Babel. I keep forking repositories and finding the code that is running bears no relation to the source and I can't fix the bug I found.
-
@Yamikuronue said in This is how it feels to learn Javascript in 2016:
@Rhywden said in This is how it feels to learn Javascript in 2016:
Just two days ago I argued with a developer whose plugin for Babel is supposed to make one-way and two-way bindings easy in React
that's the original claim, right? The suspicion is that in three years you won't remember how React itself works, so building your tower on firm foundations is better than shoring it up later.
Also: fuck Babel. I keep forking repositories and finding the code that is running bears no relation to the source and I can't fix the bug I found.
If I forget how to do React then I've also forgotten how to use HTML.
-
@Rhywden If you say so.
-
@Yamikuronue said in This is how it feels to learn Javascript in 2016:
I keep forking repositories and finding the code that is running bears
If your dependencies are trying to run bears, it's time to move to a different stack...
no relation
...oh. But with Javascript, I wouldn't be too surprised.
-
@Yamikuronue said in This is how it feels to learn Javascript in 2016:
@Rhywden If you say so.
I'd really like for people stop assuming that just because their minds work in a certain way that others people's minds (and their memory) work in the same manner.
-
@Rhywden If you've honestly never had the experience of having to re-load a bunch of little quirks and foibles into working memory that once felt obvious to you, I don't have much to say.
-
@Yamikuronue If it was a complicated bunch of stuff, then, maybe.
React isn't rocket science, though. At least for me.
-
@Rhywden It doesn't have to be complicated, just annoying as fuck
-
@Maciejasjmj That is indeed a very sad situation.
On the other hand, according to a very optimistic view expressed here, JS / asm.js / web-assembly could become the new high level assembler with better sandboxing and even replace the kernel/user-space switching.
-
@Yamikuronue Again, you're drawing conclusions from your own condition to mine.
-
@Adynathos said in This is how it feels to learn Javascript in 2016:
That is why I find the Polymer library promising.
Has it got both traction in adoption and a commitment to keeping the API stable for a long time? Because fuck these flash-in-the-pan JS libs. Some hipster fuckers might have time to spend their lives chasing after ever-changing code done by people who have nothing better to do than break everything for shits and giggles, but I for one have other things to do as well.
I hate browser makers. I hate people who make incompatible changes in minor releases. I hate people who think that pushing code to github is publishing.
-
@Rhywden said in This is how it feels to learn Javascript in 2016:
@Yamikuronue Again, you're drawing conclusions from your own condition to mine.
Yes, that's called "wisdom." The basic idea here is that people are more similar than they are different, and those who have experience in something frequently understand principles that are applicable to others in similar situations.
-
@Maciejasjmj said in This is how it feels to learn Javascript in 2016:
Could you imagine that in the native world? You have Java, C#, C++, functional languages like Haskell, oddballs like Prolog, whatever Apple is putting out now... and they all compile down to some ancient version of COBOL.
I can totally 100% imagine this being true, because it's true in many other places. Like we still use the ancient x86 design, the ancient C language, the really ancient ASCII standard, the ancient SMTP standard... only with lots of extensions on top.
-
@dkf said in This is how it feels to learn Javascript in 2016:
@anotherusername said in This is how it feels to learn Javascript in 2016:
Look, if you want someone to blame, blame the W3C and their DOM specs; for NodeList objects, they only identify the property length and the method item. If you want it to have array-like methods, you have to properly cast it into an array.
I blame lots of developers for looking at that spec and not implementing it with an array (except in a few languages like C). Yes, it doesn't say it, but it's what anyone sane would do, given that the DOM is really a language-independent specification. Lots of my fellow developers are not sane, and have the common sense of a woodlouse. The fact that an array isn't called a
NodeList
at the type level isn't a big deal; you weren't going to copy that C# code byte-for-byte over into C++ anyway.And how would you implement a live
NodeList
as an array?node.childNodes
is a liveNodeList
-- changes to the node's descendants affect any reference to thatNodeList
object in real time.
-
@anotherusername I wouldn't. I loathe weird action-at-a-distance behaviours in APIs. Those sorts of things look good at the time, but are the source of ever so many evil bugs.
-
@dkf well, then, blame the W3C for that, too.
-
@anotherusername said in This is how it feels to learn Javascript in 2016:
@dkf well, then, blame the W3C for that, too.
So I think we've all agreed on the conclusion that the web is a shit, we just need to decide on whose fault it is
-
@anotherusername I do blame them. (I've even got a colleague who's done W3C work, and he's definitely a wrecker and should be blamed. He breaks things by just existing in the same room with them...)
-
@masonwheeler said in This is how it feels to learn Javascript in 2016:
@Rhywden said in This is how it feels to learn Javascript in 2016:
@Yamikuronue Again, you're drawing conclusions from your own condition to mine.
Yes, that's called "wisdom." The basic idea here is that people are more similar than they are different, and those who have experience in something frequently understand principles that are applicable to others in similar situations.
Is that something like "common sense" which is frequently wrong?
-
@masonwheeler said in This is how it feels to learn Javascript in 2016:
Yes, that's called "wisdom." The basic idea here is that people are more similar than they are different, and those who have experience in something frequently understand principles that are applicable to others in similar situations.
Is it also wisdom to keep telling someone he’s Doing It Wrong when he keeps countering with arguments for why he’s doing it the way he is? Maybe the greater wisdom at that point is to wait and see what happens — if he falls on his face, say “Told you so” but if he doesn’t, say “Guess you were right after all.”
-
@Gurth said in This is how it feels to learn Javascript in 2016:
Maybe the greater wisdom at that point is to wait and see what happens
Pretty much.
-
@Gurth said in This is how it feels to learn Javascript in 2016:
Is it also wisdom to keep telling someone he’s Doing It Wrong when he keeps countering with arguments for why he’s doing it the way he is?
When his argument is "this is the way it's done in a huge, horrible, hard-to-understand XML-and-Reflection-based tarpit of a mess in a language that works nothing like JavaScript anyway," then yes.
-
@masonwheeler It's the experience...
-
@cark said in This is how it feels to learn Javascript in 2016:
@anotherusername said in This is how it feels to learn Javascript in 2016:
@coderpatsy said in This is how it feels to learn Javascript in 2016:
Wouldn't be so bad if NodeLists/wtf you call the DOM's arraylikes actually implemented .forEach and friends...
With the spread operator it's pretty easy.
[...document.querySelectorAll('p')].forEach(...)
And if you need to support shitty, ancient browsers like IE11, then
slice
is the easiest way to hack it.Or use the for...in loop, which looks much clearer (and works almost wherever the spread operator works)
With the added gotcha that asynchronous callbacks can't use the loop variable because it changes.
[...document.querySelectorAll('abbr')].forEach(element => { element.addEventListener('click', event => { alert(element.getAttribute('title')); }); });
works. The equivalent will not work using
for ... in
unless you do some special wrangling to keep a reference toelement
that doesn't change.And yeah, I realize that in that example you could probably use
event.target
instead, so it isn't a perfect example, but it's the simplest example I could come up with to demonstrate the issue.
-
@dkf said in This is how it feels to learn Javascript in 2016:
@Adynathos said in This is how it feels to learn Javascript in 2016:
That is why I find the Polymer library promising.
Has it got both traction in adoption and a commitment to keeping the API stable for a long time? Because fuck these flash-in-the-pan JS libs. Some hipster fuckers might have time to spend their lives chasing after ever-changing code done by people who have nothing better to do than break everything for shits and giggles, but I for one have other things to do as well.
I hate browser makers. I hate people who make incompatible changes in minor releases. I hate people who think that pushing code to github is publishing.
-
@cark said in This is how it feels to learn Javascript in 2016:
Or use the for...in loop, which looks much clearer (and works almost wherever the spread operator works)
Yes let's use enumeration where we want iteration. That's shirley a well designed language.
-
@Dragnslcr said in This is how it feels to learn Javascript in 2016:
Then have one more drink.
Then post your JavaScript theories on TDWTF.
Thanks in advance.
-
@coderpatsy Is there a difference?
-
@anotherusername Honestly not much practically, unless someone is elsewhere in your codebase.
-
@coderpatsy the only thing that jumped out at me was that in some languages, one of them isn't thread-safe. But Javascript doesn't have to deal with that, since it doesn't allow multiple threads to share memory.
-
@anotherusername
For a more in-depth explanation, consider withvar arr = [1, 2, 3];
:arr.forEach(function (val, i) { console.log(i, typeof i, val); });
and
for (var i = 0; i < arr.length; i++) { console.log(i, typeof i, arr[i]); }
each log the same thing- 0, "number", 1 etc.
for (var i in arr) { console.log(i, typeof i, arr[j]); }
Logs "0", "string", 1 etc.
But if someone went
Array.prototype.someProperty = "someValue";
orarr.key = "I yam a string";
without monkeying with accessors, then the for in loop will enumerate and log those as well.