<?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>Forem: Michael B</title>
    <description>The latest articles on Forem by Michael B (@michaelb).</description>
    <link>https://forem.com/michaelb</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%2F446291%2F30670912-7a52-4a4b-be30-8a89fd7410f3.jpg</url>
      <title>Forem: Michael B</title>
      <link>https://forem.com/michaelb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/michaelb"/>
    <language>en</language>
    <item>
      <title>Writing and Asking (Tech) Interview Questions That Capture Culture</title>
      <dc:creator>Michael B</dc:creator>
      <pubDate>Tue, 13 Oct 2020 18:46:16 +0000</pubDate>
      <link>https://forem.com/michaelb/writing-and-asking-tech-interview-questions-that-capture-culture-327i</link>
      <guid>https://forem.com/michaelb/writing-and-asking-tech-interview-questions-that-capture-culture-327i</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/writing-and-asking-interview-questions-capture-culture/"&gt;Original post here: Writing and Asking (Tech) Interview Questions That Capture Culture&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Useful? Feedback? Have your own questions you ask? Let me know in the comments!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You did it! You got an interview invitation. Now it’s time to start thinking about preparation, especially what questions you’re going to ask. Interviewing is not only an opportunity for you to share yourself, but to learn about the company you’re interviewing with. It can sometimes be challenging coming up with questions that will get right to the point of what you’re looking for, especially if what you’re trying to evaluate is company culture. &lt;/p&gt;

&lt;p&gt;Getting a read on company culture means it’s important to craft thoughtful, well-worded questions that will really get to the answers you’re looking for about a company’s culture. Here are a few tips for creating questions that will really get down to the heart of things. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First, get clear on what answers you’re looking for. What values are important to you? What are some ways your ideal company might act on those values? Think about past experiences, and what worked and didn’t work for you. Knowing this information will help you process an interviewer’s answer more quickly. &lt;/li&gt;
&lt;li&gt;Get specific. Ask questions that require examples. For instance, if community engagement at a company-wide level is important to you, instead of asking “How does Company contribute to its community?” ask “When was the last time Company’s staff participated in a community engagement or volunteer event, and what were the outcomes?” If the interviewer can’t remember or it was a long time ago, that gives you even more insight on how this value is or is not practiced by this company. &lt;/li&gt;
&lt;li&gt;Get context. Rather than asking, “Can you tell me about Company’s tech stack?” ask “Can you tell me about the evolution of Company’s tech stack since Company started (or if it’s been a few years, maybe ask about the past year or so)?” This gives you not only a historical look at what this company has used and is using, but insight into the decision making process, and what this company’s tech needs and priorities are now. &lt;/li&gt;
&lt;li&gt;Get creative. Especially if you’re interviewing with folks who you might work directly with, this is a great opportunity to get to know people and how they’re championing company culture. Creative questions like, “If you were a food, what food would you be?” and “If this team was a rock band, who’s playing on what instruments and why?” are fun, and they can give you an opportunity to connect with people you may get to work with.&lt;/li&gt;
&lt;li&gt;Get technical. Asking questions like “What processes are in place for measuring employee growth and goal-setting?” will give you insight into a company’s organization, requirements for management, and how they facilitate employee growth. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Company culture is sometimes an elusive thing to get a full picture on, and it should be noted that during an interview is certainly not the only time you can investigate a company’s cultural landscape. Chatting with friends, mentors, or connections who work or have worked at a company is a great way to more intimately understand the details of what it’s really like working there. It’s also worth looking into the company’s website, seeing if they have a blog, what their online presence looks like on various social media sites, etc. It’s hard to ever really get a full picture of a company’s culture before actually working there yourself, but with these questions and other research techniques you can be off to a great start.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kickstartcoding.online/learn/articles/writing-and-asking-interview-questions-capture-culture/"&gt;Original post here: Writing and Asking (Tech) Interview Questions That Capture Culture&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>career</category>
    </item>
    <item>
      <title>5 questions to ask before learning a new JS framework</title>
      <dc:creator>Michael B</dc:creator>
      <pubDate>Thu, 24 Sep 2020 21:05:53 +0000</pubDate>
      <link>https://forem.com/michaelb/5-questions-to-ask-before-learning-a-new-js-framework-4ih</link>
      <guid>https://forem.com/michaelb/5-questions-to-ask-before-learning-a-new-js-framework-4ih</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/5-questions-ask-learning-new-js-framework/"&gt;&lt;strong&gt;Original post here: 5 questions to ask before learning JavaSript frameworks&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Useful? Feedback? Let me know in the comments!&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Have you been working with one JavaScript framework for a while, and started feeling ready for learning something new? This is the guide for you! Learning a new framework or library can be an exciting opportunity, one that’s ripe with chances to advance your knowledge in new areas and reinforce existing knowledge. To set yourself up for success, it’s helpful to ask yourself a few questions about the new material you’re choosing to dive into. While this article will mostly showcase examples related specifically to JavaScript libraries and frameworks, these questions can be applied to any transition from one framework or library to another.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. What makes this framework or library special?
