<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Mia</title>
    <description>The latest articles on DEV Community by Mia (@miameroi).</description>
    <link>https://dev.to/miameroi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F179420%2F46d93567-21ac-49f4-9f44-cdf85578fa13.png</url>
      <title>DEV Community: Mia</title>
      <link>https://dev.to/miameroi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/miameroi"/>
    <language>en</language>
    <item>
      <title>How I Teach: Version Control *with G Sheets*</title>
      <dc:creator>Mia</dc:creator>
      <pubDate>Mon, 13 Jan 2020 12:03:15 +0000</pubDate>
      <link>https://dev.to/miameroi/how-i-teach-version-control-with-g-sheets-4135</link>
      <guid>https://dev.to/miameroi/how-i-teach-version-control-with-g-sheets-4135</guid>
      <description>&lt;p&gt;Hello and (a very late) happy new year!&lt;/p&gt;

&lt;p&gt;For the first blog post of the decade I thought I'd talk a little bit about how I like to introduce students to version control ✨.&lt;/p&gt;

&lt;p&gt;I was first taught version control through a GitHub Desktop demo, I got there in the end but let me tell you ... it took months before I finally understood what a commit is! After being taught version control by two courses after that, I believe I have narrowed down the issue that a lot of people encounter when they first teach version control: &lt;/p&gt;

&lt;h3&gt;
  
  
  There isn't anything you can compare it to - you could say it's like 'saving' a file but let's be real, it's not really!
&lt;/h3&gt;

&lt;p&gt;A fantastic and visual example of how GitHub works is Google Sheets version history feature. Go ahead and create a sheet, you could even name it repository to introduce the concept! &lt;/p&gt;

&lt;p&gt;Once the sheet is created, you can access its version history like so: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JrGKanyh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qap9l9pfevys584qayuf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JrGKanyh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/qap9l9pfevys584qayuf.png" alt="How to access version history in Google Sheets"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The version history has a list of all the changes that have been made by the user over time: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3xSslY-i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/z8l7pg73fyouoql79vw5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3xSslY-i--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/z8l7pg73fyouoql79vw5.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;These are commits, you can click on them to view what the user changed and you can even revert back to that commit:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6uWrVDXC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/36bfbri06kb6bno4shyz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6uWrVDXC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/36bfbri06kb6bno4shyz.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After running through this example, you can go back to GitHub in the browser and show the exact same process:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create a repo&lt;/li&gt;
&lt;li&gt;Make a change (do this online first)&lt;/li&gt;
&lt;li&gt;Commit it and show the commit in the commits history&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Top Tips
&lt;/h2&gt;

&lt;p&gt;I would only introduce the idea of local and remote repositories after both these demos. Since you have just created a remote repository, the transition should be quite smooth. Simply clone or download the repository and continue working on it locally to convey the concept of a local repo. &lt;/p&gt;

&lt;p&gt;Here are some common mistakes to avoid:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Demo version control from the command line;&lt;/li&gt;
&lt;li&gt;Even worse getting the students to code along with you in the command line, chances are half of the students will get lost in spelling mistakes and not focus on the wider concepts;&lt;/li&gt;
&lt;li&gt;Talking about branches and merges straight away; &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I hope this was helpful and let me know in the comments what topic you want me to cover next! &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>techlead</category>
      <category>mentor</category>
      <category>training</category>
    </item>
    <item>
      <title>How I Teach: Scope in JavaScript</title>
      <dc:creator>Mia</dc:creator>
      <pubDate>Wed, 23 Oct 2019 12:13:47 +0000</pubDate>
      <link>https://dev.to/miameroi/how-i-teach-scope-in-javascript-14mj</link>
      <guid>https://dev.to/miameroi/how-i-teach-scope-in-javascript-14mj</guid>
      <description>&lt;p&gt;I choose to write about scope in my first blog post as I think that it's a tricky concept to explain to someone if you've been writing code in JavaScript for a long time. &lt;/p&gt;

