8:51am: I started a little late today and spent a little extra time fixing up yesterday’s blog post, but I think it’s worth it to take an extra 15 minutes to review what I did yesterday and write down a list of the questions, ideas, and new bits of information generated from yesterday’s adventures! Anyway, today I have plenty to do and I’m excited to work on it all! But first, a couple quick administrative tasks. Then I’ll work on the next homework challenge(s) for the UnBootcamp students.
9:20am: I got caught up with answering a few messages, and I even signed up for a Yelp account – yet another social network to keep track of now, ugh! Haha. I also found some random links that look interesting, so I’ll throw them in here before I forget:
Some interesting links to check out later:
- Authenticate a Node.js API with JSON Web Tokens (shared with me by a friend from last night’s meetup)
- Debugging Node.js with Google Chrome
OK, next I need to work on today’s homework challenge. I should also make plans for the next batch of the UnBootcamp for July and August, because if I want to bring more beginners on board, I better do it soon!
9:40am: Got distracted. Also just noticed that my experiment with Cloudflare last night seems to have broken my website, haha. Asking for help on our Slack chatroom. I’ve never seen this
ERR_SSL_VERSION_OR_CIPHER_MISMATCH error before, so looking it up now… Well, it might just be because the new SSL certificate hasn’t had enough time to get verified yet, according to this Cloudflare support page. I’ll just try it again later. Nobody really uses our website anyway, haha.
10:17am: Took a break and then talked to a couple new people and then went downstairs to chat with some more people and then I just saw I got a message from a friend online with some advice on the Cloudflare issue! I love having smart friends. I’m going to take a look at the links and screenshots he sent me. Maybe I can fix the issue right now. OK, it’s what I thought: the SSL certificate is still being verified, that’s all! I’ll check it later.
10:41am: Distracted this morning, very distracted! I answered some more emails and messages and also took a look at the recent cryptocurrency crash. I definitely want to buy some Bitcoin and/or Ether, but Coinbase never lets me sign up! lol. I’ll try it again later tonight.
11:14am: Just finished a detailed code review for one student who submitted a pull request already. It’s hard to give specific feedback without giving away any answers! And when I read over my feedback again, it sounded a bit meaner somehow than I intended… but it isn’t mean, it’s just straightforward. There’s definitely an art to this. I’ll have to reach out to a couple of my teacher friends and pick their brains about the art of grading, haha. OK, time to post the next homework challenge… I think I’ll just make a couple quick “up for grabs” style challenges for people to do on Saturday.
12:30pm: Posted five quick “up for grabs” challenges in our group project repo to encourage the students to learn about a Firebase method or property on their own and then post some instructions and sample code to illustrate how it works. I took a break to chat with a friend who just arrived to do some coworking here. Now I’ll post an update on our Slack chatroom and check in with our students.
3:42pm: Back from a nice nap and daydreaming session. I had a wonderful meta-dream about how dreams are a great metaphor for understanding the call stack and lexical scoping! I imagined my dream as a function, a little alternate universe that had knowledge of the outside universe from which it was called, as well as its own creations within isolated within its local memory, which that I was sure to forget upon waking – except for a vague memory, which was my one single output that I managed to hang onto during my return trip. What a beautiful, surreal, abstract dream! There weren’t really any pictures, but I didn’t see any code either. Just a feeling of tactile patterns, as if those connections in my mind had a physical texture.
4:10pm: Spent a bit of time reviewing more homework solutions, and originally I was going to write some individual feedback in the form of inline comments, but then I realized that doing so for every student would be time-consuming and, more importantly, unfair to the students who weren’t able to do their homework early, because those who submitted assignments earlier would get more individualized feedback, whereas everyone else would get the solutions when we review them as a group when we’re together in person! So I decided to hold off on the feedback for now and instead plan to solve the questions together when we meet this Saturday. Anyway, now it’s time to check in on the happy hour thing happening downstairs, because I want some free food and margaritas!
4:39pm: I might start getting a little tipsy now, but I’m going to finish my drink and cotton candy while writing up the rest of the homework solutions. Then I’ll save them locally somewhere and post them later, or at least have them handy for Saturday. Let’s see if I can solve my own homework challenges!
6:04pm: Finished doing all of my own homework assignemnts and making some edits to the instructions. Lesson learned: I really need to do all the problems myself in exactly the same environment as the students would be using, because otherwise it’s way too easy to skip over some tiny but very important details! In between, I got some free ice cream cake from downstairs and took a couple other short breaks. I’m definitely a little tipsy now, too. My judgment is impaired and I’m snacking on more sugary treats than I normally would. I also feel really excited about finishing up some big projects, thinking I could do them before the end of the night, but I keep forgetting that it’s already 6pm and I don’t really have any of the details worked out! So I’m not sure what to do next. Maybe I’ll go for a walk around the block and get some fresh air – something I haven’t done all day!
7:53pm: Back after another snack break, sketching some ideas for a minimal feature set for our UnBootcamp team’s group project, chatting with friends some more, a walk around the city, and another snakc break. I’m still hungry though! And getting a bit sleepy again. Maybe I needed a longer nap today, or maybe my caffeine tolerance has finally caught up to me. I’m much more tired than I was at this time yesterday and the day before. Should I power through, or take another break? Well, I’m going to try eating my emergency protein bar (I try to always keep one stashed in my purse now) and get some more water. I’m feeling very indecisive right now. Should I work on more curriculum? Dive back into rebuilding and/or debugging my mob coding app, or at least documenting it? When I felt a bit tipsy earlier, I was really in the mood for drawing some flowcharts! Now not so much. I feel antsy. OK, I’ll just take another quick break I guess. Sitting here and thinking and writing stream-of-consciousness notes doesn’t seem to be helping. Sometimes it does, sometimes it doesn’t.
8:15pm: I never did take a break. Instead I searched online for some free email APIs. Then I did some brainstorming about the UnBoocamp stuff.
UnBootcamp project ideas and big picture questions
Ideas for our study partner matchmaking group project:
- Intro to APIs could lead into using a service for sending emails, and an “up for grabs” research task could be finding a couple of those services and digging up their example code and pricing details!
- Or an intro to APIs could lead to using Twilio to send text messages, or using Slack’s API to send chat messages or interface with a Slack bot!
- Bare minimum feature set: users log in, enter a couple details (view/edit profile), and then they can see a list of who else is online and see their profile details.
- Next feature set: schedule meetings in advance, browse a list of upcoming available time slots, and see your scheduled upcoming and past meetings. (Or, even simpler: just add a feature to track a list of people you’ve paired up with in the past.)
- Alternative feature set: use a geocoding API to find nearby users!
- Fun and easy tinkering with Zapier Firebase hooks or “Zaps”, like Send emails from Firebase with Zapier or Add Twilio text messages to Firebase as new records to let users submit data to a web app via SMS!
- On my end, I’ve been wanting to experiment with making screencasts either as videos, livestreams, or with a text-based recording tool like Scrimba!
So I’m starting to narrow down our target features and topics for the rest of this class – after Saturday, we only have one week left! I’d love to finish a working prototype of an app, no matter how small it is. But whether or not all the students have time to keep up with all the assignments I’ve been posting, I plan to continue posting more until I finish detailing how to build the app, and the students can finish the tutorials on their own time after our class ends.
Topics I definitely want to get to:
- Inserting, updating, and removing data with Firebase
- Intro to the Firebase rules system and how to limit read/write access
- How to give each user a profile page (one template file plus URL params?)
- Basic queries/filtering with Firebase
- Implementing user presence in Firebase
- Intro to APIs and making AJAX calls (even if we can’t cover much of it, I want to at least do one example walkthrough!)
And sometime well before this class wraps up in a couple weeks from now, I need to think more about the next couple of months… Why am I so incredibly indecisive right now?!
Pending decisions related to the UnBootcamp experiment:
- Should we continue the same format with the same students? Will any of them even want to continue?
- Or should we end the class, but continue the casual “hack day” style meetings? Our students can continue to join us and learn on their own.
- Should I start the whole process over again and reach out to invite a new cohort of beginners? Could our “graduates” serve as mentors yet?
- Do I want to focus on shorter paid workshops instead, or stick with this longer format? Or try a new format?
- Or do I want to focus instead on creating and publishing content – tutorials, educational games, videos, email courses, etc?
- And what’s the right balance between learning new things to advance my own skills and creating content and organizing these types of in-person events to teach what I’ve been learning?
Sometimes I go into existential crisis mode where I find myself doubting all of my goals and the value of all the work I’m putting into this, but other times I do manage to remember just how awesome it is that I’m creating my own dream job from scratch: learning new things and sharing the process with others! I keep reminding myself that even if my crazy ideas don’t pan out, there’s still value in trying. If I really put my heart into it, then it’s worthwhile just because of that alone. Because that’s when I seem to be happiest, anyhow: when I’m completely dedicated to something and my mind is thoroughly absorbed in it and I forget about everything else. So I may as well keep going with this! Anyway, that’s enough of a personal pep talk for the moment. I need a quick break to reset my brain, get out of planning mode, and see if I can start making something tonight. That part of my brain still has an itch to scratch!
9:34pm: Took a break to enjoy some herbal tea and hang out in the kitchen while my partner-in-crime had a dinner break. Then I tweeted about my meta-dream from earlier and read over the Wikipedia pages for the call stack and on scope in computer science, specifically the section on lexical scoping! Dreams use lexical scoping; they pull in variables defined outside of their scope, but locally defined variables can override that outer reality. But maybe if I had a better understanding of the difference between lexical and dynamic scoping, I might not have thought of that metaphor because maybe I’m completely wrong! I had no idea.
Related to that dream, I was thinking about how it might be a fun exercise to take a story and convert its characters and a plotline into code, telling the story through how the program’s structure evolves over time. But maybe that’s a pointless exercise, too artsy to be a useful, but too technical to be art. Or maybe that’s the highest form of art simply because of that uncertainty! Haha, my brain really is in an interesting state right now, mostly daydreaming but still sort of on the verge of being productive. Right now I’m also listening through some screencasts on Scrimba.
9:59pm: Had fun letting my mind wander and explore… Bubbling up to the surface of my thoughts are some questions about those ES6 and ES7 features I looked at yesterday with my friend. I’m especially curious about asynchronous code and that whole async / await stuff. And modules too. And Babel. Maybe I should just dive right into that! Or go sketch some flowcharts for my mob coding app, haha. I’m still feeling very indecisive and unproductive, but I don’t want to call it a night yet either. OK fine, let’s go down a rabbit hole!
Starting point: I keep hearing about how useful this “async/await” thing is, and I want to know why!
- What problems does async/await solve? How will this make my life better? (Will it turn my code into rainbows and unicorns?!)
- How hard is it to learn this async/await stuff?
- What’s the relationship between async and await? Does one depend on the other? Does one encompass the other? (If I drew a Venn diagram or something similar to illustrate this stuff, what would it look like?)
- What are the prerequisites that I should be learning first?
- How does async/await relate to promises?
- What’s the smallest working example?
First stop: the MDN reference page for async! The first sentence was not helpful at all, but this quote had some meaning for me:
“The purpose of async/await functions is to simplify the behavior of using promises synchronously and to perform some behavior on a group of Promises. Just like Promises are similar to structured callbacks, async/await is similar to combining generators and promises.”
So there are some clues right there for what I should add to my list of prerequisites! Another clue: their “simple” example of async functions does not look very simple to me!
Prerequisites for async/await:
- Promises (and a prerequisite for understanding promises would be “structured callbacks” as described in that quote from MDN)
- Arrow functions (because that “simple example” uses them)
- Generators, maybe?
- Try/catch blocks
Next stop: Google’s Web Fundamentals article on async functions by Jake Archibald, whose name I’ve seen before. I really like his writing style! Let’s see what he has to say…
I like how he says that async functions “make your asynchronous code less “clever” and more readable”, and that they “allow you to write promise-based code as if it were synchronous”. What a quick way to sum up what problems they solve and how they’ll make my life better!
Async is already enabled in Chrome 55 by default, yay!
Here’s how async and await work together: if you start a function definition with
async, then you can use
awaitwithin that function to pause it without blocking the rest of your code from running. So I guess calling this “async/await” makes sense not just because they work together, but because it’s a hierarchical relationship, just as if it were a path in a file system – async comes first, and then await can optionally be used afterwards!
The example code here makes more sense to me, showing how async/await removes all the callbacks, making the code easier to read.
Good to know: you can safely
awaitvalues that are not promises.
This also makes sense: as your code increases in complexity, async functions become more beneficial!
I’m not sure I understand how the loop works in the other example, but I guess I’ll have to write and test a couple examples myself to really get it.
You can use
asyncwith arrow functions, object and class methods
Next stop: Understand promises before you start using async/await by Daniel Brain.
Remember that “async functions don’t magically wait for themselves. You must await, or you’ll get a promise instead of the value you expect.”
He says that “async/await and promises are the same thing under the hood” and that’s why there’s no really nice way to
awaitthings in parallel. (I want to dig into that some more though and see what others say about it!)
Interesting! The pattern Daniel Brain says to avoid is exactly the pattern that Jake Archibald used in one of his examples! Clearly there’s a difference of opinions here.
Since it’s so easy for errors to magically disappear when working with async code, he suggests that “the top level of your code always needs to be enclosed in a try/catch (gotta catch ’em all) to make sure you’re handling any errors” – interesting! Do others agree, I wonder?
Next stop: the MDN reference page for await! No extra notes to collect from this one, except to confirm that the description here does indeed line up with what I’ve read so far.
A couple more quick learning notes (from an assortment of other links that I didn’t bother to save):
- The async/await stuff is actually part of ES7 (ECMAScript 2016)
- If you transpile async/await code with Babel for client-side code to be run in the browser, it can generate a lot of really messy code, so not the most performant option!
- But async/await is native to NodeJS now, so it’s still worth learning how to use it for server-side code!
11:25pm: OK, so I read about this for about an hour and took some breaks in between to chat with my friends who were also here working late. Time for a quick break, and then I’ll try to force myself to write some code to practice, probably starting with a simple Promise using
setTimeout to simulate a delay and then convert some variations of that into versions using async/await so I can compare them side-by-side. There’s no comparison to creating your own examples. Things sink in better when you have a sense of ownership over the code, instead of just finding an example that’s already all done and ready to go – just like the difference in satisfaction between baking a cake from scratch as opposed to from a boxed cake mix.
11:38pm: I think I’ll tryout Babel’s web-based REPL. Interesting how you can see the code side by side! What I don’t understand though is how the transpiled version still uses promises. Hmm. Well anyway, to actually run some code I guess the easiest way to test it is with Node! Speaking of which, I still need to update Node to the latest version! I’ll do that now.
11:49pm: OK, finally going to walk home. I may or may not look at this some more. Or maybe I’ll sleep! I didn’t learn much about this tonight really, but at least I set the stage for the next time I feel like digging into it. I’d love to make this more of a regular habit again, spending an hour or two exploring a new topic!