&lt;/h3&gt;

&lt;p&gt;You could also look at this as “What problems did the creators set out to solve?” Maybe you’ve already selected your framework or library and want to build a project around it to get practice with it, or maybe you’re looking to accomplish a specific task and need to find the right tool for the job. Either way, it helps to deeply understand the key features of what you’re working with vs. its competitors. For example, if you’ve been working with Angular, you might choose to work with React next because you’re interested in learning&lt;br&gt;
about one-way binding or using a virtual DOM. Knowing the key features of the technology you’re using will help ensure you’re designing features and functionalities that work well within the bounds that you’ve chosen.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. What is the general structure of an application or project built with this framework?
&lt;/h3&gt;

&lt;p&gt;Gaining insight into a project’s structure helps inform what tools and learning opportunities are available to you, as well as how you may integrate it into existing projects. Look for differeces as well as similarities between what you know and the new tool you’re using. In both Vue and React (using create-react-app), creating a default application will generate a ‘public’ directory, which tells you both technologies work similarly when it comes to storing and referencing publicly available assets.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. How are key features typically handled?
&lt;/h3&gt;

&lt;p&gt;There’s likely more than one way you’ll see key features handled in a JS framework or library. For example, re-rendering happens after using setState in React, and after a change detection cycle in Angular. Being aware of the different ways key features of the framework are handled will not only inform the choices you make within the project, but it will help you in the hunt to answer any questions documented on the framework’s site or sources like Stack Overflow.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. How large is this community and how well-documented is this framework?
&lt;/h3&gt;

&lt;p&gt;This is mostly an expectation-setting question - it may be more difficult to find answers to unique or specific questions when working with a less common framework. If that’s the type of challenge you’re up for, go for it! And if you’re able to contribute to the development of the framework, that’s icing on the cake. React has a large following with solid documentation, and is quite a popular framework, but some folks in tech cite Vue as being better-documented. It helps to sometimes seek out opinions on documentation, especially if you’re looking to do something specific with a library or framework, but not to hold any one opinion as the ultimate source of truth. The best approach is to take a&lt;br&gt;
look at the documentation for tools you’re considering and decide for yourself how comfortable you feel with it, and if it meets the goals you’re setting for yourself.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. What adjacent libraries or frameworks should I know about?
&lt;/h3&gt;

&lt;p&gt;Knowing what else to look out for will not only inform additional features or new directions you can incorporate into a project, but it will give you a sense of what other pieces of code may make an appearance in answers to common questions. With large React projects, for example, you may want to incorporate Redux for state management. If you’re looking to foray into mobile development, it may be worth your time to also look into React Native and or Ionic. It may also serve your project’s needs better to go with a library or framework-agnostic choice, like Cordova for mobile development, but it’s worth knowing what’s out there and what’s been developed with your tool of choice in mind. This is by no means the end-all-be-all list of questions to ask yourself before jumping into a new JS library or framework, but it’s a great place to start and prepare for your next JS adventure!&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://kickstartcoding.online/learn/articles/5-questions-ask-learning-new-js-framework/"&gt;&lt;strong&gt;Original post here: 5 questions to ask before learning JavaSript frameworks&lt;/strong&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>frontend</category>
    </item>
    <item>
      <title>7 rules for designing your first database schema or data model</title>
      <dc:creator>Michael B</dc:creator>
      <pubDate>Tue, 15 Sep 2020 20:37:55 +0000</pubDate>
      <link>https://forem.com/michaelb/7-rules-for-designing-your-first-database-schema-or-data-model-4mn</link>
      <guid>https://forem.com/michaelb/7-rules-for-designing-your-first-database-schema-or-data-model-4mn</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/pro-tips/designing-your-data-model/" rel="noopener noreferrer"&gt;&lt;strong&gt;Original post: 7 rules for designing your first database schema or data model&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Do you have any tips or rules of thumb for designing your database model? Love to hear pros/cons in the comments!&lt;/strong&gt;&lt;br&gt;