&lt;p&gt;In fact, after the initial learning curve scope becomes an integral part of JavaScript and it can be easily overseen while teaching - it's just how JavaScript works, right? &lt;/p&gt;

&lt;p&gt;Here is a breakdown of how I would use a zoo metaphor to explain scope in JavaScript. I hope that wether you are a student who is looking for a more in-depth explanation or a teacher looking for some new examples, this will help! 🙌🏼&lt;/p&gt;




&lt;h1&gt;
  
  
  Basic Scope Concepts
&lt;/h1&gt;

&lt;p&gt;I start off by setting up a simple zoo function with a global variable of a pigeon called Pidgey and a local variable lion called Leo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BtvcuAxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u4l873zxu4n63gllcpv8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BtvcuAxw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/u4l873zxu4n63gllcpv8.png" alt="Pidgey console.log"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pidgey, being a bird, is allowed to go in and out of the zoo 🐦. However Leo can’t leave - as it would cause some chaos around Regent’s Park, duh! In order to show that Pidgey can leave the zoo, I would add a console.log outside the zoo function:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2ew1iJcZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/408w8smz1gxnus8dw50p.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2ew1iJcZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/408w8smz1gxnus8dw50p.png" alt="Pidgey console.log outside the zoo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To prove what would happen if Leo tried to leave the zoo, you can log the local lion variable outside the zoo: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xIB-cocm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/67r0ctq90crqvj4tfdiw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xIB-cocm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/67r0ctq90crqvj4tfdiw.png" alt="Leo console.log outside the zoo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The console at this point will give a nice big red message, complaining that lion is undefined. Lions can't leave the zoo! 🦁&lt;/p&gt;




&lt;h1&gt;
  
  
  Re-assigning Variables
&lt;/h1&gt;

&lt;p&gt;The next step is to see what would happen if Pidgey was to evolve whilst at the zoo (aka what happens when you update a global variable inside a function 😉). &lt;/p&gt;

&lt;p&gt;Here is also a good time to note that the code inside the zoo function only runs when the function is invoked, so before Pidgey visits the zoo his name is still the same:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rlJMRCnV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4rtmelddtrodym0z07av.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rlJMRCnV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/4rtmelddtrodym0z07av.png" alt="Pidgey evolves to Pidgeotto"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Since leaving the zoo, Pidgey has evolved and is now Pidgeotto. His name is different everywhere, not just at the zoo. But what would happen if we created a new pigeon inside the zoo called Pidgeotto:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KT5MgYiu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2ryv2fenwoytrgbtp766.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KT5MgYiu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/2ryv2fenwoytrgbtp766.png" alt="New Pidgey"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;At this point, one might expect that the global pigeon will still change name after the function. However, this doesn't happen because the pigeon in the zoo is a completely different bird from the one outside. This is the perfect opportunity to consolidate understanding of variables definition - declaring a variable inside a function creates a brand new local variable even if it's called the same as another global variable. &lt;/p&gt;




&lt;h1&gt;
  
  
  Arguments &amp;amp; Parameters
&lt;/h1&gt;

&lt;p&gt;The third and most advanced topic one could cover in a scope lesson is the use of arguments and parameters in functions. When coming to terms with JS functions, it can be tricky to understand whether you need to or even should pass an argument to a function and what the consequences are 😨.&lt;/p&gt;

&lt;p&gt;If you pass pigeon as an argument in the zoo function, it becomes apparent that the global pidgeon Pidgey is not affected by the local change inside the zoo function:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AMljNtDC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8fiqdfic31u6u93qybb0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AMljNtDC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/8fiqdfic31u6u93qybb0.png" alt="Pidgey as an argument"&gt;&lt;/a&gt;   &lt;/p&gt;

&lt;p&gt;At this stage you can go into as much or little detail about the reason why this is happening, depending on how confident you think the students are with the materials covered so far. Here is the SandBox I used for this example, feel free to fork it and let your students play around with it:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/vri70"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;p&gt;Thanks for taking the time to read my post, let me know in the comments what topic I should cover next 😊&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>teaching</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
