<?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: Charissa Johnson</title>
    <description>The latest articles on Forem by Charissa Johnson (@charissayj).</description>
    <link>https://forem.com/charissayj</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%2F76523%2Fcbc85bec-e736-4bde-a704-f58c0bee223f.jpeg</url>
      <title>Forem: Charissa Johnson</title>
      <link>https://forem.com/charissayj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/charissayj"/>
    <language>en</language>
    <item>
      <title>BEM - A CSS Naming Convention</title>
      <dc:creator>Charissa Johnson</dc:creator>
      <pubDate>Fri, 10 Jul 2020 00:42:13 +0000</pubDate>
      <link>https://forem.com/charissayj/bem-a-css-naming-convention-1o7</link>
      <guid>https://forem.com/charissayj/bem-a-css-naming-convention-1o7</guid>
      <description>&lt;h1&gt;
  
  
  What is BEM?
&lt;/h1&gt;

&lt;p&gt;BEM is an acronym for Block, Element, and Modifier and is a methodology for creating reusable CSS. BEM works by providing a pattern for naming components that makes the relationship of a components style classes to the markup more obvious. For example, take a navigation component on a web page. Some items that might be included are a nav container, a list, and list items. &lt;/p&gt;

&lt;h2&gt;
  
  
  Blocks
&lt;/h2&gt;