Are you a novice or intermediate web developer, starting a brand new project that uses a database? Not sure where to begin in terms of your table design (schema) or ORM models? I've advised quite a few students on this exact topic before, so I assembled these tips as a "check list" to use when you are designing your database:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Think about "nouns"&lt;/strong&gt; - your models (tables) should be the main "nouns" of data that you have to keep track of (e.g. &lt;code&gt;Book&lt;/code&gt;, &lt;code&gt;Author&lt;/code&gt;, &lt;code&gt;BlogPost&lt;/code&gt;, etc). The methods (functions) should be the "verbs" (e.g. &lt;code&gt;get_latest&lt;/code&gt; or &lt;code&gt;update_messages&lt;/code&gt;) and the properties (columns) should be adjectives or relationships (e.g. &lt;code&gt;popularity&lt;/code&gt; or &lt;code&gt;color&lt;/code&gt; for adjectives, or &lt;code&gt;creator&lt;/code&gt; for a relationship) &lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Combine similar models&lt;/strong&gt; - If two models (tables) seem almost the same, with maybe just one or two fields (columns) that are used only on one but not the other, just make them the same, and just skip using the fields (columns) that are specific to one when adding data for the other. For example, when developing the LiveSyllabus LMS, I was originally going to have separate models for Homework Assignments and for Reading Assignments.... but pretty quickly I realized they are almost identical, so it makes sense to store them in the same model (table) and have a &lt;code&gt;category&lt;/code&gt; field to distinguish them. Another example: Don't have &lt;code&gt;books_romance&lt;/code&gt; and &lt;code&gt;books_horror&lt;/code&gt; as your tables, instead just have a &lt;code&gt;books&lt;/code&gt; table and have &lt;code&gt;genre&lt;/code&gt; be a column.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Simple and stable&lt;/strong&gt; - No one likes lots of database migrations. So, try to design your models to last and not have to be changed often.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Think visually&lt;/strong&gt; - If it helps, think about how your application might function if it were in a spreadsheet. What columns do you need? Which values could be computed from other values?&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Compute what you can&lt;/strong&gt; - Avoid storing things that change or are computed in your models. For example, even if the design requirements need to show "how many days until we want this to be published", what we really want to store is the unchanging "publish date". The publish date doesn't ever change, it simply is used to show or hide the article depending on the current time.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Match what you present&lt;/strong&gt; - Think in terms of "data" vs "presentation". Often, what's stored in your models might be pretty close to what's presented, a 1:1 relationship. Other times, the database will be simpler than what's presented (frontend), and it won't match. In this case, think in terms of putting on a "show" for the user.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;Don't over-engineer it&lt;/strong&gt; - Start small. Don't think of &lt;em&gt;every&lt;/em&gt; possibility, just cover the top ones. In some cases you might need a n:n or "Many to Many" relationship (e.g. for a Twitter clone: "friendships", "followers", "likes"). But in other cases, resist the urge to model all possible features at once. As an example, maybe you could think of a future feature where a &lt;code&gt;Tweet&lt;/code&gt; might have many &lt;code&gt;User&lt;/code&gt; author -- but unless that feature is a "must have" for your product now, start with each &lt;code&gt;Tweet&lt;/code&gt; having only one &lt;code&gt;User&lt;/code&gt; (One to Many or 1:n) until you finish other aspects of your software. Keep your product's design short and sweet. Most software products won't ever even get used, let alone improved upon.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Bonus (Django specific) rule: Avoid "Generic Foreign Keys" if you can!&lt;/p&gt;

