<?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: Sebastian Spiegel</title>
    <description>The latest articles on DEV Community by Sebastian Spiegel (@sebastianspiegel).</description>
    <link>https://dev.to/sebastianspiegel</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%2F494320%2F39da649b-d2bb-4d8b-9768-5111acb32de1.jpeg</url>
      <title>DEV Community: Sebastian Spiegel</title>
      <link>https://dev.to/sebastianspiegel</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sebastianspiegel"/>
    <language>en</language>
    <item>
      <title>The Gender Question</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Fri, 11 Jun 2021 18:37:50 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/the-gender-question-2g9e</link>
      <guid>https://dev.to/sebastianspiegel/the-gender-question-2g9e</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--8EAOPICp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kidshelpline.com.au/sites/default/files/bdl_image/header-YA-GI.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8EAOPICp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://kidshelpline.com.au/sites/default/files/bdl_image/header-YA-GI.png" alt="Gender image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Happy Pride everybody! Since it’s the month to highlight diversity and inclusion I wanted to talk about something that has been bugging me, especially as I fill out endless job applications. &lt;/p&gt;

&lt;p&gt;It’s the gender question. Everywhere on the internet, you are asked for your gender. On signups for social media and websites, on e-commerce popups that aim to get the demographic for future marketing decisions, and on every single job application. In the US there are a series of questions required on every job application - gender, race, ethnicity, veteran status, and disability. I’m not going to go into the history of this and why these questions exist because that’s not the exact issue I want to bring up. I just want to focus on the gender question, as it relates to all of these things. &lt;/p&gt;

&lt;p&gt;For 99% of the applications I have filled out, the options under gender are “Male”, “Female” and “Decline to identify”. My gender is not any of these things. I do not identify as “male” or “female” and I’m not specifically interested in declining the question, but that’s what I keep doing, as there are no other options. This doesn’t have to be the case, I know because of the 1% of applications I found where they added in “nonbinary” as an option. So it’s possible and within guidelines to add this option. &lt;/p&gt;

&lt;p&gt;So why aren’t more companies doing it? &lt;/p&gt;

&lt;p&gt;Especially since it’s pride month, I’ve seen a lot of companies changing their logo to rainbow and posting promises of acceptance and diversity within their ranks. And yet, an interested job seeker (me) finds an immediate derailment to those ideals when going to apply. &lt;/p&gt;

&lt;p&gt;And it’s not just on applications, there are so many other places where users are asked for their gender. And plenty of social media sites have taken steps to increase the number of options, sometimes to the confusion or even hilarity of the groups they are trying to include. &lt;/p&gt;

&lt;p&gt;So here are some thoughts from a nonbinary person about UX and gender:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;If you don’t need to know, don’t ask.&lt;/strong&gt; Honestly, the only person who needs to be concerned with what my gender is - is my doctor. Odds are most of the sites collecting that information aren’t doing anything with it. And targeted ads are so ridiculous that gender doesn’t actually end up helping the algorithms. So if you are building a user sign-up, maybe just skip the question altogether. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AWsGYluR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxfmjx7hrm33qs2cp4sw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AWsGYluR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zxfmjx7hrm33qs2cp4sw.JPG" alt="Gender questionnaire"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Keep it simple.&lt;/strong&gt; And I don’t mean just having “Man, Woman, Other” as the only three options. Don’t other an entire portion of your userbase by signifying a group of diverse people as “Everybody else”. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--SPk-bGkp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3g9gsxt96ka7i3prb1ka.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SPk-bGkp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/3g9gsxt96ka7i3prb1ka.jpg" alt="Gender questionnaire"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Know what information you are really asking for.&lt;/strong&gt; Do you want to know the gender identity of the user? Or their biological sex? Or just what pronouns to use for them? Be specific in what you’re asking for, and have your response options reflect that. If you ask for “gender” most people assume you mean gender identity, and if you ask for sex people will wonder why you are so interested in what their biological makeup is. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---M-3V1XO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hbggl6l75y6e2rm6yexv.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---M-3V1XO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hbggl6l75y6e2rm6yexv.JPG" alt="Gender questionnaire"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Ask for input, especially from non-cis people.&lt;/strong&gt; If your options are “Man, Woman, Transgender” you are asking every binary-identifying trans person to decide if they identify primarily as trans or as a man or woman. Many trans women and trans men would prefer to just answer “man” or “woman” so if you think you’re collecting data on non-cisgender users - you’re not. Before you launch your form, get somebody to look at it. Explain to them the info you want to collect and why, and let them tell you how they would interpret the question and what information they would give. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ydCgw9rU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hohhglei0d22uyc8gj9p.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ydCgw9rU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hohhglei0d22uyc8gj9p.JPG" alt="Gender questionnaire"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Just make it a text input. There are more examples of what not to do than I could ever put in one blog. And there are a lot of different gender identities out there, and if you try to add them all to one dropdown it starts to look ridiculous. So, whenever possible, allow for direct user input, so a person can be as specific as they want. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ZrXmB56l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hpvs39qr8d5y6z1dw09w.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZrXmB56l--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/hpvs39qr8d5y6z1dw09w.jpg" alt="Gender questionnaire"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But the biggest thing I want to come back to is that you probably don’t need to know the gender, so why are you even asking? &lt;/p&gt;

&lt;p&gt;And if it’s a mandated question, please please just give more options than “man” and “woman”, especially if you are claiming to be supportive of LGBTQ employees and job seekers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2mODU4F0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/IhgPoG4oMDOyex1RjQ/200.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2mODU4F0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media0.giphy.com/media/IhgPoG4oMDOyex1RjQ/200.gif" alt="Trans pride flag gif"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My First Hackathon</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Sun, 06 Jun 2021 16:56:04 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/my-first-hackathon-1a3p</link>
      <guid>https://dev.to/sebastianspiegel/my-first-hackathon-1a3p</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l0Iic3AW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1218186973665550338/n5XxLkHt_400x400.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l0Iic3AW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://pbs.twimg.com/profile_images/1218186973665550338/n5XxLkHt_400x400.jpg" alt="out in tech logo"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Yesterday I completed my very first Hackathon! A few weeks ago I submitted an application to Out in Tech for their Pride Month Digital Corps Build Day and was extremely excited to be chosen to contribute. It was a full-day event that allowed me to give back to the LGBTQ community and work with some talented queers in tech. &lt;/p&gt;

&lt;p&gt;The purpose of the event was to build websites for LGBTQ and BIPOC business owners. One hundred people were a part of the event with backgrounds in design, programming, project management - more than I could list without looking like a job board. &lt;/p&gt;

&lt;p&gt;My group was 12 people and our client, Bronx Clay, was a Bronx-based pottery business. The owners wanted a website where they could sell their pottery and merchandise, and provide information about the classes. &lt;/p&gt;

&lt;p&gt;We split up into 3 teams: design, content, and store. Since I have experience with eCommerce I volunteered to be on the store team. This was my first time building a WordPress website and my first time working with the plugin WooCommerce but I found both very easy to navigate. My other teammates also weren’t familiar with the frameworks so we spent some time figuring out exactly what we needed, then jumped on a call with the client. &lt;/p&gt;

&lt;p&gt;The client awesome, not just for the work she does in the community, but was very easy to talk to and was able to answer our questions and communicate exactly what she was looking for. Having worked with clients who can’t even do one of those things, I think we lucked out! &lt;/p&gt;

&lt;p&gt;The build day was 7 hours, including the hour-long intro, 30-minute presentation, and lunch break. So the fact that we built an entire site in what was only 5 hours is incredible and the entire thing looked amazing at the end. I can’t wait for it to fully launch and I hope that having the site means that Bronx Clay can raise more money for their community and expand to their own site quickly! &lt;/p&gt;

&lt;p&gt;It’s been a while since I worked on a team like this, and the biggest thing I learned was that no matter the industry it’s all very much the same. 12 people is a pretty big team for one project, so it was very necessary we divide it up into the different components for smaller teams to take on. There was also a struggle with the hierarchy of the group, which I think came from it being a volunteer lead project, as opposed to a business where there would be clearly defined roles moving into a team. &lt;/p&gt;

