Yesterday evening I had the privilege of attending a talk by Kyle Simpson about the Future Of Javascript. Kyle is a renowned author, teacher, and speaker. His works include the You Don't Know JS book series and Frontend Masters courses.
I committed my bugs to GitHub, checked out of my Star Wars themed tech play pin at Capital Factory, and mozied on over to the Google Fiber event space in downtown Austin – a really nice stage for talks like this if you haven’t been yet. We had free Topo Chico! I was happy.
Kyle opened his talk yesterday with a bit about the importance of communication. He talked about how we will never be as good at speaking in code as a computer, and will inherently always be better at communicating with other humans. Therefor, instead of focusing all our energy on code optimization, we should focus more on human communication (the worst fear of over a million computer geeks).
Then we covered a lot of ground when it comes to the latest and greatest in the JS/ES2017 world. I think the top three things I am eager to dive deeper into and experiment with are Rest/Spread Properties, Async Iteration, and Do Expressions.
I’ll try my best to stumble through my naive interpretation of these features, hopefully to the extent that you smarter people will be able to understand what I’m trying to say and giggle a bit.
Rest/Spread Properties
I find that many times I’ll try to re-use a function, but with each use case comes new parameters to pass in, and more complexity. It’s manageable, but can be cumbersome when faced with the task of managing all those properties on both function calls and function declarations.As Kyle explained, with the latest and greatest from ECMAScript, we can use rest/spread properties to solve this problem. Using spread expressions basically allows you to say: "if there's anything else I didn't account for, gather all those up into an object called ‘otherProps'".
Example:
Async Iteration
Say I’m in a conversation with some friends. One of them is telling me their story about their vacation to Thailand, and they say “let me show you some pictures!” They fumble through their phone to find them.If I was a JavaScript robot, I would now wait until I receive those photos before proceeding with the conversation. This is socially awkward, and not cool man.
Instead, it would be best to continue making small talk while my friend looks for the photos.
With Async Iteration, you can be a more socially adept robot by awaiting for data to come in while simultaneously yielding to send data out in same function.
Example:
Do Expressions
Kyle made a really great case for the new Do Expressions support. He explained that wherever JS expects a statement, you can also write an expression, however where JS expects an expression, you cannot write a statement. This makes some programmers cranky, and a do expression can fix that, plus help to clean up your code.Example:
If you’re interested in reading more about upcoming javascript functionality, checkout this list of ECMAScript proposals: http://github.com/tc39/proposals
Kyle closed his presentation with something that really hit home for me, was a huge wakeup call and an inspiration. I obviously would never put it as well as he did, but I did my best to jot down what he said:
He talked about how he understands that some folks feel overwhelmed about such a quickly changing ecosystem, and that it can feel like we don’t have the bandwidth to keep up with our work on top of learning all these new things. His answer: Don’t do that.
His point was simply, don’t try to understand all of it, just understand where all these things fit in to the big picture, and focus on the things that you think will really help YOU personally in your work. He suggests picking one thing on the long list of upcoming features and really deep dive into it. Bookmark the other stuff to skim over it later.
In addition to this, he was sure to teach what you’ve learned, and you will understand it better. Thus, here I am again.
Back when I was a cinematographer, I blogged on my spare time, both on a personal blog and http://www.scriptmag.com. I didn’t have a huge audience, but I found that it helped me to collect my thoughts into learning teaching points when reflecting on my previous projects. I learned more from my experiences even after it was over just by writing about it.
It took me too long to start this blogging habit back up, but I am thankful for Kyle’s inspiration to wipe the dust off that writer’s cap and get to work.
Happy coding y’all!