&lt;p&gt;Background: A student recently asked me what is the best practice for designing data models. While the question was originally for  the Django ORM on PostgreSQL, I've given the exact same advice while teaching classes on JavaScript / Node / Express stack using SQLize and MySQL, and in another course, Mongoose for MongoDB. While I've never taught a class on Ruby on Rails, the same advice also goes for ActiveRecord. These tips are pretty universal! In fact, as a Star Trek fan, I'll point out that even Star Fleet needs good database design:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2F1wQxZf716Wz0GbjnHM%2Fgiphy.gif%3Fcid%3Decf05e476vz5ixl12elc9b6iygbj8a3ojlhu85cuedlzoogn%26rid%3Dgiphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2F1wQxZf716Wz0GbjnHM%2Fgiphy.gif%3Fcid%3Decf05e476vz5ixl12elc9b6iygbj8a3ojlhu85cuedlzoogn%26rid%3Dgiphy.gif"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/pro-tips/designing-your-data-model/" rel="noopener noreferrer"&gt;&lt;strong&gt;Originally post: 7 rules for designing your first database schema or data model&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>database</category>
      <category>design</category>
      <category>sql</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How we decided to upgrade our JavaScript curriculum to use React Hooks</title>
      <dc:creator>Michael B</dc:creator>
      <pubDate>Wed, 19 Aug 2020 21:18:49 +0000</pubDate>
      <link>https://forem.com/michaelb/how-we-decided-to-upgrade-our-javascript-curriculum-to-use-react-hooks-37j9</link>
      <guid>https://forem.com/michaelb/how-we-decided-to-upgrade-our-javascript-curriculum-to-use-react-hooks-37j9</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/hooks-or-not-hooks/" rel="noopener noreferrer"&gt;&lt;strong&gt;Original post: How we decided to upgrade our JavaScript curriculum to use React Hooks&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Have you been considering the switch to using React functional components with the &lt;code&gt;useState&lt;/code&gt; hook? Would love to hear your reasons for / against in the comments!&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Several months ago we started talking about whether or not to update our React curriculum to use the new  &lt;a href="https://reactjs.org/docs/hooks-intro.html" rel="noopener noreferrer"&gt;React Hooks&lt;/a&gt; syntax over the old class-based syntax.&lt;/p&gt;

&lt;p&gt;It was a challenging decision. In addition to getting familiar with hooks ourselves, if we made the switch, we would need to update the curriculum’s in-class activities, homework assignments, quizzes, code examples, and cheatsheets. In addition, we would need to find or create new tutorials and reading materials. To be sure that work would be worth it, we had to answer some questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;How easy or difficult will hooks be for students to learn and use compared to the class-based way?&lt;/li&gt;
&lt;li&gt;How many people are actually using hooks in practice? That is, will learning hooks put our students at a competitive advantage, knowing the latest and greatest tools? Or will it hurt them to be less familiar with the older, more established, and (we imagined at the time) still more commonly used class syntax?&lt;/li&gt;
&lt;li&gt;Will there be enough good learning resources available? How many guides, tutorials, and other resources are out there for students to be able to find answers to their questions and explanations of the bugs they would run into in hooks-style React?&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Question One: Ease of Learning
&lt;/h2&gt;

&lt;p&gt;As we learned the ins and outs of hooks ourselves, it quickly became clear that switching to hooks-based syntax from class-based syntax almost always made our examples and exercises shorter and easier to read. From a teaching and learning standpoint, the advantage was hooks’.&lt;/p&gt;

&lt;p&gt;A counter the old way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Counter&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;Component&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;super&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;

    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bind&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;A counter the new way:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;increment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Simpler, shorter, and as an added bonus: no more having to introduce the concept of &lt;code&gt;this&lt;/code&gt; at the same time as we introduce React.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkickstartcoding.online%2Fmedia-content%2Fshare%2F1597456467%2F377%2F" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fkickstartcoding.online%2Fmedia-content%2Fshare%2F1597456467%2F377%2F" alt="Jack from The Nightmare Before Christmas asking “What’s this?”"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Question Two: Adoption
&lt;/h2&gt;

&lt;p&gt;Ease of learning is a major plus, but are companies actually using hooks in practice? We asked around a few different coding communities, and we were surprised by how consistently the answer turned out to be either ”Yes, we’ve moved entirely to hooks”, or ”Our older React code is still using class syntax, but we are writing all of our new components in hooks”. Almost everyone who responded was in one of those two groups.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“My team decided hooks are the bee’s knees and switched the entire codebase over to it.”&lt;/p&gt;

&lt;p&gt;“We are 100% [hooks] with our clients”&lt;/p&gt;

&lt;p&gt;“We've been updating our codebase and utilizing hooks for greenfield work. Super nice.”&lt;/p&gt;

&lt;p&gt;“We're using them in any new components.”&lt;/p&gt;

&lt;p&gt;“We use hooks exclusively.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;While we did get a couple of responses from people at companies who had not made the switch, quotes like the above were the overwhelming majority. Given that hooks is still pretty new and also a significant departure from the old way of doing things, we were surprised by how consistently people said they had already made a partial or total switch.&lt;/p&gt;

&lt;h2&gt;
  
  
  Question Three: Resources