&lt;p&gt;There is a difference working in queer groups, that I’ve noticed across the board with my work in the community. You get more people who are used to being talked over, ignored, or just not taken seriously. So when marginalized people work together, they tend to hold collaboration and communication in high regard. Nobody wants to make anybody else feel like their input isn’t valued, so there is a lot more group consultation. This can be great, as it gives people space who don’t always get it, but it can also drag things and make simple decisions a lot harder. It’s a trade-off I’ve come up against many times, and it can be very frustrating. That being said, I still prefer it to the situations I’ve been in where people are so disheartened that they quit the team, or are made to feel like they are useless. Even if all that was left was the less glamorous, repetitive, or “easy” tasks, I knew I was contributing to my team and was appreciated for it. &lt;/p&gt;

&lt;p&gt;I’m not sure if this experience is typical of hackathons, but now that I’ve got one under my belt I’m excited to do more! The experience and networking that I went in for were great, but getting to spend the day with a bunch of queers and make new friends is what made the day for me. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--T2Dqk-Zz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/Ga1UmWZ9jdYOc/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--T2Dqk-Zz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://media1.giphy.com/media/Ga1UmWZ9jdYOc/giphy.gif" alt="Happy pride"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>3 Ways to Spice up UX for Dummies</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Sun, 30 May 2021 14:22:49 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/3-ways-to-spice-up-ux-for-dummies-23lo</link>
      <guid>https://dev.to/sebastianspiegel/3-ways-to-spice-up-ux-for-dummies-23lo</guid>
      <description>&lt;h1&gt;
  
  
  Fun with DOM and JSX
&lt;/h1&gt;

&lt;p&gt;Looking to jazz up an application? Not a designer or a UX expert? Here are my favorite simple, interactive elements I’ve added to my applications.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flippin’ Card
&lt;/h3&gt;

