This Lesson is for Members

Subscribe today and get access to all lessons! Plus direct HD download for offline use, enhances transcripts, member comment forums, and iTunes "podcast" RSS feed. Level up your skills now!

Unlock This Lesson

Already subscribed? Sign In

Autoplay

    Create a self-contained code focused screencast

    Trevor MillerTrevor Miller

    egghead.io lessons are example driven. We don’t rely on slide decks, instead we focus on code. This code first approach is how we explain things to students. Armed with a lesson title and summary that describes the goals, we will avoid polite introductions and jump right into showing how to make code.

    Code

    Code

    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson
    Transcript

    Transcript

    00:00 There are three key principles that make a lesson an Egghead lesson. Jump right in, focus on the code, and stay modular. Let's go through each of these principles to see the differences between Egghead and non-Egghead styles.

    00:13 Egghead lessons jump right in. This lets the viewer know we value their time. Let's watch an example typing immediately when the lesson starts.

    00:23 First let's type const URL, and let's set that equal to the GitHub API. That's api.gethub.com/users. Then we need some sort of user here.

    00:35 When we jump right in we avoid intros, outros, and explaining before doing. Although it may feel like a lesson needs an intro or outro, this information should be placed in the lesson description instead of the video because we want to respect the viewer's time.

    00:50 Removing intros and outros lets the viewer consume the content without any fluff. Here's examples of both an intro and an outro.

    00:59 Fetch is something that we can use to use APIs. It's a replacement for XMLHttpRequest. That's how fetch works. That's it for this lesson.

    01:12 It feels natural to explain things before showing them, but it's for the viewer to understand when you show them first. Egghead lessons do first, then explain if needed. Let's watch what explaining before doing looks like.

    01:25 We want to use the Fetch API, but before we do that we need to have a URL. Let's make a URL.

    01:33 Egghead lessons focus on the code. The bulk of the lesson should be typing, but we can stop and explain when necessary. Here's a clip to see what it feels like to focus on the code.

    01:43 Now, let's go down and type .catch and this will be used if we get an error. We will get our error. We can use that error, so let's just log out the error in this case. Let me turn off my network connection. Now we get this type error failed to fetch.

    01:59 When we focus on the code we avoid long notes and explaining why we're doing something. Egghead lessons are condensed. Because of this we avoid long notes that can distract from the core lesson. Here's an example of a long note.

    02:14 Fetch is a function that's available on the global window object in the browser or through libraries in other JavaScript environments.

    02:23 The reasoning behind why we like a technology or why we're typing something should go in the lesson description, not the video. Let's look at an example of explaining why.

    02:33 We need to have some way to get data from our API. I've decided to use Fetch because it's becoming a part of the spec, so we don't have to rely on third party libraries.

    02:44 Egghead lessons stay modular. A viewer should be able to watch a lesson by itself or in succession regardless of when the lesson was created. When we stay modular, we avoid information that is brittle or references outside of the lesson. Information that is likely to be out of date soon is brittle.

    03:03 We want Egghead lessons to last as long as possible, so we try to avoid including brittle information in the video. Instead, add this information to the lesson's description where it can be easily modified. Let's see what brittle information in a lesson sounds like.

    03:19 One thing to note is that this Fetch function is not available in all browsers. It's currently only in Chrome and Firefox and it's not available in Node yet.

    03:29 Referencing outside information is unnecessary. It creates a side effect like an impure function, which makes it more difficult to watch the lesson by itself or compose it in playlists in courses. Let's watch an example of a reference outside of a lesson.

    03:43 If you haven't seen this before, this is a template literal which is a part of ECMAScript 2015 that we covered in another lesson.

    03:52 In summary, an Egghead lesson jumps right in, is focused on the code, and stays modular.

    Discuss

    Discuss