&lt;/h2&gt;

&lt;p&gt;With concerns about ease of learning and industry adoption out of the way, our last concern was the availability of resources. For years and years, all of the blog posts, tutorials, Stack Overflow questions and answers, etc., for React have been written with class-style React in mind. Would there be enough resources written for hooks-style React that our students would be able to find answers to the questions and bugs that would inevitably come up?&lt;/p&gt;

&lt;p&gt;The resources question turned out harder to answer than the other two. While there is a fair amount of material written for hooks-style React at this point, most of it is written with the assumption that its audience already knows React. The guides are from the perspective of ”How to switch from class-style React to hooks-style React”, not “How to learn hooks-style React from scratch”. With students learning the hooks way of doing things from the start, analogies to the class way of doing things weren’t going to be that helpful.&lt;/p&gt;

&lt;p&gt;This is changing, slowly. Increasingly more of the intro docs and tutorials for various React libraries are being written with hooks in mind, and new resources and Stack Overflow answers continue to pop up.&lt;/p&gt;

&lt;p&gt;That said, to really feel confident that enough resources would be available if we switched the curriculum to hooks, we ended up deciding that we would need to write, or at least adapt, some resources of our own. The story of writing that adaptation will be the subject of next week's post.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making the Switch
&lt;/h2&gt;

&lt;p&gt;We eventually decided to go ahead and make the switch to a curriculum that introduced React via React Hooks. And as one of the people who worked on updating our materials for the switch, I have to say it was incredibly gratifying to watch almost all of the code for our activities and examples get shorter and clearer than it had been when written in class-style React. I’m a big fan of hooks, personally. I think it’s one of the best API updates I’ve ever seen a tool go through.&lt;/p&gt;

&lt;p&gt;Requisite plug: if you’re a user of the cheatsheets we’ve published at &lt;a href="https://kickstartcoding.com/" rel="noopener noreferrer"&gt;Kickstart Coding&lt;/a&gt;, the all-new hooks versions are now open source and available at &lt;a href="https://github.com/kickstartcoding/cheatsheets" rel="noopener noreferrer"&gt;github.com/kickstartcoding/cheatsheets&lt;/a&gt;, including a new one covering useEffect specifically (&lt;a href="https://github.com/kickstartcoding/cheatsheets/blob/master/build/topical/react-hooks-useeffect.pdf" rel="noopener noreferrer"&gt;link&lt;/a&gt;). If you’re tackling React for the very first time, or if you’re just making the switch from class-style to hooks-style React, check them out!&lt;/p&gt;

&lt;p&gt;Next week I’ll be writing about the project we used to address the documentation problem. Hopefully it will be interesting and a useful resource for other people trying to get the hang of hooks. It’s one of my favorite open-source projects I’ve worked on, so stop by next Tuesday if you’re curious!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/hooks-or-not-hooks/" rel="noopener noreferrer"&gt;&lt;strong&gt;(Original post: How we decided to upgrade our JavaScript curriculum to use React Hooks)&lt;/strong&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>functional</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Random bugs with debug_trainer</title>
      <dc:creator>Michael B</dc:creator>
      <pubDate>Tue, 04 Aug 2020 01:01:46 +0000</pubDate>
      <link>https://forem.com/michaelb/random-bugs-with-debugtrainer-13ce</link>
      <guid>https://forem.com/michaelb/random-bugs-with-debugtrainer-13ce</guid>
      <description>&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/introducing-debug-trainer/"&gt;Original post: Kickstart Coding Online - Want to practice debugging without actually getting stuck? Introducing: debug_trainer!&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;It’s possible to build some pretty nifty applications without having a good understanding of how the code is working. You copy and paste some online examples here, you try random things until one of them works there, and eventually you’ve got a sort of copy-pasted Rube Goldberg machine that basically works even if you’re not entirely sure how.&lt;/p&gt;

&lt;p&gt;Eventually, though, something is going to go wrong that cannot be fixed without a decent understanding of what’s going on under the hood. And when that does happen it is scary and stressful and not at all the best time to discover that the plumbing of your code is a deep, impenetrable mystery.&lt;/p&gt;

&lt;p&gt;Getting practice understanding your code and fixing problems with it before things like that happen can be incredibly helpful. Unfortunately, the only way to get practice fixing broken code is for your code to break, and broken code doesn’t happen when it’s convenient and you’d like some practice.&lt;/p&gt;