&lt;p&gt;I utilized this in an application where I was displaying a digital version of seed packets. On one side, the photo and name of the plant; on the other side, the planting and growing information. I utilized the npm &lt;a href="https://www.npmjs.com/package/react-card-flip"&gt;react-card-flip&lt;/a&gt;, which is very easy to install and implement. I customized my version to be a click on the div element itself instead of a specified button, like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;render(){
        return(
            &amp;lt;div className="card-hidden" onClick={this.handleClick}&amp;gt;
                &amp;lt;ReactCardFlip isFlipped={this.state.isFlipped} flipDirection="horizontal"&amp;gt;
                    &amp;lt;div className="card" onClick={this.handleClick}&amp;gt;
                        &amp;lt;SeedCardFront seed={this.props.seed} handleClick={this.handleClick} /&amp;gt;
                        &amp;lt;br /&amp;gt;
                        {this.renderButton()}
                    &amp;lt;/div&amp;gt;
                    &amp;lt;div className="card" onClick={this.handleClick}&amp;gt;
                        &amp;lt;SeedCardBack seed={this.props.seed} handleClick={this.handleClick} /&amp;gt;
                    &amp;lt;/div&amp;gt;
                &amp;lt;/ReactCardFlip&amp;gt;
            &amp;lt;/div&amp;gt;
        )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a few design adjustments, you can even get a nice 3D effect! To further customize, you could change the onClick to a mouseOver event, or even create a 3-sided digital object! &lt;/p&gt;

&lt;p&gt;I love this specifically for decluttering the DOM. You have the option for twice the information without taking up as much space. &lt;/p&gt;

&lt;h3&gt;
  
  
  Drag-n-Drop
&lt;/h3&gt;

&lt;p&gt;Draggable list elements are the main feature of my Story Peddler application. The purpose of this is for users to be able to rearrange story elements, which I refer to as plot points for the purpose of this version of the app. The feature is meant to replicate what many writers do in the real world: writing their plot points or chapters or whathaveyou on sticky notes or index cards, which they can then move around as they organize their structure. To replicate the same ease in the digital space I wanted draggable elements that save in their new order when dropped into their new position, like my favorite Apple weather app with locations. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2w3gz8um--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/cssscript.com/wp-content/uploads/2015/04/dragula.js.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2w3gz8um--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/cssscript.com/wp-content/uploads/2015/04/dragula.js.jpg" alt="preview of dragable"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I started with &lt;a href="https://www.cssscript.com/best-drag-drop-javascript-libraries/"&gt;this article&lt;/a&gt; where you can find a ton of great drag-and-drop options. Play around with them all to find the one that fits your application the best! &lt;/p&gt;

&lt;h3&gt;
  
  
  Color Changing Buttons
&lt;/h3&gt;

&lt;p&gt;While working on my first version of Story Peddler I utilized a free Bootstrap theme from Bootswatch called &lt;a href="https://bootswatch.com/sketchy/"&gt;Sketchy&lt;/a&gt;, and found one of my favorite easy to implement design elements. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--3V7fe_pp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wj44xgmyi3v9aglnv1y7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--3V7fe_pp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/wj44xgmyi3v9aglnv1y7.png" alt="Screenshot of Bootswatch button preview"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The applications colors of black and white were actually meant to evoke the idea of a whiteboard, so having the pops of color on their worked really well for this particular application, and it’s very easy to implement into any css folder, though I had never had cause to user the .hover tag before this. &lt;/p&gt;

&lt;p&gt;Utilizing the hover tag can be very helpful for UX and visual accessibility (though keep in mind it won’t transfer to a mobile platform!) I’ve also used hover to thicken the border of a div element to highlight it. It’s a small detail you’ll find in many applications and sites, but for a project can really bring it to the next level visually. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Finding Inspiration for Coding projects </title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Wed, 19 May 2021 13:20:43 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/finding-inspiration-for-coding-projects-i6j</link>
      <guid>https://dev.to/sebastianspiegel/finding-inspiration-for-coding-projects-i6j</guid>
      <description>&lt;p&gt;When I was doing the software engineering bootcamp at Flatiron, the biggest struggle outside of the technical challenges was coming up with ideas for the many milestone projects. For some of them, I was able to come up with ideas fairly easily and jump right into coding. Others took me longer to piece together, and I ended up writing out different ways and places to find inspiration. For anybody else struggling with project ideas, whether for a bootcamp or just a personal project to level up your skills, here is what I came up with:&lt;/p&gt;

&lt;h3&gt;
  
  
  Create a digital version of something to use/do often
&lt;/h3&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%2Fwww.cs.uic.edu%2F~rbaridi%2FTicTacToe2.JPG" 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%2Fwww.cs.uic.edu%2F~rbaridi%2FTicTacToe2.JPG" alt="computer tic tac toe game"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is a popular one for early projects; I know many people who created basic digital board games like tic tac toe, checkers, or backgammon. It’s a great way to work on your UI and have fun with some design if you build out a frontend with JavaScript, or you can do a CLI version (I did a CLI two-player tic-tac-toe!). &lt;/p&gt;

&lt;p&gt;You can also create digital planners or diaries, recipe books, even a family photo album. Just pick anything physical you interact with during the day, and think about a version of it that could exist digitally. There are a million different calendar apps in the world, but not yet one created by you!&lt;/p&gt;

&lt;p&gt;I got the inspiration for my Tarot Dictionary when watching a friend flip through the guide that came with her deck. The goal to make it as easy as a few clicks to get to a specific card is what guided my build of the application. Others in my cohort make language dictionaries or basic translation apps for travel. &lt;/p&gt;

&lt;h3&gt;
  
  
  Recreate your favorite app
&lt;/h3&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%2Fq3p9g6n2.rocketcdn.me%2Fwp-content%2Fml-loads%2F2016%2F08%2Fsocial-media-mobile-icons-snapchat-facebook-instagram-ss-800x450-3-800x450.jpg" 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%2Fq3p9g6n2.rocketcdn.me%2Fwp-content%2Fml-loads%2F2016%2F08%2Fsocial-media-mobile-icons-snapchat-facebook-instagram-ss-800x450-3-800x450.jpg" alt="screenshot of phone screen showing social media applications"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Speaking of apps that already exist, another often seen project is simply recreating popular apps! Twitter, Instagram, or just a simple blog are all great ways to get a deeper understanding of how these apps work from the inside. It doesn’t have to be an exact match, and odds are it’s not going to be anything that improved upon the original (though kudos if it is!), it’s all just about the practice. &lt;/p&gt;

&lt;p&gt;If your favorite app is Co-Star, make your own version of an astrology program. If the most used app on your phone is Seamless, find an API that provides restaurants based on zip code and make your own Yelp! Even better if you can think of something to add that the others don’t, even if it’s not a feature that the majority would be interested in. “I always wished that this app included this feature, so I build my own” is a fantastic thing to tell somebody you’re explaining your work to, like an interviewer or recruiter. &lt;/p&gt;

&lt;h3&gt;
  
  
  Ask your family or friends
&lt;/h3&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%2Fsonstrust.files.wordpress.com%2F2017%2F11%2Fonline-poll.png" 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%2Fsonstrust.files.wordpress.com%2F2017%2F11%2Fonline-poll.png" alt="tablet with a generic infographic"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Many of my project ideas came from trying to solve real-world problems. I made a narrative organizer for a writer friend who wanted to be able to access notes when she didn’t have a notebook handy. I made a gardening application for my mom so she could organize her plants and easily look up all the planting information she needed.&lt;/p&gt;

&lt;p&gt;I also started including crowd-sourcing into all my projects, when coming up with possible features. I posted the basic idea for the app and asked people to say what they would like to see included, what types of things would make them more likely to use or download that type of application. This is another great thing to include when explaining your app!&lt;/p&gt;

&lt;p&gt;An application should have a narrative built into it, the way the user interacts with it being a seamless story from start to finish. But the way you built it is also a narrative, and recruiters love to hear it. Wherever the idea came from, expound on it when you explain your projects. And if you don’t have a good reason for why you picked a project idea, and especially if you’re not feeling particularly inspired by what you are building, that might not be the project you should work on. I built an application completely based on the Witcher game series simply because it was interesting to me, but the way I can talk about the application makes people want to hear about it, even if they aren’t familiar with the inspiration. &lt;/p&gt;

&lt;p&gt;There is a lot of inspiration to be found for coding projects, and hopefully, if you are in the midst of a block these ideas have helped you! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Nav in Native</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Tue, 11 May 2021 21:21:46 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/nav-in-native-47nm</link>
      <guid>https://dev.to/sebastianspiegel/nav-in-native-47nm</guid>
      <description>&lt;p&gt;This week I have been building my first React Native application. I started off with just changing the  and styles, making sure I understood how ‘flex’ works and the different core components. To do this I made several component files and took turns returning them as I played with them. But in a real mobile app, which I intended to build, there is navigation, just like in a web app. &lt;/p&gt;

&lt;p&gt;So clearly, this wasn’t going to cut it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;return (
    &amp;lt;Welcome /&amp;gt;
    // &amp;lt;Index /&amp;gt;
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: If you already have an app and want to incorporate React Native, it’s recommending to use the react-native-navigation library &lt;a href="https://wix.github.io/react-native-navigation/docs/basic-navigation"&gt;here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;There are many libraries to install to use React Navigation. I’m using expo, so I installed using the following, but you can check out the &lt;a href="https://reactnavigation.org/docs/getting-started"&gt;documentation&lt;/a&gt; if you have a different setup for your app.&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 @react-navigation/native
expo install react-native-gesture-handler react-native-reanimated react-native-screens react-native-safe-area-context @react-native-community/masked-view
npm install @react-navigation/stack
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you are familiar with vanilla React (which you really should be first), then the setup for navigation looks very similar to routes, just different words! The setup should happen at the top level of your app (usually App.js). You start off importing these two libraries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { NavigationContainer } from '@react-navigation/native';
import { createStackNavigator } from '@react-navigation/stack';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Inside of your App function, you then need to have a way to call upon the createStackNavigator function, using this line: &lt;code&gt;const Stack = createStackNavigator();&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That’s the setup! Now you have everything you need to use to wrap up the screens that you want to render. So now my App.js is looking 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;return (
   &amp;lt;NavigationContainer&amp;gt;
     &amp;lt;Stack.Navigator&amp;gt;
       &amp;lt;Stack.Screen name="Welcome" component={Welcome}/&amp;gt;
     &amp;lt;/Stack.Navigator&amp;gt;
   &amp;lt;/NavigationContainer&amp;gt;

 );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next time I had to figure out was using props, so I coud also get my Index component working. For the purposes of testing, I had all my data in the top level of my app (later I plan to replace that with a quick fetch to an API I’ve already picked out). &lt;/p&gt;

&lt;p&gt;For React Native navigation, you can’t pass an inline function like: &lt;code&gt;component={() =&amp;gt; &amp;lt;HomeScreen /&amp;gt;}&lt;/code&gt;&lt;br&gt;
Instead, much like you would see for a Route in vanilla React, you wrap the component like so:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Stack.Screen name="Index"&amp;gt;
         {props =&amp;gt; &amp;lt;Index {...props} cards={cards} /&amp;gt;}
&amp;lt;/Stack.Screen&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In order for my function to properly receive the props, I used memo (there are a few other options, but this worked well for me!)&lt;br&gt;
So I changed this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Index = (props) =&amp;gt; {
   return(
      // render here
   )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const Index = React.memo(function Index(props) {
   return(
      // render here
   )
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My Index is using FlatList, so I was getting a warning on my simulator, which I believe is the Native version of the warning you get when you don’t give child components individual keys in vanilla React. So if you get this error: &lt;/p&gt;

&lt;p&gt;Warning: Failed child context type: Invalid child context &lt;code&gt;virtualizedCell.cellKey&lt;/code&gt; of type &lt;code&gt;number&lt;/code&gt; supplied to &lt;code&gt;CellRenderer&lt;/code&gt;, expected &lt;code&gt;string&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Add this where you are rendering the components: &lt;code&gt;keyExtractor={item =&amp;gt; item.index_id.toString()}&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now I successfully had two different components, but only the top one will render when the app starts, and unlike a webpage, you don’t have the option of just putting in the URL to get to a different route. So I added a button to my Welcome screen, to navigate to my Index.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Button color="white"
         onPress={() =&amp;gt; {
           navigation.navigate('Index')
         }}
         title="Start"
       /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note: for functional components, it’s a good idea to destructure props, but if you don’t want to do that remember to put &lt;code&gt;props.navigation.navigate(‘Component’)&lt;/code&gt; instead. &lt;/p&gt;

&lt;p&gt;If you want to navigate one page back you can use an easy back button like so: &lt;code&gt;&amp;lt;Button title="Go back" onPress={() =&amp;gt; navigation.goBack()} /&amp;gt;&lt;/code&gt;&lt;br&gt;
Though with native-gesture-handler the user can also swipe to move a page back. &lt;/p&gt;

&lt;p&gt;So that’s the basics of how I set up navigation in my current React Native application! This is definitely the easiest way to get started, and there is so much more to learn further down the line. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>From A Single Page Application to React</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Tue, 04 May 2021 13:24:05 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/from-a-single-page-application-to-react-30o8</link>
      <guid>https://dev.to/sebastianspiegel/from-a-single-page-application-to-react-30o8</guid>
      <description>&lt;p&gt;(I previously blogged about building Story Peddler &lt;a href="https://dev.to/sebastianspiegel/to-be-or-not-to-be-a-hidden-html-tag-15hd"&gt;here&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;What does a bootcamp grad work on when the bootcamp is over? (Other than the job search, LeetCode challenges, networking, hackathons, and endless DSA practice.) Well, a good place to start is with old projects, which is where I turned when I finished up with Flatiron a few weeks ago. &lt;/p&gt;

&lt;p&gt;The idea for Story Peddler came from a friend of mine, who wanted to take her narrative planning to a virtual platform but wasn’t able to find an application that included an editable ordered list (for keeping track of plot points). The original application was a simple one-page JavaScript with a Ruby API backend that allowed a single user to create ‘Stories’ with associated ‘Characters’ and ‘Plot Points’. One focus while making it was for it to be flexible, just as usable for a person writing a novel as it could be for somebody writing a comic book, a film, or an arc for a table-top campaign. Within the time frame and parameters of this being a bootcamp project, I wasn’t able to incorporate user auth or other features I crowd-sourced from friends and twitter (like reference sheets for popular story structures). &lt;/p&gt;

&lt;p&gt;I was thrilled to be able to return to this project with more time, and more skill. I especially enjoyed learning React for a separate bootcamp project and was eager to build on my knowledge of the framework. Here are a few things I did to set up Story Peddler 2.0(SP2) and what I have learned so far:&lt;/p&gt;

&lt;h3&gt;
  
  
  User Auth First
&lt;/h3&gt;

&lt;p&gt;I set up a completely new repo for SP2, and the first thing I wanted to tackle was User Auth. Partially this was because I hadn’t yet incorporated User Auth using JavaScript and wanted to learn how to, and partially because I knew from experience that filling in authentications after the fact can be very complicated. &lt;/p&gt;

&lt;p&gt;I read up on and incorporated JWTs, deciding to use local storage for my current user. In the past, with Ruby applications, I had only ever used sessions, so this was a new format for me. (For learning about JWT in a React/Rails app, I highly recommend &lt;a href="https://levelup.gitconnected.com/jwt-auth-in-a-react-rails-app-8a7e6ba1ac0"&gt;this blog post&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Storing the user in the highest level means it’s easy to pass in that information to all other components, whether they are fetching associations of that user (for Story Pedder that would be any stories that the user has created) or if you are dealing with protected routes/authorizations on your front end (if a user is not logged in, my application will re-route them away from story creation forms back to the log-in/sign-up page). &lt;/p&gt;

&lt;h3&gt;
  
  
  Translating to JSX and introducing Routes
&lt;/h3&gt;

&lt;p&gt;When setting up Story Peddler 1.0 the first thing I did was build out my three creation forms: New Story, New Character, and New Plot Point. In SP1 these forms were in the HTML file and a handleClick function made them visible on the DOM, or hidden again. For SP2 I gave them each their own route but was still able to copy the original forms to start with. Since React uses JSX I did have to change a bit of the code, like changing ‘class’ to ‘className’. &lt;/p&gt;

&lt;p&gt;In SP1 I had all of my API requests in one class and the corresponding DOM control functions in another. For SP2 I moved the API requests into the component class rendering the form. Most likely to be refactored at some point, as having this many functions in one class can make it a bit bulky, but for building out it was a reasonable separation. &lt;/p&gt;

&lt;p&gt;Another change I made was in the story view function. In SP1, I created a drop-down in the header where a user could select a story to view on the DOM. Since I now had user pages to play with, I decided to forgo the drop-down and instead created story cards for the user page. From the display of cards, a user can select one to view and from there gets their options to edit or delete elements in a story. &lt;/p&gt;

&lt;p&gt;Having specified routes for each story fulfilled another function I had to previously leave out. Now a user can send a story to somebody else to view. In SP1, a story could only be viewed after selecting it from the dropdown (or after creating it, when it would automatically append to the DOM). Now, if a user knows their story id, they can go to /stories/:id or send that route to somebody else.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;Route exact path="/stories/new"&amp;gt;
     &amp;lt;NewStory user={this.state.user} /&amp;gt;
&amp;lt;/Route&amp;gt;
&amp;lt;Route path="/stories/:id" component={ShowStory} /&amp;gt;
&amp;lt;Route exact path='/characters/new'&amp;gt;
     &amp;lt;NewCharacter user={this.state.user} /&amp;gt;
&amp;lt;/Route&amp;gt;
&amp;lt;Route exact path ='/plotpoints/new'&amp;gt;
     &amp;lt;NewPlotPoint user={this.state.user} /&amp;gt;
&amp;lt;/Route&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Better Design
&lt;/h3&gt;

&lt;p&gt;While I haven't entered the stage of the big design updates I have planned, I did take a few moments to review some of the feedback from SP1.&lt;/p&gt;

&lt;p&gt;For example, here is my new story form from SP1 vs SP2:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tAlWCsc---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3b42tf4sbi8woqztc93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tAlWCsc---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3b42tf4sbi8woqztc93.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l3gybRBg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uqyt9xz2imtiqq3y329.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l3gybRBg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8uqyt9xz2imtiqq3y329.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not perfect, but with just a few CSS tweaks the spacing looks so much better, and taking that time during the first iteration would have made a big difference. &lt;/p&gt;

&lt;h3&gt;
  
  
  More to come
&lt;/h3&gt;

&lt;p&gt;So far Story Peddler 2.0 has been extremely fun to work on! Even though it’s an application I already built to completion, doing it in the React framework makes it feel completely new. At the time of this post I would estimate I’m just over halfway through, and excited to get the brand new Story Peddler 2.0 hosted and shared for all types of writers and creators! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>All Applications are Stories </title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Mon, 29 Mar 2021 15:24:20 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/all-applications-are-stories-29fa</link>
      <guid>https://dev.to/sebastianspiegel/all-applications-are-stories-29fa</guid>
      <description>&lt;p&gt;I’ve always been a storyteller at heart. Whether producing a show or writing, my passion was always giving people a story to follow. I’ve found joy in programming coming from the same place. While most applications don’t include a story in the traditional sense, there is still a trail to leave. I like to build new applications starting at this point. When developing a concept a good question to ask is ‘What is the story of the user who would want this application?’ During my last build, I realized how important the story continues to be through the entire process. Not just the story that leads a user to an application, but the story of the user while using the application as well. For me, this became a map. An ugly, ugly map. I am a storyteller, but not an artist. &lt;/p&gt;

&lt;h3&gt;
  
  
  My name is Sebastian and I'm a recovering screenwriter
&lt;/h3&gt;

&lt;p&gt;If you decide you want to write a screenplay (an unfortunate ailment that affects thousands a year) you'll find yourself with as many different ways to plan your script as there are people trying to write scripts. I know because I've written several myself, and over many years formulated my own way of doing the prep work. &lt;/p&gt;

&lt;p&gt;I'm pretty proud of some of my breakdowns. I use a large piece of sketch paper, rulers, carefully printing by hand an easy-to-follow guide. I know that if I can complete the breakdown, I can write the story. I can show them to others and have them follow along. I can use them as examples to teach others my process. &lt;/p&gt;

&lt;p&gt;But getting there took several years. My first few attempts? Crazed scribbles across pages of notebook paper, entire sections scratched out and illegible notes written into margins. Scholars will continue to debate exactly which language some of it might be for decades to comes. Figuring out your perfect method takes time and error. But in the end, I came out with something that was not helpful to the writing process but invaluable. &lt;/p&gt;

&lt;p&gt;I find myself in the midst of a very similar process for planning out new applications. I've seen many examples of how others plan and map out their sites, but I know that it will take trial and error for me to figure out what it is I need to be successful. And it's not very pretty, but it's crucial. &lt;/p&gt;

&lt;h3&gt;
  
  
  Pirate : Treasure map :: Programmer : diagrams.net
&lt;/h3&gt;

&lt;p&gt;There are of course people who have no trouble holding everything in their head or people who can follow along with their own hasty notes that skip around with no reference to what component or logic they are noting. I envy them and send my best wishes to their team members who do not possess this same skill.&lt;/p&gt;

&lt;p&gt;For the rest of us, please trust me when I say: you need a guide. And as my own projects get bigger and more complex I find the only thing that can untangle my thoughts and help me navigate and focus is a visual map. At some point, I hope to get to the same point as my script breakdowns, something organized and clean that can help translate my thoughts to others as well as organizing them for myself. &lt;/p&gt;

&lt;p&gt;For now, I have this: &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XXqzARbD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ur72fj6fvr90y6wilt8u.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XXqzARbD--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ur72fj6fvr90y6wilt8u.jpg" alt="notebook page covered in many different colors of ink presumably explaining routes in an application"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This page is the only thing that kept me sane while building this application. If you squint, you can see the user story I was trying to build.&lt;/p&gt;

&lt;p&gt;The initial landing page branches off into what is essentially my navbar, and then I’ve broken down those into the components that are included in those containers, with a few arrows to show how a user might get from one to another. &lt;/p&gt;

&lt;p&gt;I’ve come back to this when I’m lost - that’s why I like to call it a map. “What am I doing, what is my goal right now?” is a question I find myself asking whenever I get frustrated with a bit of code. I think everybody has had a moment where you get so caught up in a bug that you forget what the original goal was, and sometimes the bug you working out is in a bit of code you don’t even need! The map helps to get me back on track and reminds me to put myself in the user’s shoes. What is my user expecting, what will they want to do from this point? &lt;/p&gt;

&lt;h3&gt;
  
  
  Become the guide
&lt;/h3&gt;

&lt;p&gt;Finally, on the subject of putting yourself in the user’s shoes, if you hand a site over, even one with a ton of great and interesting functionality, a user isn’t going to know what to do on their own. A good site tells the user exactly what to do. Think of any social media site. There is usually a big log-in component right on the main page, and once a user is logged in that is replaced with whatever posting option that site has. It’s always front and center, usually prompted as well (though less so these days, but remember the OG facebook “I think…” prompts?). Users want to be told what they should do and what they can do, and in this way, you can lead your user through the application. Navbars are only part of the way to do this, but adding in prompts is better. Never underestimate how obvious your functionality is. “New Post” isn’t as dynamic as “Create a new post”. Try to phrase all functionality as a call to action, you can always pare them down later (a ‘like this post’ button can easily just be labeled ‘like’ thanks to the popularity of the feature). &lt;/p&gt;

&lt;p&gt;Your user doesn’t get your map when they come to the site, so you should work to translate that map into a guide. Design can help a lot here, making the more important component stand out on a page, but how they are labeled can be just as important. &lt;/p&gt;

&lt;h2&gt;
  
  
  Epilogue
&lt;/h2&gt;

&lt;p&gt;It still comes back to the story. In the end, you put that story into the user’s hands. What is the story they are telling? Is it a blog post about their day, or a photo of where they are at that moment, or their plan for their garden this season? Everywhere we travel on the web, we leave a story. A good application assists in this process, as well as protecting it to return to again. &lt;/p&gt;

&lt;p&gt;So when you get lost in the complications of the code, remember to surface and check you are still on track. Is what you are doing helping you write the story you want to tell? And if you need a moment of zen, the song that inspired the title of this blog is &lt;a href="https://open.spotify.com/track/3yVKDuoppFGIrP6u9fv5jy?si=6mTqQ4FGRp2fV8Vvd5dl2A"&gt;‘All Boundaries Are Conventions” from the Cloud Atlas soundtrack&lt;/a&gt;.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React routes for if you've already read all the other blogs on react routes </title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Wed, 24 Mar 2021 16:50:16 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/react-routes-for-if-you-ve-already-read-all-the-other-blogs-on-react-routes-299n</link>
      <guid>https://dev.to/sebastianspiegel/react-routes-for-if-you-ve-already-read-all-the-other-blogs-on-react-routes-299n</guid>
      <description>&lt;p&gt;This one is for beginners, so everybody else be warned. &lt;/p&gt;

&lt;p&gt;I lost track of how many articles and blog posts I read while trying to set up an auto re-route, and absolutely none of them helped me. I kept getting bogged down by too many options and technicalities. They all included so much information about protecting your data, a million booleans to check authentications, just way more than what I was trying to do. If you want to do anything more complicated than 'click button, different web page', you should go read some of those other articles. This is more of an 'I honestly can no longer be bothered I just want you to do this one simple thing.'&lt;/p&gt;

&lt;p&gt;The steps are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;First page loads&lt;/li&gt;
&lt;li&gt;User clicks a button/link/whatever you wanna try adding an event listener to&lt;/li&gt;
&lt;li&gt;The page redirects to the Second page &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I used this to redirect from a submit to an index page (with no errors or backend authentications). &lt;/p&gt;

&lt;p&gt;First, import Redirect like so:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import { Redirect } from "react-router";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Next, you'll need a function similar to this one, that will be in charge of adding a redirect key to state and setting the boolean to 'true'.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setRedirect = () =&amp;gt; {
        this.setState({
            ...this.state,
            redirect: true
        })
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you haven't dealt with state much or are just starting to use React, that spread operator is a very important habit to get into. Even if you're not doing anything else at all in this component, get used to putting ...this.state every time you setState(). &lt;/p&gt;

&lt;p&gt;So now you need a function that will check that boolean. Something 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;renderRedirect = () =&amp;gt; {
        if (this.state.redirect) {
          return &amp;lt;Redirect to='/seeds' /&amp;gt;
        }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Short and sweet, if you need no other validations before you redirect that's all you need. &lt;/p&gt;

&lt;p&gt;The next step is to call renderRirect() in your return. If you are in a class component (it would be called something like &lt;code&gt;class MyClassComponent extends React.Component&lt;/code&gt;) you'll do this inside the return of your render function. It will look 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;render(){
        return(
            &amp;lt;div&amp;gt;
                {this.renderRedirect()}
                {/* Whatever link/button/etc you are putting your event listener on */}
            &amp;lt;/div&amp;gt;
        )
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So now, when the page loads it will run the renderRedirect function, which in turn will check state and see if the Redirect is valid. The last step is to go to your event listener function and call setRedirect(). If you are in a class component make sure you're calling it using this:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;this.setRedirect()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The page will re-render as it is want to do when an event listener is triggered, and the user will be automatically redirected!&lt;/p&gt;

&lt;p&gt;If you are trying to redirect from a functional component (something like &lt;code&gt;export default function FunctionalComponent(props)&lt;/code&gt;) there is also a very simple option, using history.push().&lt;/p&gt;

&lt;p&gt;This is what I did for redirecting from an index to a show page. The user would be taking the same steps as before. The props I passed into my function were the objects (in this case a users gardens) being displayed, which included the object id. &lt;/p&gt;

&lt;p&gt;First, import useHistory:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;import {useHistory} from 'react-router-dom';&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then set a variable to call the useHistory() hook you've imported:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;const history = useHistory()&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then in your event listener, you can call history.push. Here's what mine looks like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function handleClick(){
        history.push(`/gardens/${props.gardenId}`)
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So you're basically telling your application "this is where I want to go when this event listener is fired". &lt;/p&gt;

&lt;p&gt;To read more about these hooks you should check out this documentation: &lt;a href="https://reactrouter.com/web/api/Hooks"&gt;reactrouter.com&lt;/a&gt;. You'll the same exact code as before for useHistory, but less breakdown. &lt;/p&gt;

&lt;p&gt;Again, this is all for beginners. Hi, hello, let's hold each other's hands and baby step our way through the most basic things until we understand them fully and completely. Otherwise, what's the point in even trying to tackle the harder stuff? &lt;/p&gt;

&lt;p&gt;Also, so many things that happen when a user is interacting with a web app are invisible, so it can be very exciting to code something that actually an immediate visual result. I don't see why we don't celebrate every successful page render! &lt;/p&gt;

&lt;p&gt;There are many, many ways to use routes and redirects in React. Probably better ways than this! To me, however, the best way is the way that 1) gets the job done and 2) that the programmer understands. If you just start copying and pasting from some article without knowing what any of it does, you'll be lost when you inevitably need to debug. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>To be or not to be... a hidden HTML tag</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Sat, 20 Feb 2021 15:31:15 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/to-be-or-not-to-be-a-hidden-html-tag-15hd</link>
      <guid>https://dev.to/sebastianspiegel/to-be-or-not-to-be-a-hidden-html-tag-15hd</guid>
      <description>&lt;p&gt;When updating the DOM with new information, you really get two options:&lt;/p&gt;

&lt;p&gt;1) Have all the HTMl already sitting in your file, which you then can select and edit, or&lt;/p&gt;

&lt;p&gt;2) Build from scratch and append it to the DOM. &lt;/p&gt;

&lt;p&gt;In my latest application, I utilized both methods, sometimes at the same time. I'm not the ultimate knowledgeable source on the best method, but for getting started I have pulled together a few basic pros and cons. &lt;/p&gt;

&lt;h3&gt;
  
  
  Hiding in plain HTML view
&lt;/h3&gt;

&lt;p&gt;One of the first things I created when I starting building were the forms I wanted to add new objects to the database. If you aren't sure what the HTML should look like, the easiest thing to do is just write it out directly in plain HTML. I also knew I didn't want the forms cluttering up the page all the time, so I added a 'hidden' attribute. This wasn't intended to be a feature of the application at all; I wrote the forms directly into the index file because it was easier than trying to JS code them in and then hide them because I wasn't ready to deal with them further. &lt;/p&gt;

&lt;p&gt;But then I realized I kind of liked it like that. For some things, this might be a security issue, but any of these forms is unhidden with a simple click of a button, and there are validations for any data sent through. For these forms it seemed a safe enough bet to just have them there, hiding until the user wanted to create a new object. &lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VB8DJhBk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhq60d7crl85b2bv2ydz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VB8DJhBk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vhq60d7crl85b2bv2ydz.png" alt="screenshot of application with no elements visible"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The application at the start&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tAlWCsc---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3b42tf4sbi8woqztc93.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tAlWCsc---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/t3b42tf4sbi8woqztc93.png" alt="screenshot of application with new form visible"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;The hidden attribute is removed with the click of a button&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;I followed the same system as I started to build out other parts of the application. Writing it in plain HTML, and then hiding it if I wasn't ready to work on it more or if I only wanted it to appear at certain times. It worked great for my forms, which remain static and never need to be changed. And it was so much easier than spending time finding every element and making sure it was appended to the correct parent, in the correct order. &lt;/p&gt;
&lt;h3&gt;
  
  
  The Jumbotron
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--DvEeCg2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdq1li1fl4a38zpvylgc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--DvEeCg2d--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/cdq1li1fl4a38zpvylgc.png" alt="screenshot of application, black text on white background"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For displaying all of the information for a specified object, I coded in a jumbotron in the middle of the page. I started off with almost all of the HTML hardcoded, with the idea that I would just select the elements I wanted to manipulate and edit them according to whichever object the user wanted to view. This is very possible but I ran into problems when switching to viewing one object to another. &lt;/p&gt;

&lt;p&gt;If my objects were more identical in their structure, I probably could have kept on this way. But my structure allows for a user to have some, many, or no attributes for their object. One fix would be a series of 'ifs'. 'If this data is present, replace the element value, otherwise clear the element value.' But you know what's easier? &lt;/p&gt;

&lt;p&gt;&lt;code&gt;document.querySelect().innerHTML = ""&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That little line of code became my new best friend. I started moving elements out of my index.html and creating them in my code instead. &lt;/p&gt;

&lt;p&gt;Almost immediately I'd make a complete mess of the page. Finding the right parent, appending it in the correct order... I did not do these things correctly at first. But that's fine! It's all trial and error, right? But there is something that can make it smoother...&lt;/p&gt;
&lt;h3&gt;
  
  
  So it turns out 'div' elements actually are helpful!
&lt;/h3&gt;

&lt;p&gt;Who would have thought! I built a nice little skeleton of HTML using div elements, and then it became a lot easier to put all the information in the correct place by just grabbing that div element and appending a new child element to it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="jumbotron" hidden=""&amp;gt;
      &amp;lt;div class="storyInfo"&amp;gt;
    &amp;lt;/div&amp;gt;
      &amp;lt;p&amp;gt;Characters:&amp;lt;/p&amp;gt;
      &amp;lt;ul class="list-group" id="storyCharacters"&amp;gt;
      &amp;lt;/ul&amp;gt;
      &amp;lt;hr class="my-4"&amp;gt;
      &amp;lt;p class="lead"&amp;gt;
        &amp;lt;div class="list-group"&amp;gt;
          &amp;lt;ol id="plot-points"&amp;gt;
            &amp;lt;li class="list-group-item list-group-item-action active"&amp;gt;Plot Points:&amp;lt;/li&amp;gt;
          &amp;lt;/ol&amp;gt;
        &amp;lt;/div&amp;gt;
      &amp;lt;/p&amp;gt;
      &amp;lt;div class="buttons"&amp;gt;&amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this particular example, it doesn't look quite as barebones, because of the CSS tags I'm using (thanks &lt;a href="https://bootswatch.com/"&gt;bootswatch&lt;/a&gt;!) but trust me, this is a great middle man. As you can see, I'm still utilizing the 'hidden' attribute to hide the entire 'jumbotron' div element until I'm ready for it, and I've also got just a couple of specifics hardcoded in, that stays the same for any object that gets displayed. &lt;/p&gt;

&lt;h3&gt;
  
  
  You can't hard code for x
&lt;/h3&gt;

&lt;p&gt;There were of course places where my hardcoded HTML is basically nonexistent. Some of my divs have nothing at all between them, but having the div there as a placeholder makes it way easier to append the element in the exact right spot. &lt;/p&gt;

&lt;p&gt;Like for my character list here:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;ul class="list-group" id="storyCharacters"&amp;gt;&amp;lt;/ul&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;There is no way of knowing how many items are going to be appended to the list. So even though each character object is getting 4 different elements created for it, in this instance it is better practice to create and append those in JS. Otherwise, you are hard coding in the list elements, then grabbing them to edit their values. If each user was only allowed to have 3 characters, I could make that work. But what kind of user experience is that?&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;let characterList = document.querySelector('#storyCharacters')
        characterList.reset

        let newLi = document.createElement('li')
        newLi.className = "list-group-item flex-column align-items-start"
        newLi.id = `${this.name}-${this.story_id}`

        let newDiv = document.createElement('div')
        newDiv.className = "d-flex w-100 justify-content-between"

        let charName = document.createElement('h5')
        charName.className = "mb-1"
        charName.id = `${this.id}-editName`
        charName.innerText = this.name

        let charDes = document.createElement('p')
        charDes.className = "mb-1"
        charDes.id = `${this.id}-editDes`
        charDes.innerText = this.description

        characterList.append(newLi)
        newLi.append(newDiv)
        newDiv.append(charName)
        newLi.append(charDes)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In addition to the li element, each character is getting its own div element, making it easier to ensure that the character name and description are appended correctly. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--AilZJRIF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rsamey21tme4a3ijh3x.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AilZJRIF--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9rsamey21tme4a3ijh3x.png" alt="a screenshot of the character list div"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  And now I've seen the #D3D3D3
&lt;/h3&gt;

&lt;p&gt;Previously when coding HTML I didn't have patience for putting id tags on elements, or wrapping elements in divs. I really only would add on an id for styling purposes, and usually only after the fact. A couple of things helped me get into better practice with this application:&lt;/p&gt;

&lt;p&gt;1) starting out with a good CSS file (thanks &lt;a href="https://bootswatch.com/"&gt;bootswatch&lt;/a&gt;!) meant that as I was adding elements to the dom, I already knew what I wanted them to look like and added the appropriate tags early on. &lt;/p&gt;

&lt;p&gt;2) Coding with the next step in mind. If you know you're going to need to access the value of an input field, it's a good idea to go ahead and give it an id that makes sense (no 'input-tag-002' in this project). Of course, you can always use inspect to find that element you've misplaced, but I had a lot easier time using the same naming conventions throughout the project. &lt;/p&gt;

&lt;p&gt;And honestly, these are two of the biggest takeaways I have from this application. Obvious? Possible. But once in a while, even a master needs a reminder that the simplest best practices make a world of difference &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Scope methods, has_secure_password, and other things that are too powerful for comprehension</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Sat, 23 Jan 2021 20:16:33 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/scope-methods-hassecurepassword-and-other-things-that-are-too-powerful-for-comprehension-3e84</link>
      <guid>https://dev.to/sebastianspiegel/scope-methods-hassecurepassword-and-other-things-that-are-too-powerful-for-comprehension-3e84</guid>
      <description>&lt;p&gt;&lt;em&gt;The following reflects the experience of a new programmer using Ruby on Rails for the first time.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Anybody who says "you can never do too much" hasn't had enough experience with baking or coding.&lt;/p&gt;

&lt;p&gt;If you've ever tried baking in a small batch when your normal recipe is meant to feed 10+, it usually doesn't go exactly according to plan the first time or so. With practice, you learn how much to divide or multiply the amounts, and there are bakers who can measure out enough for the exact number of cupcakes they intend to make without a drop of batter going to waste.&lt;/p&gt;

&lt;p&gt;In coding, it's also easy to do too much. There's harmless if cluttered repetitious code, or extra validations just because you want to make good and sure no invalid users are traipsing down a certain path. There are the ones that end up canceling each other out. &lt;/p&gt;

&lt;p&gt;There's also just straight-up making two different methods that do the same exact thing because you forgot you'd already made one and put it in your model and then you go and do the same thing and slide it into a helper. &lt;/p&gt;

&lt;p&gt;Then there is just doing &lt;em&gt;too much&lt;/em&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Here's where we go &lt;em&gt;off&lt;/em&gt; the rails&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Ok, let me see if I can backtrack and break this down.&lt;/p&gt;

&lt;p&gt;The end goal is to display the name of the Location that has the most Monsters. A Contract includes both the location.id and the monster.id. &lt;/p&gt;

&lt;p&gt;We start with a join table, linking contracts.location_id with locations.id, and then group them by location_id. Order that by the count of location_id (descending order), and the first one we get back is the location.id that has appeared the most number of times across all contracts! &lt;/p&gt;

&lt;p&gt;Well, actually what we get back from running Active Record through a rails app is an array of two numbers. But we have a method in the Contract model that at least got us that far:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;scope :location_with_most_monsters, -&amp;gt; {select(:location_id).joins(:location).group(:location_id).order("count_location_id DESC").count.first}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This took several hours. I made a note for myself: first number = location_id, second number = # of contracts out.&lt;/p&gt;

&lt;p&gt;I stared at this for a while, trying to poke that array into being... any type of useable information. Then I went to bed. &lt;/p&gt;

&lt;p&gt;New day! We have an array, and one of those numbers happens to be the id number of a location. I need that location name. I can't just give my client an id number, it would be meaningless. &lt;/p&gt;

&lt;p&gt;So let's take that first method over to the location model, try to find that location. Luckily a full night of sleep helped me remember that I could call .first on that array to get back just that first number (good thing I left that note for myself). We can call .find on an integer, and this is the integer we want! &lt;/p&gt;

&lt;p&gt;So we have our second model:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;scope :with_most_monsters, -&amp;gt; { find(Contract.location_with_most_monsters.first) }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that we have the Location instance, we can take it over to the controller and save it to a variable for our view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@dangertown = Location.with_most_monsters
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So close! Of course, we can't just give our client this entire instance. They don't care about the date and time this was added to the database or the id number! They need a name. There are monsters and this particular location has a lot of them. Lives could be at stake. &lt;/p&gt;

&lt;p&gt;So in the view, we provide that name:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Location with most monsters: &amp;lt;%= @dangertown.name %&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There you go! Hours of work, so much SQL, to get 4 lines of code so that a client knows which town has the most monsters. &lt;/p&gt;

&lt;p&gt;HOURS of work. I can't actually say how many, only that when I started the sun was out and my roommate wasn't home from work, and when my headphones died and I couldn't listen to the Chez Baldwin playlist anymore, the sun was gone and my roommate was cleaning up their dishes from dinner. &lt;/p&gt;

&lt;p&gt;Why would any sane person need to spend that much time to come out with so little code that does ONE thing? &lt;/p&gt;

&lt;p&gt;Well, lives are at stake! Fictional lives, dealing with fictional monsters. But one day the lives might be real. At least next time it probably won't take me as many hours to figure out the logic. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Lives, and passwords, at stake&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;"Well", you might say "at least you didn't then go on to spend several hours coding something that you didn't need to code!"&lt;/p&gt;

&lt;p&gt;"Oh," I might reply "&lt;em&gt;but I did&lt;/em&gt;."&lt;/p&gt;

&lt;p&gt;Security is important (lives might depend on that as well!), so adding a password confirmation for new users seemed like a good idea. &lt;/p&gt;

&lt;p&gt;Ok, cool! Let's add a 'password_confirmation' field to the form, and then of course we'll need to add that to our permitted params and then--&lt;/p&gt;

&lt;p&gt;You stop. You stop what you are doing right now because that's it. has_secure_password knows what it's doing. You do not need to go into the controller and put, idk, something like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if params[:user][:password] != params[:user][:password_confirmation]
flash[:message] = "Passwords do not match!"
render :new
else...
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then you really don't need to spend an hour figuring what went wrong. has_secure_password does the confirmation for you! And the error message! Stop doing so much work! Take a break!&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;And don't even get me started on nested forms&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Are you currently trying to build a nested form? And is it broken? And is it broken in new and exciting ways every time you catch one thing? &lt;/p&gt;

&lt;p&gt;Here's the most important thing to remember: Leave. The. Controller. Action. Alone. That create method is just fine and if you start doing weird params validations in that method you're just leaving these wonderful rails methods to sit around doing nothing! &lt;/p&gt;

&lt;p&gt;I thought I had it all figured out with 'accepts_nested_attributes_for' but then I just &lt;em&gt;had&lt;/em&gt; to go and add validations to my data. So now we have a show-off.&lt;/p&gt;

&lt;p&gt;In one corner, &lt;code&gt;models#contracts/ accepts_nested_attributes_for :monster&lt;/code&gt;, which is just doing its job of letting a monster be associated with a contract. "Yes!" it says to a new contract instance, "Wonderful that you have that little box on the form, let 'em all in!"&lt;/p&gt;

&lt;p&gt;Well, not &lt;em&gt;all&lt;/em&gt; of them? We don't want nameless monsters, after all! (What could be scarier than a nameless monster?) Or a duplicate. So in the other corner, we set up &lt;code&gt;models#monsters/ validates :name, uniqueness: true, presence: true&lt;/code&gt; and it proceeds to do its job of traffic control, not letting those pesky nameless and duplicate monsters into the database. &lt;/p&gt;

&lt;p&gt;But our user can choose an existing monster for their contract, OR create a new one. So if they choose an existing monster, the field for the possible new one is left blank, and we can't have a blank monster, so that issue hits the validation and now contracts aren't being created and monsters are running wild and we're back to lives being threatened while these two duke it out. &lt;/p&gt;

&lt;p&gt;So before you go diving into that controller, begging it to please meditate, there's one more little bit you should consider. (And leave the controller out of it, this fight is between models only.)&lt;/p&gt;

&lt;p&gt;&lt;code&gt;reject_if:&lt;/code&gt; is your mediator in this situation. Link him up and you get something along the lines of&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;accepts_nested_attributes_for :monster, reject_if: proc { |attributes| attributes['name'].blank? } 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Peace reigns. Contracts of all kinds are welcome in the database. Monsters are kept in check. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;And now a train metaphor&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;I was told Ruby on Rails was powerful, but that didn't stop me from having a dozen of those &lt;strong&gt;head explosion&lt;/strong&gt; moments every day working with it. And now with all these new and exciting things available for me, I find myself asking "How do you know you're &lt;em&gt;done&lt;/em&gt;?" and I suddenly have a lot more sympathies for people working on actual live sites. &lt;/p&gt;

&lt;p&gt;At least in a perpetual stage of development, I can keep working on the features of my app at my own pace, laying down tracks for a train that might never come, polishing them to a shine. &lt;/p&gt;

&lt;p&gt;I can, in a state of questionable sanity, rip up my entire database and add in three new models with only two days until the project is due. &lt;/p&gt;

&lt;p&gt;And then if the new tracks I put down are a bit crooked, I can just put down some nice blankets and pretend that part doesn't exist for a while. &lt;/p&gt;

&lt;p&gt;I assume that's something you could do with a train track. If it was your train track and you controlled the trains on it, at least. Probably not a good idea to do on a live, public train track. Might end up putting some lives in jeopardy. &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a queer movie database with Sinatra</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Thu, 10 Dec 2020 19:48:32 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/building-a-queer-movie-database-with-sinatra-4640</link>
      <guid>https://dev.to/sebastianspiegel/building-a-queer-movie-database-with-sinatra-4640</guid>
      <description>&lt;p&gt;Long before I started coding, I was a film student. I supplemented my studies in screenwriting with classes like LGBT History, History of AIDS, and Classic Theater. I wrote papers about the queer themes of Shakespeare, the queerness of B-films pre-Hayes code, and finding the hidden LGBT characters in films during Hayes-code. Pre-COVID, I met with friends for a regular Queer Movie Night where chosen films ranged from Some Like It Hot to Midnight. I like to think I know a lot of LGBT movies and a lot about LGBT movies, but that doesn't mean I've seen them all. &lt;/p&gt;

&lt;h3&gt;
  
  
  Inspiration and community-built databases
&lt;/h3&gt;

&lt;p&gt;When some people watch a movie for the first time and notice an animal on the screen, they will go to the popular site "Does the dog die" for a little reassurance before continuing. This site not hosts a number of warnings for all sorts of triggers and is an invaluable resource because of that. &lt;/p&gt;

&lt;p&gt;When I watch a movie for the first time and catch of hint of a queer-coded character, I want to be able to do the same thing. At the moment I usually reach out to a friend who I know has seen it and ask something along the lines of "Is this going where I want it to go, or am I going to be disappointed?" &lt;/p&gt;

&lt;p&gt;Much like people on "Does the dog die?" I don't necessarily want to be spoiled for the plot, or have to read through an entire synopsis. I just want an answer to a question: is it queer? Unfortunately, this question doesn't usually get a straightforward answer.&lt;/p&gt;

&lt;h3&gt;
  
  
  From the big picture to a manageable project
&lt;/h3&gt;

&lt;p&gt;I thought about my ideal website, modeled after "Does the dog die?" where a database could be built by community additions and suggestions. I also thought about the rules for qualifying a film as 'queer' and after a day down a rabbit hole of complex algorithms and how to weigh different types of movies, I realized I still needed to build a program in a week. &lt;/p&gt;

&lt;p&gt;So I simplified. A database of LGBT movies, still curated by the community. I started with the basic records you tend to see with ActiveRecord; users and movies. Movies belong to the users who add them, a user can have many movies. &lt;/p&gt;

&lt;h3&gt;
  
  
  Technical difficulties
&lt;/h3&gt;

&lt;p&gt;"Why are you doing that? WHY are you doing THAT?" is something I tend to repeat to two different things in my life: my cat (the 'that' is usually clawing furniture and the 'why' is 'cause I'm a cat') and my computer. I keep trying to find ways to avoid the pitfalls of spending 20 minutes troubleshooting for one misspelling but so far I haven't been able to fully avoid it. I try not to keep a tally, but those 20 minutes add up. Every time it happens I say "Let this be a lesson to me! I won't fall for it again!" but after 5 minutes I've completely forgotten what it was I ended up fixing and inevitably I make the same mistake a half dozen more times that day. &lt;/p&gt;

&lt;p&gt;So if these wasteful bouts of 20-minute chunks forever lost to my own foolishness can't be avoided then what can be done? &lt;/p&gt;

&lt;p&gt;As my frustration builds and builds, troubleshooting and checking line by line through a growing number of files ("Remember when I only had to deal with 2 folders and maybe 3 files?" I ask myself fondly), that frustration has to go somewhere when it's replaced by the eureka of finally finding the problem spot. Sometimes it comes out as a triumphant shout, or a laugh, or just an "OH !@#$ ME!" that my roommates have grown to accept is part of life now. The important thing is, you can't stay mad. You have to move on, because the only real enemy here is yourself and, unfortunately, you have to keep coding with that person. &lt;/p&gt;

&lt;h3&gt;
  
  
  Challenging myself
&lt;/h3&gt;

&lt;p&gt;Once I had the basic requirements for the project in place, I went to my list of additional features I wanted to try to include. The first new thing I tackled was error messages, which after an initial failed attempt was easy to get working once I got some help setting it up. &lt;/p&gt;

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

&lt;p&gt;Then I added comments, which brought me a lot closer to the original design I envisioned. Now there was an opportunity for users to engage in dialogue on the page of the film and add additional details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;class Comment &amp;lt; ActiveRecord::Base
    belongs_to :movie
    belongs_to :user
    validates :content, presence: true
end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The next thing on my list was admin accounts and privileges. I went a little backward with this, first seeding an account with the username admin and then hard coding that this account was allowed to edit all instances of movies and comments. Obviously, that wasn't a good solution, but after making sure the logic was sound for allowing the logged-in user and an additional user with specific parameters to edit, I fixed it up nicer. I added an 'account_type' attribute to my users, users are automatically created with the type 'user' and at this point, the only way I could change it would be to do so by manually accessing the database, but for now, it works for what I wanted it to do! I even made an easy method to stick into my routes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if @movie.user_id == session[:user_id] || admin_account
            erb :'movies/edit'
        else
            flash[:message] = "You cannot edit that movie."
            redirect '/movies'
        end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After I had the logic set up, I went to the design side. I didn't spend a ton of time on CSS other than making my comments line up in a nicer way, but I did want to make one change:&lt;/p&gt;

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

&lt;p&gt;I started using CSS to trick my Edit link into looking like my Delete button. After about 10 minutes of tinkering, trying to get them to match, I realized there was a path of less resistance. If I wanted both of them to be the same, why not just make them the same? So I made my edit into a GET form, which after the fact seemed extremely obvious and was way easier than tinkering with rounded corners in CSS. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--946TPv-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uvx5isf89sboooz6z54l.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--946TPv-S--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/uvx5isf89sboooz6z54l.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It seems simple, but it made me EXTREMELY happy just to see those matching buttons. &lt;/p&gt;

&lt;h3&gt;
  
  
  Takeaway
&lt;/h3&gt;

&lt;p&gt;This application more so than others I started to feel very comfortable with messing around with things to see what happens. Using gems like 'tux' and 'shotgun' made this very easy to do. I could open up a port and watch in live time as I edited the CSS or drop into a tux session to test my logic. I also started off setting up a good amount of seed data that really made it so much easier to do testing. &lt;/p&gt;

&lt;p&gt;I'm also happy with how I set up the order in which to do things for this application. I think the way I did it made it very easy and having that order kept me from feeling overwhelmed with the number of things I needed to do. It helps that there is a logical order when using Active Record; you need to set up your database and models before you can really tackle your controllers, so you can actually have real data to test with. Controllers and views go hand in hand, so I focused on building them together as I added them. &lt;/p&gt;

&lt;p&gt;Altogether I was proud of how well I understood the logic going into this project and I'm excited to learn more so that eventually I can create the full program! &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Building a Tarot Dictionary in Ruby</title>
      <dc:creator>Sebastian Spiegel</dc:creator>
      <pubDate>Thu, 12 Nov 2020 22:57:08 +0000</pubDate>
      <link>https://dev.to/sebastianspiegel/building-a-tarot-dictionary-in-ruby-3glc</link>
      <guid>https://dev.to/sebastianspiegel/building-a-tarot-dictionary-in-ruby-3glc</guid>
      <description>&lt;p&gt;I spent the last week building my first ever program using Ruby. &lt;/p&gt;

&lt;p&gt;I built a simple program for looking up tarot cards, specifically the meanings associated with the cards in the popular Rider-Waite tarot deck. Seasoned Tarot readers learn how to interpret cards by personal association, but most beginners rely on books to look up each card as they do a reading, or spread. I had a friend in mind when I came up with the idea for the program. She relies on a book to check the meanings of cards; the type is very small and it can take a while to find one card. My goal for this program was to make it so a person is only a few keystrokes away from the information they are after, avoiding the hassle of flipping through pages. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--u-SyL0S9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5m6sw50kjyzx12rl85s2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--u-SyL0S9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5m6sw50kjyzx12rl85s2.png" alt="program welcome screen"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Loops on loops
&lt;/h2&gt;

&lt;p&gt;To achieve the goal of having easy accessibility within the program I had to build many navigational loops within my methods. I decided to go with simple keystrokes for input, going off my own experience of interacting with similar CLI styles. I also thought of beginners to Tarot, who might get confused by the suit they need or the common mistake of hitting the wrong button. The case of the input shouldn't have mattered - why frustrate a user who put in 'b' instead of 'B'? Originally I found myself doing a lot of &lt;code&gt;input == "E" || or input == "e"&lt;/code&gt; before I remembered to take a look at the methods available for me and swapped out for a much simpler &lt;code&gt;input.case&lt;/code&gt;. I also wanted to get back to the previous list or starting a new search to be accessible inside the program, and this was mostly achievable thanks to the relatively small size of the information that was being provided.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;new_input = gets.chomp
            if new_input.upcase == "B"
                major_arcana
            elsif new_input.upcase == "M"
                main_menu_display
            elsif new_input.upcase == "E"
                exit_program
            else
                puts "Invalid selection"
                major_arcana
            end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  &lt;em&gt;I avoided having invalid input shoot users all the way back to the main menu by instead redirecting back to the start of the method they were already in&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;Another big hurdle was around the concept of making sure every method I wrote was handling one specific job. There were more than a few hours spent taking methods apart and writing new classes, new methods, new modules, worried that I needed to spread the load out, only to realize what I was actually doing was undoing the good work I had done. But the process made me understand my code and how parts of my code related to each other even more. I certainly would have been done writing my program a lot sooner if I had more confidence and second-guessed myself less, but I think it was worth it, in the end, to spend that much more time understanding what exactly was going on step by step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def self.card_display(array, index)
        puts "------------------"
        puts "  Name: #{array[index].name}"
        puts "  Type: #{array[index].type}"
        puts "  Suit: #{array[index].suit}"
        puts "  Meaning: #{array[index].meaning_up}"
        puts "  Meaning reversed: #{array[index].meaning_rev}"
    end
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  &lt;em&gt;I created a method for the code to display the information in an easy to read format so that I could reuse it anywhere in the program without repeating the same 8 lines of code over and over.&lt;/em&gt;
&lt;/h6&gt;

&lt;p&gt;When I first started planning the program I set a very simple goal: just have the code return the basic information when requested. I also wrote down a few extra functions that would be fun, if I had the time. A mistake I made was laying the groundwork for some of those early, telling myself I would go back and actually build them. In the future, I would rather only write the code I actually plan on working with at that time, and when it comes time to add in extra stuff then add it. I ended up having to do a lot more cleanup when I later decided that certain functions were either beyond my capabilities or just unnecessary for the scope of the project. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sVuiBJAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ke1k6g8pinf4qrbv836r.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sVuiBJAw--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ke1k6g8pinf4qrbv836r.png" alt="program example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Overall, I absolutely love my program. It may be simple but it does exactly what I set out for it to do. At some point, when I have a larger skill set, I think it would be fun to revisit and add in some of the things I came up with but had to set aside. For now, I am excited to show it to my friends who read Tarot&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
