Survey – What is Your Favorite Language?
ConnectJS is coming soon. If you’re in the Atlanta area, definitely check it out. There’s a lot of big names involved with this conference.
Introduction to Flux – here’s the overview on Facebook
Learning Aurelia JS with Julie Lerman – excellent interview from the .NET Rocks podcast
We’re on SoundCloud!!!!
Answered an E-mail from Steven Lopes regarding global variables
ViewState is an example of the Memento Pattern – thanks to Wesley Bakker
Getting some love from people on Reddit and StackOverflow! Thanks to everyone who shares us everywhere.
Survey Results from the last episode…
Apparently a majority of people agreed with Allen and Joe – use a framework to kickstart what you’re trying to learn and pick up the other pieces as you go.
Listing of popular JS Libraries for Promises
|Bluebird – one of the fastest around – MIT||https://github.com/petkaantonov/bluebird|
|ES6 Promise Polyfill – MIT – utilizes subset of RSVP that is per ECMA 6 specs||https://github.com/jakearchibald/es6-promise|
|jQuery – MIT – non-standard promise type implementation||http://jquery.com/|
|kew – Apache 2.0 – optmized version of the Q library||https://github.com/Obvious/kew|
|lie – MIT – looks like it’s ES6 compliant and can be used in node||https://github.com/calvinmetcalf/lie|
|Q – MIT – Very popular – lite version in AngularJS||https://github.com/kriskowal/q|
|RSVP – MIT – works in the browser and node and is ES6 compliant plus some additional goodies||https://github.com/tildeio/rsvp.js|
What are they and why do they matter?
Allow for an easier way to handle asynchronous requests with a much cleaner approach to error handling.
Why is it so hot now?
Async requests are “thenable” – meaning you do asyncRequest.then(funcSuccess, funcError).then(funcSuccess, funcError) – you can just keep chaining asynchronous requests together.
Each promise has a few states. Pending, Fulfilled, Rejected
Each request has the ability to catch an error using the funcError shown above – if included, the funcSuccess will be skipped and the funcError will be executed if there was a problem.
Additionally, you can use a catch rathe than the option funcError – asyncRequest.then(funcSuccess).then(funcSuccess).catch(funcError)
Once executed, they always resolve to the same value – in other words, if you call the same promise twice, you will get back the same result and the async rquest only gets called ONCE! This is great for performance but could really mess you up if you weren’t aware of this.
The requests can’t be canceled and there is no progress indicator.
Promises in Other Languages?
C# has tasks
Java has futures/promises sort of
Scala and C++, Python, etc
“Tasks” are built in, “Promises” are more of a convention
Resources We Like
Tips for this Episode
Copy and Paste XML or JSON into Visual Studio and have it auto-generate classes to represent the data
1. Copy the XML or JSON
2. In Visual Studio 2012 & up, click the Edit menu, then Paste Special and choose XML as Classes or JSON as Classes
git grep -e ‘TEXT-TO-SEARCH-FOR’ $(git rev-list –all –max-count=500)
-e is necessary for strings that begin with a dash and should be used for scripts where input is passed to git grep.
Quoting the pattern string is optional, but a good practice.
–max-count is necessary if you get errors like “argument list too long” or “bad file number”. Both mean that the rev-list is too large.
Tip from Matthew Watkins:
Ability to assign macros to any keys you designate in Windows.