&lt;p&gt;Since we're using the nav component and know that we have a nav container, list, and list items, we can use BEM to help us give these items some meaningful class names. BEM's naming structure follows a pattern where blocks are named things such as &lt;code&gt;nav&lt;/code&gt;, &lt;code&gt;container&lt;/code&gt;, or &lt;code&gt;header&lt;/code&gt;. Blocks are top-level items on a webpage (or screen if you're working on mobile devices). The best way to figure out whether an item is a block is to determine if it is meaningful on its own. For example, a &lt;code&gt;nav&lt;/code&gt; or &lt;code&gt;button&lt;/code&gt; item is meaningful on its own. You know exactly what these items are without needing any extra context. If you're perusing some css and see &lt;code&gt;.nav&lt;/code&gt; then you don't really need any other context. You can tell exactly what a nav is just by reading the class name.&lt;/p&gt;

&lt;h2&gt;
  
  
  Elements
&lt;/h2&gt;

&lt;p&gt;Elements are named using a double underscore such as &lt;code&gt;nav__list&lt;/code&gt;, &lt;code&gt;container__title&lt;/code&gt;, and &lt;code&gt;button__submit&lt;/code&gt;. Elements are &lt;strong&gt;part&lt;/strong&gt; of a block and do not have standalone meaning. A good example to help convey what this means is to think of a list item. An &lt;code&gt;li&lt;/code&gt; on its own has no standalone meaning. What is it tied to? Where does it go? If you see &lt;code&gt;li&lt;/code&gt; in CSS then you have little to no idea of where the &lt;code&gt;li&lt;/code&gt; is located in your markup and you have no idea how many &lt;code&gt;li&lt;/code&gt; elements on the page will be affected if you edit the CSS. However, if your &lt;code&gt;li&lt;/code&gt; is named &lt;code&gt;navList__item&lt;/code&gt; then suddenly this element has meaning. It is important to note here that blocks can have many nested elements, but blocks cannot be nested within an element. This is due to the fact that blocks must be meaningful on their own.&lt;/p&gt;

&lt;h2&gt;
  
  
  Modifiers
&lt;/h2&gt;

&lt;p&gt;Modifiers are the smallest units in BEM and are used to describe the behavior, states, or appearance of an item. Take the nav list items, these could have modifiers for color or hover. In BEM this would look something like &lt;code&gt;navList__item--blue&lt;/code&gt; or &lt;code&gt;navList__item--hover&lt;/code&gt;. Note the two dashes. This is how to denote an attribute in the BEM naming convention.&lt;/p&gt;

&lt;h2&gt;
  
  
  Putting it all together
&lt;/h2&gt;

&lt;p&gt;Now that we know the basics of the BEM naming convention, let's see what this might look like. Using the nav example discussed throughout this post the markup might look like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div className="nav"&amp;gt;
    &amp;lt;nav className="nav__container"&amp;gt;
      &amp;lt;ul className="nav__list"&amp;gt;
        &amp;lt;li className="navList__item--blue"&amp;gt;I am blue!&amp;lt;/li&amp;gt;
        &amp;lt;li className="navList__item--red"&amp;gt;I am red!&amp;lt;/li&amp;gt;
        &amp;lt;li className="navList__item--hover"&amp;gt;I have a hover state!&amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
    &amp;lt;/nav&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now that we know what our HTML looks like, we can design some CSS classes. Based on the names created, the CSS may look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Block */
.nav {
  text-decoration: none;
  background-color: white;
  color: #888;
  border-radius: 5px;
  display: inline-block;
  margin: 10px;
  font-size: 18px;
  text-transform: uppercase;
  font-weight: 600;
  padding: 10px 5px;
}

/* Element */
.nav__ul {
  background-color: white;
  color: #fff;
  padding-right: 12px;
  padding-left: 12px;
  margin-right: -10px; /* realign button text padding */
  font-weight: 600;
  background-color: #333;
  opacity: 0.4;
  border-radius: 5px 0 0 5px;
}

/* Modifier */
.nav__li--blue {
  color: blue;
  font-size: 28px;
  padding: 10px;
  font-weight: 400;
}

/* Modifier */
.nav__li--red {
  border-color: #0074d9;
  color: white;
  background-color: #0074d9;
}

/* Modifier */
.nav__li--hover: hover {
  border-color: #ff4136;
  color: white;
  background-color: #ff4136;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Imagine that the CSS was the first thing you looked at in a project. If you saw CSS like what's above, it would be easier to read those classes and know exactly what it is they're supposed to be styling. This is one of the biggest benefits of BEM. BEM allows you to design your code in such a way that both your HTML and CSS make sense separately, as well as together.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrap up
&lt;/h2&gt;

&lt;p&gt;Keep in mind that this isn't a perfect example, it was designed in a way that made the most sense to me. That is exactly how BEM should be used. There is not a one-size-fits-all approach here. If you, or your team, prefer different class names and structure, then use whatever seems best suited to your project. The most important part here is keeping the code clean, readable, and maintainable. When your CSS makes sense, it's much easier to go in and make edits and know exactly what it is that you are changing without having to fight with a bunch of different cascading rules. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Pair and Mob Programming: Best Practices</title>
      <dc:creator>Charissa Johnson</dc:creator>
      <pubDate>Sun, 24 May 2020 23:14:53 +0000</pubDate>
      <link>https://forem.com/charissayj/pair-and-mob-programming-best-practices-ef9</link>
      <guid>https://forem.com/charissayj/pair-and-mob-programming-best-practices-ef9</guid>
      <description>&lt;p&gt;We've all heard of pair programming, that concept where two or more programmers work together on a solution. The term "pair programming" evokes a lot of reactions when you first broach the subject with developers. Hopefully, this article can help put some of the negative connotations around pair programming to rest. &lt;/p&gt;

&lt;h2&gt;
  
  
  Pair Programming
&lt;/h2&gt;

&lt;p&gt;So, what does effective pair programming look like? &lt;br&gt;
Pair Programming consists of 2 programmers where one is a navigator and one is a driver. This pair works together on one story at a time, where one programmer is a &lt;em&gt;navigator&lt;/em&gt; and the other is the &lt;em&gt;driver&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mob Programming
&lt;/h2&gt;

&lt;p&gt;Mobbing is similar to pairing, except that there is one &lt;em&gt;driver&lt;/em&gt; and many &lt;em&gt;navigators&lt;/em&gt;. In mob programming, everyone works on one story while one person drives and everyone else navigates. Mob programming is best used when only one person has experience in something and needs to catch the team up, or when the team is learning something new together. Otherwise, pair programming is a better approach.&lt;/p&gt;

&lt;h2&gt;
  
  
  Roles
&lt;/h2&gt;

&lt;p&gt;There are two roles, as you've no doubt already noticed in pair and mob programming. These roles are the navigator and the driver. It is important that the people in these roles remember that they are a team and are working together to complete a task. We'll break down what these roles entail below.&lt;/p&gt;

&lt;h3&gt;
  
  
  Driver
&lt;/h3&gt;

&lt;p&gt;The driver is the person who is at the keyboard, typing the solution. As the driver, you type what the navigator says and don't "run away". &lt;em&gt;Running away&lt;/em&gt; is the term used for a driver who stops listening to their navigator and just starts typing their own solution. It can be hard not to do this as the driver. Sometimes because the navigator doesn't know what to do, sometimes because the navigator is going too fast and it's hard to keep up. This is where it's important to signal overwhelm. This can be done many ways, such as simply lifting your hands from the keyboard, simply saying "let's slow down" or any other signal agreed upon between navigators and drivers.&lt;/p&gt;

&lt;h3&gt;
  
  
  Navigator
&lt;/h3&gt;

&lt;p&gt;As the navigator, it's your job to explain the solution and help your driver to code it. Navigator roles are best taken by the more experienced programmer per solution. As a navigator you want to make sure to find the level of your driver. Don't direct experienced programmers as if they are novices and don't direct novices as if they know (or should know) everything. It is also important to pay attention to cues from your driver. If you notice them feeling overwhelmed, then know that it's time to adjust your approach or take a break.&lt;/p&gt;

&lt;h2&gt;
  
  
  Timing Tradeoff
&lt;/h2&gt;

&lt;p&gt;It can be hard to pay attention and stay focused during pairing and mobbing sessions. Working for too long can lead to fatigue. On the other side of this coin, sessions that are too short can lead to too much overhead while switching drivers. A few ways to remedy this are to take frequent breaks and/or switch roles as often as makes sense or when possible.&lt;/p&gt;

&lt;h2&gt;
  
  
  Breaks
&lt;/h2&gt;

&lt;p&gt;Breaks are an incredibly important part of any work day, but they're especially important in pair and mob programming. It's not uncommon for team members to be used to staying at their desks all day, which can lead to them feeling guilty if they aren't actively programming. This is where it needs to be said that &lt;em&gt;breaks are important&lt;/em&gt;. They keep everyone involved, allow time to absorb the current work and think about the solution. They leave room for new ideas to incubate and can prevent mental fatigue. Furthermore, pair and mob programming become less effective as team members lose focus. &lt;/p&gt;

&lt;h2&gt;
  
  
  Discussing Code
&lt;/h2&gt;

&lt;p&gt;You might have read about the role of driver and thought to yourself, "so I just have to type what I'm told, no matter what"? The answer to that question is a solid no. If you had to blindly type everything the navigator told you to type then that completely erodes the concept of teamwork. While drivers and navigators will not always agree on the solution, it's important to be respectful and remember that everyone deserves to be heard. A good way to mediate this is to argue in code. Meaning that you can show brief examples in your code or on a white board to discuss the solution. This helps everyone to think through the problem at hand and come to an agreed upon solution.&lt;/p&gt;

&lt;h2&gt;
  
  
  Convincing your boss or your team
&lt;/h2&gt;

&lt;p&gt;So, why &lt;em&gt;should&lt;/em&gt; you use pair or mob programming? Pair programming helps prevent mistakes, gets work done faster, and leads to better design. It is also excellent for mentoring and onboarding new developers. It helps build communication skills and foster teamwork. Plus, it's often a lot of fun, but that one may be my personal opinion.&lt;/p&gt;

&lt;p&gt;If you want more information on pair programming, I'm always happy to answer questions. I can be found at @DevCharissa on twitter. You can also watch my &lt;a href="https://www.youtube.com/watch?v=426KMgkOJFY"&gt;talk&lt;/a&gt; for Women Who Code DFW on youtube for a more in-depth version of this article. &lt;/p&gt;

</description>
      <category>pairprogramming</category>
      <category>mobprogramming</category>
    </item>
  </channel>
</rss>
