Live data from Hacker News

How it feels to learn JavaScript in 2017

medium.com

61–70 of 167 posts

Re: How it feels to learn JavaScript in 2017

#61
post #10

Earlier quoted context omitted.

Cool story of what you've been able to do by investing in modern web technologies like Mithril. The part where you say a lot of people are terrified of heir skillset becoming obsolete -- I'm not sure I see that in web developers. Everybody I talk to is happy that their knowledge is now obsolete of which array methods don't work in IE8, for example. Possibly a lot of the backlash against JS comes from conversations th…

Agree: for me it's nothing to do with fundamental obsolescence. JS as a language is doing fine and I welcome the new additions in the various ECMA standards. What I'm not so welcoming of is, for example, the Angular 1.x -> Angular 2, 4, whatever transition. I don't want to have to keep thrashing my projects due to incompatible upgrades. And I'm tired of the hype cycles. Not so very long ago everyone and their dog was…

The easy way to avoid hype cycles is to just ignore the thing being hyped for a few years. I don't know the exact value of a few; five should be enough to clearly tell whether a fad is a failure but you might miss too many new things that are actually novel that way.

Re: How it feels to learn JavaScript in 2017

#63
post #52

It can be a pain getting the build system up and running but once you're writing typed JavaScript code with modern features like async/wait and ES6 modules along with live + hot reloading, it's impossible to go back. It's really trendy to complain about JavaScript changing too fast right now but the last few years have brought some great changes to JavaScript.

A language without a proper stdlib and with programmers who have no idea what the O notation is about has no place in any serious programmer's "to learn" list.

Aka "javascript is not a real language", I thought we were done with that since almost a decade :)

Maybe you should consider that just because a language doesn't work like what you're used to, it doesn't mean it's a bad language. Because saying nowadays that javascript is not worth learning sounds pretty absurd. Sure, you can live without it. But that's probably the most useful language to know as a "second language", for all its various applications and because when you want to add scripting in your tool, you know javascript is a solid choice for its penetration rate.

Re: How it feels to learn JavaScript in 2017

#64
post #62

It's too bad they don't address state management. Right now it's just showing how to bootstrap a static app without state changes. How do you even update your data in Mithril?

Static? That's half true.

  let planets;
  let planetFilter = planet => true;
The planets variable is static in this example, but planetFilter changes. The "Voila, it works" link near the bottom of the essay leads to a live demo: https://brlewis.github.io/2017/planets.html

Was there a particular aspect of state management you want to hear more about? I'm thinking of a follow-on post. Not sure whether the next one should be state or build system.

Re: How it feels to learn JavaScript in 2017

#65
post #62

It's too bad they don't address state management. Right now it's just showing how to bootstrap a static app without state changes. How do you even update your data in Mithril?

Mithril does a global diff, so if the data used in your view functions has changed the view will be updated..

Re: How it feels to learn JavaScript in 2017

#66

Earlier quoted context omitted.

I agree with the GP with regard to Angular4. But have you really tried to create a modal in HTML/CSS/JS without any framework? It's surely not one line of code!

OK, so it's a dozen. https://stackoverflow.com/questions/25920941/how-do-i-overla... Didn't say not to use a framework. Use it and some CSS and that's a basic task, not to mention there are other libraries which do it for you already.

Does that work in several versions of different rendering engines that date back a decade, at resolutions from 800x600 to an iMac 5K screen? How about on tablet and mobile devices? What happens when the user's scroll position is half way down the page? Does it listen for events to update or close itself?

A good modal library is going to weigh in at a few thousand lines of code across JS, CSS and HTML for a reason. If you have a simpler use case then you don't need all that extra edge case handling, but that doesn't mean it's not pointless code.

Re: How it feels to learn JavaScript in 2017

#67
post #64
post #62

It's too bad they don't address state management. Right now it's just showing how to bootstrap a static app without state changes. How do you even update your data in Mithril?

Static? That's half true. let planets; let planetFilter = planet => true; The planets variable is static in this example, but planetFilter changes. The "Voila, it works" link near the bottom of the essay leads to a live demo: https://brlewis.github.io/2017/planets.html Was there a particular aspect of state management you want to hear more about? I'm thinking of a follow-on post. Not sure whether the next one should…

Oh, you're right. The state management was so subtle that it actually didn't click when I read it. I don't understand how it knows to rerender though? From what I can tell you're just setting the variable planetFilter and that's it, while with React you would have to do a setState to register it.

Re: How it feels to learn JavaScript in 2017

#68
post #62

It's too bad they don't address state management. Right now it's just showing how to bootstrap a static app without state changes. How do you even update your data in Mithril?

Mithril does a global diff, so if the data used in your view functions has changed the view will be updated..

What triggers these global diffs?

Re: How it feels to learn JavaScript in 2017

#69
post #17

We have recently implemented Angular4 in our project, and have started to pick it up. Recently picked up a story that was adding a simple confirmation modal to a page: "Alert" text in the top, body with some warning text, and a yes/no button. This was my first experience with modern JavaScript frameworks and TypeScript. I wanted to do it right, so worked closely with team members who were more versed in this stuff, a…

I've been doing heavy javascript interfacing since the end of the 2000' (it was still a rare skill back then, and made me good freelance money), and I totally understand how you feel.

I experienced the same thing when learning angular, flux and redux. It all screamed "overengineering" to me. But then I realized why it was that way, and why it had to be : you now have teams of like 50 js developers working on the same codebase. They have to have very strict and complex architecture, because their frontend codebase is just as big, if not more, than their backend codebase.

Those tools still lack alternatives for small to middle sized teams and products, IMO. React by itself is super cool to be quickly productive in that scope, but state management systems are not. For that reason, I made my own flux library, meant to keep things conceptually simple. The flux pattern by itself (data always propagating in a single direction) is not complicated, its implementations are. I would recommend that small teams working on small products take time to get the flux idea, then make their own implementation, it's worth it.

EDIT : to be more specific, here is a simple thing to do to make your own implementation:

1. build something (let's call it a store) with a `subscribe(func)` method allowing to be notified when data changed

2. add a public api to that store (`like store.addArticle(article_data)`)

3. in the `componentDidMount()` method of your root component, subscribe to store with a function that calls `setState()` on your component, then pass data as props to child components

4. when triggering an action, like clicking a button, call a method from the public api of your store

5. you now have a state manager ensuring data always flows in the same direction, and you can make your store implementation as simple or as complex as you want

Re: How it feels to learn JavaScript in 2017

#70
post #66

Earlier quoted context omitted.

OK, so it's a dozen. https://stackoverflow.com/questions/25920941/how-do-i-overla... Didn't say not to use a framework. Use it and some CSS and that's a basic task, not to mention there are other libraries which do it for you already.

Does that work in several versions of different rendering engines that date back a decade, at resolutions from 800x600 to an iMac 5K screen? How about on tablet and mobile devices? What happens when the user's scroll position is half way down the page? Does it listen for events to update or close itself? A good modal library is going to weigh in at a few thousand lines of code across JS, CSS and HTML for a reason. If…

What's the likelihood that he's supporting engines going back a decade? Modern rendering engines and CSS handle that pretty well. IE 8 is 8 years old. Bootstrap 3 supports IE 8 and has modals.

Point being, you can either write up a simple modal if you are targeting semi-modern browsers and don't need much, or you can use one of a dozen libraries that do this, but 27 files sounds pathological.

Post reply on HN