&lt;p&gt;Although I think most coding schools have debugging exercises here and there, I have spent a lot of time wishing that we had some better ways to give students more regular practice with debugging.&lt;/p&gt;

&lt;p&gt;Recently, I finally got a chance to take the time to sit down and write a tool for debugging practice that I’ve been thinking about making for a while to solve this exact problem.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introducing debug_trainer!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://github.com/kickstartcoding/debug_trainer"&gt;&lt;code&gt;debug_trainer&lt;/code&gt;&lt;/a&gt; is a terminal program that breaks your code! Run the &lt;code&gt;break&lt;/code&gt; command on a file of your choice and it will introduce a random breaking change into that file (or several changes if you’re feeling adventurous). Then you, the programmer, can put your debugging skills to work and try to find the change that was made.&lt;/p&gt;

&lt;p&gt;Let's say you've got a file, &lt;code&gt;my_file.py&lt;/code&gt;, that looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Stacey"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You'd run &lt;code&gt;debug_trainer&lt;/code&gt; like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; debug_trainer break test_file.py 


Breaking test_file.py...


...done!


Good luck debugging! I believe in you! Don't forget to make your program print things out if you don't know what they are. ❤️
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And it might, for example, change the file to this (see the error?):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
    &lt;span class="k"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Hello, "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"!"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Stacey"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The changes it can make are all based on common issues I’ve seen students struggle with. It might change the first letter of a variable name from capital to lowercase. It might remove the word ”return” from a return statement in a function. It might rearrange or remove the arguments in a function declaration. Malevolent!&lt;/p&gt;

&lt;p&gt;If you get stuck, you can ask &lt;code&gt;debug_trainer&lt;/code&gt; to give you some hints with the &lt;code&gt;error-type-hint&lt;/code&gt; and &lt;code&gt;line-hint&lt;/code&gt; commands. &lt;code&gt;error-type-hint&lt;/code&gt; will tell you what kind of change it made (for example, “somewhere in this file, &lt;code&gt;debug_trainer&lt;/code&gt; changed the arguments to a function”). &lt;code&gt;line-hint&lt;/code&gt; will tell you what line the change was made on. If you get really stuck, you can have it tell you exactly what it did with the &lt;code&gt;explain&lt;/code&gt; command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; debug_trainer error-type-hint test_file.py

HINT: somewhere in this file, debug_trainer changed the arguments to a function.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; debug_trainer line-hint test_file.py

HINT: The line where the change was made was line 1 of the original file.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; debug_trainer explain test_file.py

removed the name argument from greet on line 1 of the original file
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And once you’re done, whatever file &lt;code&gt;debug_trainer&lt;/code&gt; changed, you can reset it back to it’s working state with the &lt;code&gt;reset&lt;/code&gt; command. Then you can do the same thing all over again as many times as you want!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; debug_trainer reset test_file.py

test_file.py has been reset!
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’m pretty excited about &lt;code&gt;debug_trainer&lt;/code&gt; and I would love to get feedback, advice, suggestions for additional types of errors or new features, etc. I’d also like to give a special thank you to Dillon Kearns, without whose brilliant &lt;a href="https://github.com/dillonkearns/elm-cli-options-parser"&gt;tools&lt;/a&gt; and &lt;a href="https://github.com/dillonkearns/elm-cli-options-parser/tree/master/examples"&gt;examples&lt;/a&gt; I would not have been able to write this using my favorite language, Elm.&lt;/p&gt;

&lt;p&gt;If you want to try it out yourself, just run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install -g debug_trainer
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;to get started, then run the &lt;code&gt;debug_trainer&lt;/code&gt; command to have it list all the commands and how to use them. Or check out the repo &lt;a href="https://github.com/kickstartcoding/debug_trainer"&gt;here&lt;/a&gt; or the npm package page &lt;a href="https://www.npmjs.com/package/debug_trainer"&gt;here&lt;/a&gt; for more details and usage examples.&lt;/p&gt;

&lt;p&gt;And let me know on &lt;a href="https://github.com/kickstartcoding/debug_trainer/issues"&gt;the issues page&lt;/a&gt; if you have any issues or feature requests!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://kickstartcoding.online/learn/articles/introducing-debug-trainer/"&gt;Original post: Kickstart Coding Online - Want to practice debugging without actually getting stuck? Introducing: debug_trainer!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>codenewbie</category>
      <category>javascript</category>
      <category>showdev</category>
      <category>elm</category>
    </item>
  </channel>
</rss>
