<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Ali Spittel on Medium]]></title>
        <description><![CDATA[Stories by Ali Spittel on Medium]]></description>
        <link>https://medium.com/@ali07cat07?source=rss-10780f3e5ed5------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LetNKH8hRnoIioVWC5CVMw.jpeg</url>
            <title>Stories by Ali Spittel on Medium</title>
            <link>https://medium.com/@ali07cat07?source=rss-10780f3e5ed5------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 16 Nov 2026 22:49:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ali07cat07/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The Most Important Non-Programming Skills for Programmers]]></title>
            <link>https://medium.com/free-code-camp/the-most-important-non-programming-skills-for-programmers-d39fadc1a0fa?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/d39fadc1a0fa</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[personal-development]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Mon, 05 Nov 2018 21:46:13 GMT</pubDate>
            <atom:updated>2018-11-05T21:46:13.238Z</atom:updated>
            <content:encoded><![CDATA[<h3>The most important non-programming skills for programmers</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Y4yLSMDBa8g2Xgpq6OO44A.jpeg" /></figure><p>When I think about the people I would like to work with as a programmer, I think so much more about the non-technical skills rather than technical skills that make somebody a good co-worker.</p><p>In fact, all of the skills that are in this post contribute to writing good code that improves technical projects. Most of them are really helpful for careers outside of programming too, but I’m going to focus on why they’re useful for programmers specifically.</p><h3>Empathy</h3><p>To build a great product, you must put yourself in the shoes of your users. How will they be using your product? What features will be helpful for them? How can your program help them or improve their lives? And — conversely — how could it harm them or negatively impact their lives? What are the ethical implications of your application?</p><p>Empathy is essential for so many pieces of your programs. If they aren’t secure, then your user’s information could be used negatively by a third party.</p><p>If they aren’t accessible, then you are limiting the number of people that can use your project. If they run slowly or needs huge amounts of bandwidth to run, then users will leave and people in areas with slow internet or mobile users won’t be able to run them.</p><p>It seems like every day an article comes out with some harmful algorithm a company has implemented, like the <a href="https://www.theguardian.com/media/2018/sep/18/report-youtubes-alternative-influence-network-breeds-rightwing-radicalisation">YouTube algorithm radicalizing the alt-right</a>, <a href="https://www.inc.com/guadalupe-gonzalez/amazon-artificial-intelligence-ai-hiring-tool-hr.html">Amazon creating a sexist hiring algorithm (which they didn’t end up using)</a>, or <a href="https://www.youtube.com/watch?v=QxuyfWoVV98">AI misgendering black women</a>. Think about everybody when you are writing your code!</p><p>Also, empathy is helpful for being a team member and a mentor. Put yourself in your manager or another developer’s shoes. Why are they making their decisions? What can you do to help them? Having empathy will definitely improve your ability to be an effective teammate. If you’re an employer, you can retain your employees for longer, and they will be more effective workers if you display empathy <a href="https://www.forbes.com/sites/karenhigginbottom/2018/05/31/why-empathy-matters-in-the-workplace/#386ca65d1130">(source)</a>.</p><p>Have patience for other programmers, especially ones that are learning new things. Remind yourself of something that was really hard for you to learn and how that felt. They probably feel similarly. Being rude to them, diminishing their progress, or being pedantic will only be harmful and make that process harder for them.</p><p><strong>Your words and actions have real consequences — you can use that to enact positive change or hurt somebody. That doesn’t end with in-person communication — online communication counts too. You may think you’re being funny or just letting off steam, but you may actually causing a very negative impact on someone’s life. It’s up to you to decide how to act, and how to apologize if you hurt someone to undo some of that harm.</strong></p><h3>Problem Solving</h3><p>When I teach people to code, I see a lot more people struggling with problem-solving than the code itself. The ability to break a problem into smaller ones and then solve all of those smaller problems takes a lot of practice. Getting good at problem-solving can help you become a much stronger programmer.</p><p>Also, for most problems, there will be more than one solution. A large part of our jobs as software developers is to think through those different solutions and choose the one that is best. Is one faster to implement? Or does it run more efficiently? Or will it be less expensive? All of these are important questions, and picking the correct solution is a challenging but important part of software development.</p><h3>Collaboration</h3><p>Chances are very high that you will work with other people as a programmer. You will have to work with other developers, business people, managers, open source contributors, stakeholders, and countless other people even if you are a freelancer or entrepreneur. Learning how to work well with different people and their personalities is critical.</p><p>There are so many things that contribute to good collaboration. The first is knowing that one person can’t do everything, or at least do everything well. Different people have different skills, points of view, and life experiences that are more powerful in combination than isolation. Don’t feel like you always need to “put the team on your back” or be everything to everybody. You can be a lot better if you allow other people to contribute too.</p><p>Ask other people for help, and be willing to help people in return. You don’t need to be an expert in everything, and different people will be experts in different things. Rely on other people, and if you are stuck on something make sure to ask for help so that you don’t stay stuck for too long.</p><p>When somebody asks you for help, be willing to help them. You can learn a lot by explaining things well, and you will be able to reinforce your knowledge of the topic. If you’re in a management position, make sure to give people time for mentorship and effective collaboration!</p><p>Along the same lines, don’t talk over people or immediately dismiss their viewpoints. They will probably be much less likely to contribute in the future if their opinions aren’t valued or taken into account.</p><p>Actively listen when people share their ideas — instead of thinking about your response or why your idea is better while they are talking, try to think about why their approach is also good or how it could be implemented.</p><p>Then, once you implement their awesome ideas, give them credit for those ideas. Nothing has made me less effective as an employee as being on a team where my ideas were dismissed, under-valued, and un-credited by other people on my team.</p><h3>Communication</h3><p>When you are working with other people, whether those people are co-workers, clients, the people who use your projects, managers, or people you manage, good communication is crucial. Give honest updates on how things are going, where projects currently stand, and your opinions on things honestly but kindly. People will be less receptive to feedback if you are rude or not constructive. But, if you are dishonest or sugar-coat the truth, then you may not see a positive change. There’s definitely a fine line here.</p><p>One real life example from my life: I had somebody who read one of my blog posts write a very long letter about how dumb I sound because of the tone I take. I usually use a lot of exclamation points and try to sound exciting in my posts — and that’s very intentional to try and make topics that can be intimidating or boring more fun. The person got pretty sexist in this email and said some pretty hurtful things. That being said, I probably could scale back on the exclamation points and still get people excited about programming. I would have been a lot more receptive to that point if the person had framed the criticism more constructively.</p><p>If things are not going well, make sure to say so. Be honest about needing a deadline pushed back, or how something isn’t going well at work. You will have a much better chance at changing it and making the environment better for yourself if you speak up.</p><h3>Inclusiveness</h3><p>I used to work as a rock climbing instructor and counselor at a summer camp, and the age group I worked with most were middle school girls. They were some of my favorite people I’ve ever worked with. But, that being said, middle schoolers aren’t usually the most accepting of difference or that clique-adverse.</p><p>We used to run a game where we started out in one large circle, and then one counselor would tell people they were “out of the circle”, and they would have to leave the game based on some characteristic that they weren’t informed of and couldn’t control. The people still inside the circle would play a game, and the people outside of the circle were excluded and just had to watch from afar.</p><p>This activity was super effective in showing these girls what it was like to be left out for reasons outside of your control, and I still think back on it a lot. As adults, we still leave people out of the circle and exclude them based on certain characteristics outside their control. But if we let them back into the circle and allow them to contribute then our products draw on more diverse experiences and are better.</p><p><strong>There’s </strong><a href="https://hbr.org/2016/11/why-diverse-teams-are-smarter"><strong>a lot of research</strong></a><strong> on more diverse teams performing better. But from an individual perspective, think about what it feels like to be left out of the circle and try to make your circle larger, not smaller.</strong></p><p>Chances are, a lot of your users may be people that have traditionally been left out of the circle in tech. I can tell you from my own experience, that it’s really difficult to be the only person like you on a team, as someone who’s been on a team with another woman for ~5% of my programming career.</p><p>This also links into empathy — make sure that you are making your programs for a wide variety of users. Not just the able-bodied or those with cutting-edge internet or technologies. You will be able to reach more people.</p><h3>Patience</h3><p>The first person that you need to have patience with when you are programming is yourself. <strong>Programming is hard</strong> and sometimes you will have bugs or difficult problems to overcome. If it’s always easy, then you aren’t challenging yourself, and you aren’t growing as a programmer.</p><p>Have the tenacity to keep working through a problem and not give up when it gets hard. But, also, know that you can take a break and come back to the problem in a little while. Maybe taking a break will help you solve the problem more efficiently or to see it differently when you come back to it.</p><p>Also, be patient with other people. Things can take a while to learn and people are not perfect. Making mistakes and failing can be some of the most important experiences in the learning process, so allow for that instead of creating an environment where it isn’t safe to take risks or grow. Understand that different things click more easily for different people, and know that learning can take a while.</p><h3>Creativity</h3><p>My favorite thing about being a programmer is that I get to use my creative energy to build things that other people can then benefit from. You get to think outside of the box to create really cool things.</p><p>Having creative ideas is important for coming up with new features, interfaces, and applications. I had somebody buy a license for a product that I built for a company in large part because of the creative interface, and my <a href="https://alispit.tel/">portfolio site</a> has gotten traction because of its creativity.</p><p>In addition to that, a lot of problems require creativity to solve. There is more than one solution to almost every programming problem, and coming up with creative approaches to solving them can often lead to an optimized solution.</p><h3>Humility</h3><p>You can learn so much from other programmers — one person cannot know everything or anything close to it in the world of code. Be receptive to constructive criticism instead of defensive. You can improve your code and yourself from feedback, and being stuck in your ways doesn’t lead to growth. You aren’t always right, and you should be receptive to other people’s ideas.</p><h3>Confidence</h3><p>On the flip side, also be confident. I’ll admit that this is probably the most difficult one for me as someone with a lot of imposter’s syndrome, and it has been my #1 thing to improve on every performance review I’ve had in my career. I can (and probably will) write an entire blog post on this topic alone, but believing in yourself and being confident in your abilities is really important.</p><p>First, have confidence that you can take projects on. Don’t relegate yourself to easier projects or doubt yourself when you are assigned something difficult. Try to solve as much of it as you can, and then ask for help to get through the hardest parts.</p><p>Also, don’t feel the need to research everything as a first resort. Trust yourself to try a couple things before Googling the answer. Or Google part of the problem instead of the whole thing. If you’re doing everything correctly, you are hurting nothing by trying a couple things out in development and seeing if they work. You may be surprised by how much you know.</p><p>Another thing that I do is keep track of my wins. I have a document on my computer with cool things that I’ve done, and really nice things people have said about me. When I’m having a tough day or doubting myself, I’ll come back to it and usually feel more confident in what I’m doing.</p><h3>Adaptability</h3><p>Programming is still a new world, and it is evolving super fast. Being able to adapt when things change is critical. When a new framework, library, or language comes out that takes over, it’s important to be able to learn it (within reason of course). Our industry would look dramatically different if we were all still writing code in Fortran. We need to be able to evolve and adapt when things change.</p><p>Also, the goal posts and features for projects will often change, especially with client work. When that happens, we have to adapt and incorporate those requests (again, within reason).</p><h3>Community participation</h3><p>The community is so important for programming — conferences, blog posts, social media, and meetups are important for learning and growing. Also, open source software and the communities that surround them are the lifeblood of this industry. Being able to network and make connections with people is so important for education, relating your experiences, and finding new opportunities.</p><p>Even if you are an introvert or don’t love in-person socializing, there are a ton of awesome online communities that you can learn a lot from. And, even inside of companies, having a team with a strong bond will help people work better together.</p><h3>Conclusion</h3><p>These skills are often referred to as “soft skills”, but I feel like that’s reductive. These skills help so much with both writing code and being a good co-worker. They are so much more important than knowing a specific language, library, or framework and they go far even outside of tech.</p><p>All of these skills are really important to work on as programmers and as people. That being said — nobody is perfect, and everyone has room to grow. So keep growing, and trying to make small steps to be better at these non-programming skills and I will too!</p><h3>Keep in Touch</h3><ul><li><a href="https://twitter.com/aspittel">Twitter</a></li><li><a href="https://mailchi.mp/b4216331e284/zen-of-programming">Newsletter</a></li><li><a href="https://github.com/aspittel">GitHub</a></li></ul><p><em>Originally published at </em><a href="https://dev.to/aspittel/the-most-important-non-programming-skills-for-programmers-iii"><em>dev.to</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d39fadc1a0fa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/the-most-important-non-programming-skills-for-programmers-d39fadc1a0fa">The Most Important Non-Programming Skills for Programmers</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[An introduction to Generative Art: what it is, and how you make it]]></title>
            <link>https://medium.com/free-code-camp/an-introduction-to-generative-art-what-it-is-and-how-you-make-it-b0b363b50a70?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/b0b363b50a70</guid>
            <category><![CDATA[creativity]]></category>
            <category><![CDATA[art]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[tech]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Wed, 03 Oct 2018 15:04:17 GMT</pubDate>
            <atom:updated>2018-10-03T15:04:17.381Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*JPekOSiNoJpvFeDP.png" /><figcaption>Mandelbrot’s Fractal is derived from a deceptively simple equation</figcaption></figure><p>Generative art can be an intimidating topic — it seems like there is a lot of math involved, and art is tricky in itself!</p><p>But, it doesn’t have to be difficult — you can build some really cool things without a math or art degree. This post will break down what generative art even is and how you can get started building your own generative art.</p><h3>First, what is code art?</h3><p>Code art is any art that is built using code. There are endless examples on CodePen — for example <a href="https://dev.to/aspittel/learning-css-through-creating-art-54c0">CSS art</a>.</p><h3>What is generative art?</h3><p>Often, generative art draws inspiration from modern art, especially pop art that makes heavy use of orderly geometric patterns.</p><p>However, it is a very broad and rich category of art created with code with a central characteristic. Generative art incorporates a self-governed or autonomous system in some way.</p><p>Randomness is one type of autonomous system. By incorporating chance into a piece of code art, you get a different, completely unique piece of art each time you run your script, load your page, or respond to some user interaction.</p><p>There are also more orderly autonomous systems. One example is Mandelbrot’s Fractal, derived from a deceptively simple equation.</p><p>We can also integrate both approaches, blending order and chaos!</p><p>The artwork becomes a collaboration between the computer and the artist. Some aspects of the artwork are controlled by the coder, but not all of them. The artist controls both the randomness and the order in the art.</p><p>In a way, with an autonomous system, the artist gives up control over their art, and the computer is doing it for them. A more nuanced perspective emerges when a new creative process is considered.</p><p>The coder-artist engages in a feedback loop where they are constantly tweaking a system to produce more desirable and often more surprising results.</p><p>This process embraces experimentation and happy accidents in a way that reshapes the role of the artist. As generative artists, we use the code basics like loops, control flow and specialized functions. We then blend them with often unpredictable forces, to produce completely unique results unlike anything else that exists.</p><h3>Examples of Generative Art</h3><p><a href="http://www.galaxykate.com/apps/Prototypes/LTrees/">Kate Compton’s Flowers</a></p><p><a href="http://math.hws.edu/eck/js/edge-of-chaos/CA.html">Cellular Automata and the Edge of Chaos</a></p><h4>Animated generative art in multi-colour by Phil Nash</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fphilnash%2Fembed%2Fpreview%2Fwmermr%3Fheight%3D600%26slug-hash%3Dwmermr%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fphilnash%2Fpen%2Fwmermr&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F863.wmermr.small.b617f3a2-f30c-444d-b5c9-0b06022ba7d3.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b809bcdedb52b9a3f283ff4504c39c3/href">https://medium.com/media/4b809bcdedb52b9a3f283ff4504c39c3/href</a></iframe><h4>Impressionists Blobs by Murasaki Uma</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fmurasaki%2Fembed%2Fpreview%2FBmOzMP%3Fheight%3D600%26slug-hash%3DBmOzMP%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fmurasaki%2Fpen%2FBmOzMP&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F311372.BmOzMP.small.01e9db10-5f27-4c33-970d-b6c96f402777.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/72df457ebf04ec28a925c2f5c9bb0b8a/href">https://medium.com/media/72df457ebf04ec28a925c2f5c9bb0b8a/href</a></iframe><h4>Generated Tree by Miriam Nadler</h4><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fmknadler%2Fembed%2Fpreview%2FJRvGOz%3Fheight%3D600%26slug-hash%3DJRvGOz%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fmknadler%2Fpen%2FJRvGOz&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F215332.JRvGOz.small.7ccb7c4f-b5fc-4041-9e77-17bc462f997d.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9505a2afd9328fb0404447f5f473169/href">https://medium.com/media/e9505a2afd9328fb0404447f5f473169/href</a></iframe><h3>What goes into a piece of generative art?</h3><ul><li><strong>Randomness</strong> is crucial for creating generative art. The art should be different each time you run the generation script, so randomness is usually a large part of that.</li><li><strong>Algorithms</strong> — Implementing an algorithm visually can often generate awesome art, for example, the binary tree above.</li><li><strong>Geometry</strong> — Most generative art incorporates shapes, and the math from high school geometry class can aid in some really cool effects.</li></ul><h3>How can you approach a generative art piece?</h3><p>There are two main strategies for creating generative art, though most will fall between the two strategies.</p><p>The first is to have no results in mind and see what the computer generates as you play around.</p><p>The second is that you have a very finalized idea of what you want the art to look like, and the randomness only slightly changes the end result.</p><h3>Where should you start?</h3><p>If you know JavaScript, <a href="https://p5js.org/">p5.js</a> is an awesome place to start. Its goal is to “make coding accessible for artists, designers, educators, and beginners.” It is a wrapper on the <a href="https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API">Canvas API</a>, and it simplifies a lot of the math. It focuses on drawing, but you can also do sound, video, or webcam interaction with it if you are interested in those forms of art!</p><h4>A Quick Introduction to P5</h4><p>First, load in the <a href="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.7.2/p5.js">p5 CDN</a>. Then, in your JavaScript file, you will add two functions that will be used in pretty much ever p5 script: setup and draw. These names are necessary for p5 to call them.</p><p>setup is called when the program starts. You will probably create a canvas to draw on within it using the createCanvas function, and you may set some defaults there. It is only called once!</p><p>draw is called after setup, and is executed constantly until you call noLoop, which will stop it from running again. You can control how many times draw runs each second with the frameRate function.</p><p>With generative art, I usually put noLoop in the setup function, which makes draw only run once instead of continuously.</p><p><a href="https://codepen.io/aspittel/pen/EeJJBm">Here’s a p5 starter template on CodePen</a>.</p><p>Since we’ve talked so much about the importance of randomness for generative art, another important function in p5 is random. It works similarly to JavaScript&#39;s Math.random but you can set a range for the numbers so that you don&#39;t have to do as much math to get the number to a useful format.</p><h4>p5 Lines</h4><p>You can create a line in p5.js like this:</p><pre>line(startX, startY, endX, endY)</pre><p>Then, you can randomly generate a bunch of lines and create a simple piece of generative art like this:</p><p>Even really simple scripts can generate cool pieces of art!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Faspittel%2Fembed%2Fpreview%2FVGNOeG%3Fheight%3D600%26slug-hash%3DVGNOeG%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Faspittel%2Fpen%2FVGNOeG&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1546529.VGNOeG.small.b9e11f34-1b62-4909-8c55-e990636fe40b.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/814f8d8dba352ae7a7a65c101bec4610/href">https://medium.com/media/814f8d8dba352ae7a7a65c101bec4610/href</a></iframe><h4>p5 Shapes</h4><p>You can also create shapes with p5 — like circles, triangles, and squares.</p><p>Here’s an example of creating some shapes with p5:</p><pre>// circle <br>ellipse(xCoordinate, yCoordinate, width, height) </pre><pre>// square <br>rect(xCoordinate, yCoordinate, width, height) </pre><pre>// triangle <br>triangle(xCoordinate1, yCoordinate1, x2, y2, x3, y3)</pre><p>Then, we can create some more shapes to build something more fun!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Faspittel%2Fembed%2Fpreview%2FmGYgWM%3Fheight%3D600%26slug-hash%3DmGYgWM%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Faspittel%2Fpen%2FmGYgWM&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1546529.mGYgWM.small.4932990b-30ff-4c27-90ec-6763427e5d88.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/376b6cff1b62841f02c84fad3db2a5a1/href">https://medium.com/media/376b6cff1b62841f02c84fad3db2a5a1/href</a></iframe><h4>p5 Movement</h4><p>We can add movement to our drawings by removing the noLoop function call in the setup function — check this out!</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fembed%2Fpreview%2FZMNZKd%3Fheight%3D600%26slug-hash%3DZMNZKd%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fpen%2FZMNZKd%3Feditors%3D0010&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F539758.ZMNZKd.small.5c2e078b-5e55-4433-bb76-12eb5a4f9e22.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/b8a16e14a74cd52f55778d938abccdbc/href">https://medium.com/media/b8a16e14a74cd52f55778d938abccdbc/href</a></iframe><h4>Color</h4><p>You can also play with color with generative art by randomly choosing colors. You can do this mathematically through RGB values, or you can generate a color palette with your favorite color picker (we’ve been using <a href="https://www.colorbox.io/">this</a> one).</p><p>You can set the fill color with the color function. It takes a bunch of different formats, like named colors, RGBAs, and hex codes.</p><p>You can also change the color of the outline using stroke. You can also remove that outline using noStroke or make it a different width with strokeWeight.</p><h4>Putting it all together</h4><p>Once we have all of those pieces in place, we can combine the techniques to build some really cool stuff.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Faspittel%2Fembed%2Fpreview%2FPdvgda%3Fheight%3D600%26slug-hash%3DPdvgda%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Faspittel%2Fpen%2FPdvgda&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F1546529.Pdvgda.small.7bae4e0b-878b-441d-8e82-4e670aa232f3.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/0df3799d8d113e752de476c3685ce8c8/href">https://medium.com/media/0df3799d8d113e752de476c3685ce8c8/href</a></iframe><h3>Another Strategy: Tweaking Tutorials</h3><p>You can also generate really cool generative art by taking someone else’s work and building off of it. For example, here’s the result of a tutorial by <a href="https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw">Dan Shiffman</a>:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fembed%2Fpreview%2FNLmmbE%3Fheight%3D600%26slug-hash%3DNLmmbE%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fpen%2FNLmmbE&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F539758.NLmmbE.small.447b6acc-db82-41cd-b963-549f7e2eb7c0.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/951a156531e9b1a83dbad560b4ce6e62/href">https://medium.com/media/951a156531e9b1a83dbad560b4ce6e62/href</a></iframe><p>Here are two tweaks of it to create different effects:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fembed%2Fpreview%2FLJvvxx%3Fheight%3D600%26slug-hash%3DLJvvxx%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fpen%2FLJvvxx&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F539758.LJvvxx.small.5da34edf-3a87-4d90-8d55-7f3fd82f26a3.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/917997bf9c1b76f6c76a41cafd0b6ee6/href">https://medium.com/media/917997bf9c1b76f6c76a41cafd0b6ee6/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fembed%2Fpreview%2FJaVVOE%3Fheight%3D600%26slug-hash%3DJaVVOE%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io%26embed-version%3D2&amp;url=https%3A%2F%2Fcodepen.io%2Fsuperbuggy%2Fpen%2FJaVVOE&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F539758.JaVVOE.small.aba16776-9812-48dc-999c-7ed1a5e63aea.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/5eea637815efe23e06d8cdbcca126ddf/href">https://medium.com/media/5eea637815efe23e06d8cdbcca126ddf/href</a></iframe><p><a href="https://codepen.io/collection/nMmoem/">Here’s</a> a Codepen Collection with even more!</p><p>You can follow tutorials, fork CodePens, or Glitch projects and create something new and unique. Just make sure to give the original artist some credit too.</p><h3>Cheatsheet</h3><p>Here’s a cheat sheet with all of the P5 functionality we used for this tutorial.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*hFfffK_1TdH8MOJf.png" /></figure><h3>Read More</h3><ul><li><a href="https://generativeartistry.com/">Generative Artistry</a></li><li><a href="https://www.youtube.com/channel/UCvjgXvBlbQiydffZU7m1_aw">Coding Train</a></li><li><a href="https://www.youtube.com/watch?v=4Se0_w0ISYk">Talk by Tim Holman</a></li></ul><h3>Keep in Touch</h3><p>This post was co-written with <a href="https://twitter.com/1800thehive">James Reichard</a>. If you create your own art, make sure to Tweet it at us! (<a href="https://twitter.com/ASpittel">Ali</a> and <a href="https://twitter.com/1800THEHIVE">James</a>).</p><p><em>Originally published at </em><a href="https://dev.to/aspittel/intro-to-generative-art-2hi7"><em>dev.to</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b0b363b50a70" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/an-introduction-to-generative-art-what-it-is-and-how-you-make-it-b0b363b50a70">An introduction to Generative Art: what it is, and how you make it</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Complete Beginner’s Guide to React]]></title>
            <link>https://medium.com/free-code-camp/a-complete-beginners-guide-to-react-4d490abc349c?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d490abc349c</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[learning]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Tue, 04 Sep 2018 20:03:10 GMT</pubDate>
            <atom:updated>2018-09-04T20:03:10.234Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tnOVr25yQ2GPzKfpglcxCQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/4JdvOwrVzfY?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Alexander Andrews</a> on <a href="https://unsplash.com/search/photos/guide?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I want to get back into writing more technical content. React is one of my favorite technologies, so I thought I would create a React intro! This post requires knowledge of HTML and JavaScript. I am of the firm opinion that you should know these before moving on to libraries like React!</p><h3>What is React</h3><p>React is a JavaScript library built in 2013 by the Facebook development team. React wanted to make user interfaces more modular (or reusable) and easier to maintain. According to React’s website, it is used to “Build encapsulated components that manage their own state, then compose them to make complex UIs.”</p><p>I’m going to use a lot of Facebook examples throughout this post since they wrote React in the first place!</p><p>Remember when Facebook moved from likes to reactions? Instead of being able to like posts, you can now react with a heart, or a smiley face, or a like to any post. If those reactions were primarily made in HTML, it would be a tremendous amount of work to change all those likes to reactions and to make sure that they work.</p><p>This is where React comes in. Instead of implementing “separation of concerns”, we have a different architecture in React. This architecture increases modularity based on a component’s structure.</p><blockquote><em>Today, we’ll keep the CSS separate, but you can even make that component specific if you want!</em></blockquote><h3>React vs. Vanilla JavaScript</h3><p>When we talk about “vanilla” JavaScript, we are normally talking about writing JavaScript code that doesn’t use additional libraries like JQuery, React, Angular, or Vue. If you would like to read more about those and what a framework is, I have a <a href="https://zen-of-programming.com/web-framework-intro">post</a> all about web frameworks.</p><h3>A couple quick notes before we begin</h3><ul><li>To make this tutorial a little more succinct, some code examples have ... before or after them. This means we omitted some code.</li><li>I use Git diffs in some places to show lines of code that will change. If you copy and past, you need to delete the + at the beginning of the line.</li><li>I have full CodePens with the completed versions of each section — so you can use those to play catch-up!</li><li>More advanced concepts that aren’t essential for the tutorial are in blockquotes. These are facts that are interesting!</li></ul><h3>Set Up</h3><p>If you are creating a production React application, you will want to use a build tool like Webpack. Webpack will bundle your code since React utilizes some patterns that won’t work by default in the browser. <a href="https://github.com/facebook/create-react-app">Create React App</a> is super helpful for these purposes since it does most of the configuration for you!</p><p>For now, we will be using the React CDN, which is only for development purposes! We will also use the Babel CDN so that we can use some non-standard JavaScript features (we’ll talk more about that later!).</p><pre>&lt;script <em>crossorigin</em> <em>src</em>=&quot;https://unpkg.com/react@16/umd/react.development.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script <em>crossorigin</em> <em>src</em>=&quot;https://unpkg.com/react-dom@16/umd/react-dom.development.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;script <em>src</em>=&quot;https://cdnjs.cloudflare.com/ajax/libs/babel-core/6.1.19/browser.js&quot;&gt;</pre><p>I also made a <a href="https://codepen.io/aspittel/pen/gdrexE">Codepen template</a> that you can use!</p><p>In a full React project, I would split my components into different files. For learning purposes we will combine our JavaScript into one file for now.</p><h3>Components</h3><p>For this tutorial, we will be building a Facebook status widget, since Facebook wrote React in the first place!</p><p>Think about how many places the like widget appears on Facebook. You can like a status, or a link post, or a video post, or a picture! Or even a page! Every time Facebook tweaks something about the like functionality, they don’t want to have to do so in all those places. So, that’s where components come in! All the reusable pieces of a webpage are abstracted into a component. That component can be used over and over again. Ee will only have to change the code in one place to update it.</p><p>Let’s look at a picture of a Facebook status and break down the different components within it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/0*iodL_qOvw1lqk2Yp.png" /></figure><p>The status itself will be a component. There are lots of statuses within a Facebook timeline. We definitely want to be able to reuse the status component.</p><p>Within that component, we will have <em>subcomponents</em> or components within a parent component. Those will be reusable as well . We could have the like button component be a child of the PhotoStatus component and the LinkStatus component.</p><p>Maybe our subcomponents would look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/450/0*MK4hJnEE7b9O4gmQ.png" /></figure><p>We can even have subcomponents within subcomponents! So, the group of like, comment, and share could be its own ActionBar component. It would have components for liking commenting and sharing within it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7wv2ExT3ihc9IEhr.png" /></figure><p>There are a bunch of ways you could break down these components and subcomponents depending on where you will reuse the functionality in your application.</p><h3>Getting Started</h3><p>I wanted to start off this tutorial with a React “Hello World” — it is the tradition after all! Then we’ll move to the slightly more complex status example.</p><p>In our HTML file, let’s add just one element — a div with an id on it. By convention, you will normally see that div have an id &quot;root&quot; on it since it will be the root of our React application!</p><p>If you’re writing the code in the <a href="https://codepen.io/aspittel/pen/gdrexE?editors=0010">CodePen template</a>, you can write this JavaScript directly in the js section. If you are instead writing this on your computer, you will have to add a script tag with the type text/jsx, so:</p><pre>&lt;script type=&quot;text/jsx&quot;&gt;&lt;/script&gt;</pre><p>Now, let’s get to our React code!</p><pre>class HelloWorld extends <em>React</em>.<em>Component</em> {</pre><pre>  render() {</pre><pre>    // Tells React what HTML code to render</pre><pre>    return &lt;h1&gt;Hello World&lt;/h1&gt;</pre><pre>  }<br>}</pre><pre>// Tells React to attach the HelloWorld component to the &#39;root&#39; HTML div</pre><pre>ReactDOM.render(&lt;<em>HelloWorld</em> /&gt;, document.getElementById(&quot;root&quot;))<br></pre><p>All that happens is that “Hello World” is displayed as an H1 on the page!</p><p>Let’s walk through what’s going on here.</p><p>First, we are using an ES6 class that inherits from the React.Component class. This is a pattern that we will use for most of our React components.</p><p>Next, we have a method in our class — and its a special method called render. React looks for the render method to decide what to render on the page! The name makes sense. Whatever is returned from that render method, will be rendered by that component.</p><p>In this case, we are returning an H1 with the text of “Hello World” — this is exactly what would be in the HTML file normally.</p><p>Finally, we have:</p><pre>ReactDOM.render(&lt;HelloWorld /&gt;, document.getElementById(&quot;root&quot;))</pre><p>We are using the ReactDOM functionality to attach our react component to the DOM.</p><blockquote><em>React utilizes something called the virtual DOM which is a virtual representation of the DOM that you would normally interact with in Vanilla JavaScript or JQuery. This </em><em>reactDOM.render renders this virtual DOM to the actual DOM. Behind the scenes, React does a lot of work to efficiently edit and re-render the DOM when something on the interface needs to change.</em></blockquote><p>Our component, &lt;HelloWorld /&gt;, looks like an HTML tag! This syntax is part of <em>JSX</em> which is an extension of JavaScript. You can&#39;t natively use it in the browser. Remember how we&#39;re using Babel for our JavaScript? Babel will transpile (or convert) our JSX into regular JavaScript so the browser can understand it.</p><blockquote><em>JSX is actually optional in React, but you’ll see it used in the vast majority of cases!</em></blockquote><p>Then, we are using JavaScript’s built-in document.getElementById to grab our root element we created in our HTML.</p><p>All in all, in this ReactDOM.render statement, we are attaching our HelloWorld component to our div that we created in our HTML file.</p><h3>Starter Code</h3><p>Okay — now that we’ve done a “Hello World,” we can get started with our Facebook component.</p><p>First, I want you to play around with this demo. We’ll be working on this throughout the rest of the tutorial. Feel free to look at the code too, but don’t worry about not understanding it! That’s what the rest of the tutorial is for!</p><p>Let’s start off by “hard coding” the HTML for the widget:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f24582461cf984625463cae0bcd80699/href">https://medium.com/media/f24582461cf984625463cae0bcd80699/href</a></iframe><p>With some added CSS, this looks like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/0*iYUATDXs_LeCtVv9.png" /></figure><p><a href="https://codepen.io/aspittel/pen/KxzGdx">Here’s a Codepen with the full starter code</a>.</p><p>For the sake of this tutorial, we will be creating four components: a Status component which will be the parent, a Like component that will encompass the liking logic, and the Comment component which will contain the logic for typing in a comment. The Like component will also have a child LikeIcon that will show up or be hidden when you toggle the like button.</p><h3>Component Architecture</h3><p>Let’s go ahead and divide the HTML code that we’ve written into those components.</p><p>We’ll start with the shell of a component, and we’ll render it as well to make sure it’s working!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/24cae658011af1b5cc24927688ad57bd/href">https://medium.com/media/24cae658011af1b5cc24927688ad57bd/href</a></iframe><blockquote><em>One interesting note about the above, is that we had to change “class” attributes to “className”. Class already means something in JavaScript — it’s for ES6 classes! Some attributes are named differently in JSX than in HTML.</em></blockquote><p>We can also delete the content of our HTML, leaving just an element with the ID root — the parent “content” div is just for styling!</p><pre>&lt;body&gt; <br>  &lt;div class=&quot;content&quot;&gt; <br>    &lt;div id=&quot;root&quot;&gt;&lt;/div&gt; <br>  &lt;/div&gt; <br>&lt;/body&gt;</pre><p>Here’s the HTML that is going to go in the Status component. Notice, some of the original HTML isn’t there yet — it’s going to go into our subcomponents instead!</p><p>Let’s create a second component, and then we’ll include it in our Status component.</p><pre>class Comment extends React.Component { <br>  render() { <br>    return ( <br>      &lt;div&gt;<br>         &lt;textarea className=&quot;form-control&quot; placeholder=&quot;Write a comment...&quot; /&gt; <br>         &lt;small&gt;140 Remaining&lt;/small&gt; <br>      &lt;/div&gt; <br>      ) <br>   } <br>}</pre><p>Here’s the component for our comment. It has our textarea to type in, and the text with how many characters we have remaining. Notice that both are wrapped in a div. This is because React requires us to wrap all the contents of a component within one HTML tag. If we didn&#39;t have the parent div we&#39;d be returning a textarea and a small tag.</p><p>So, now we need to include this component within our Status component since it will be our subcomponent. We can do so using that same JSX syntax we used to render the Status component!</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/313477817eb0d0cdc8b4be2f0875c07c/href">https://medium.com/media/313477817eb0d0cdc8b4be2f0875c07c/href</a></iframe><p>Okay, now we just need to do the same for our likes:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/85c5b78250a1943a860e7e4102cfc378/href">https://medium.com/media/85c5b78250a1943a860e7e4102cfc378/href</a></iframe><p>Then we need to include it in our original Status component:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/70e4031c06e5115082ef9af4aa9ce64b/href">https://medium.com/media/70e4031c06e5115082ef9af4aa9ce64b/href</a></iframe><p>Cool, now we have React-ified our original HTML, but it still doesn’t do anything. Let’s start fixing that!</p><p>All in all, the code from this section will look like <a href="https://codepen.io/aspittel/pen/yxOQMe?editors=0010">this CodePen</a>.</p><h3>State and Props</h3><p>We have two different user interactions that we want to implement:</p><ul><li>We want the like icon to show up only if the like button is pressed</li><li>We want the number of characters remaining to decrease as the person</li></ul><p>Let’s start working on these!</p><h3>Props</h3><p>Imagine that we wanted our comment box to allow for a different number of letters in different places. On a status, for example, we want a user to be allowed to write a 200 letter long response. On a picture, however, we only want them to be able to write a 100 character response.</p><p>React allows us to pass props (short for properties) from the PictureStatus component and the Status component to specify how many letters we want to allow in our response, rather than having two different comment components.</p><p>The syntax for props looks like the following:</p><pre>&lt;Comment maxLetters={20} /&gt; <br>&lt;Comment text=&#39;hello world&#39; /&gt; <br>&lt;Comment show={false} /&gt; </pre><pre>let test = &#39;hello world&#39; <br>&lt;Comment text={test} /&gt;</pre><p>The props look like HTML attributes. If you are passing a string via props, you don’t need the brackets. Any other data type or a variable needs to be within the brackets.</p><p>Then, within our component, we can use our props:</p><pre>console.log(this.props.maxLetters)</pre><p>They are bundled together in the props attribute of the instance so they can be accessed with this.props.myPropName.</p><p>So, let’s change the hardcoded 140 characters to be changeable outside the component!</p><p>First, we’ll change where we instantiate the Comment component within the Status component (note some code is omitted):</p><pre>class Status extends React.Component { <br>  ... <br>      &lt;div className=&quot;card-footer text-muted&quot;&gt; <br>        &lt;Comment maxLetters={280} /&gt; <br>      &lt;/div&gt; <br>     &lt;/div&gt; <br>   &lt;/div&gt; <br>  ) <br> } <br>}</pre><p>Then we’ll change the hardcoded 140 character limit in the Comment component.</p><pre>class Comment extends React.Component { <br>  ... <br>    &lt;div&gt; <br>     &lt;textarea className=&quot;form-control&quot; placeholder=&quot;Write a comment...&quot; /&gt;<br>     &lt;small&gt;{this.props.maxLetters} Remaining&lt;/small&gt; <br>    &lt;/div&gt; <br>   ... <br>}</pre><h3>State</h3><p>The props that we pass from component to component will <em>never</em> change within the child component. They can change within the parent but not within the child. But — a lot of the time we will have attributes that we will want to change within the life of a component.</p><p>For example, we want to keep a tally of how many characters the user has typed into the textarea, and we want to keep track of whether the status has been “liked” or not. We will store those attributes that we want to change within the component in its <em>state</em>.</p><blockquote><em>You’ll notice a lot of immutability within React — it is highly influenced by the functional paradigm, so side effects are also discouraged.</em></blockquote><p>We want this state to be created whenever we create a new instance of a component, so we will use the ES6 class constructor to create it. If you want a quick refresh on ES6 classes <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes">MDN</a> is a great resource!</p><p>State is going to be an object with any key-value pairs that we want to include. In this case, we want a characterCount of how many characters the user has typed. We’ll set that to zero for now:</p><pre>class Comment extends React.Component { <br>    constructor () { <br>      super() <br>      this.state = { characterCount: 0 } <br>    } <br>...</pre><p>Now let’s subtract that from the maxLetters prop, so we always know how many characters we have remaining:</p><pre>&lt;small&gt;{this.props.maxLetters - this.state.characterCount} Remaining&lt;/small&gt;</pre><p>If you increase the characterCount, the characters remaining display decreases.</p><p>But — nothing happens when you type! We’re never changing the value of characterCount. We need to add an event handler to the textarea so that we change the characterCount when the user types.</p><h3>Event Handlers</h3><p>When you’ve written JavaScript in the past, you’ve probably written event handlers to interact with user input. We are going to do the same in React, the syntax is going to be a little bit different.</p><p>We are going to add a onChange handler to our textarea. Inside of it, we will place a reference to an event-handling method that will run every time the user types in the textarea.</p><pre>&lt;textarea className=&quot;form-control&quot; placeholder=&quot;Write a comment...&quot; onChange={this.handleChange}/&gt;</pre><p>Now we need to create a handleChange method!</p><pre>class Comment extends React.Component {  <br>   constructor () { <br>     super() <br>     this.state = { characterCount: 0 } <br>    } <br>    <br>    handleChange (event) { <br>      console.log(event.target.value) <br>    } <br>...</pre><p>Right now, we’re just console.log-ing the event.target.value. This will work the same way as it does in React-less JavaScript (though if you dive a little deeper, the event object is a little bit different). If you look at that console, we are printing out what we are typing in the textbox.</p><p>Now we need to update the characterCount attribute in state. In React, we <em>never directly modify state</em>, so we can&#39;t do something like this: this.state.characterCount = event.target.value.length. We instead need to use the this.setState method.</p><pre>handleChange (event) { <br>   this.setState({ characterCount: event.target.value.length }) <br>}</pre><p>But! You get an error — “Uncaught TypeError: this.setState is not a function”. This error is telling us that need to preserve the context of the ES6 class within the event handler. We can do this by binding this to the method in the constructor! If you want to read more about this, <a href="https://medium.freecodecamp.org/this-is-why-we-need-to-bind-event-handlers-in-class-components-in-react-f7ea1a6f93eb">here&#39;s a good article</a>.</p><pre>class Comment extends React.Component { <br>   constructor () { <br>     super() this.handleChange = this.handleChange.bind(this) <br>...</pre><p>Okay! We’re almost there. We just need to add the ability to toggle the like showing up.</p><p>We need to add a constructor to our Like component. In that constructor, we need to instantiate the component&#39;s state. The thing that will change within the lifecycle of the component is whether or not the status has been liked.</p><pre>class Like extends React.Component { <br>    constructor() { <br>      super() <br>      this.state = { liked: false } <br>     } <br>...</pre><p>Now we need to add an event handler to change whether or not the status has been liked:</p><pre>class Like extends React.Component { <br>  constructor() { <br>    super() <br>    this.state = { liked: false }<br>    this.toggleLike = this.toggleLike.bind(this) <br>   } </pre><pre>  toggleLike () { <br>    this.setState(previousState =&gt; ({ liked: !previousState.liked    })) <br>   } <br>...</pre><p>The difference here is that the callback function this.setState receives a parameter -- previousState. As you can probably guess from the name of the parameter, this is the value of state before this.setState is called. setState is asynchronous, so we can&#39;t depend on using this.state.liked within it.</p><p>Now, we need to:</p><p>a) call the event handler whenever the user clicks on the like button</p><p>b) only show the LikeIcon when liked is true</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/df42f346d9768ca6e13bd18ffdaf71af/href">https://medium.com/media/df42f346d9768ca6e13bd18ffdaf71af/href</a></iframe><p>Awesome! Now all of our functionality is in place!</p><h3>Bonus: Functional components</h3><p>If you feel like you’re in over your head already, feel free to skip this part. I wanted to make one more quick refactor to this project. If we create components that don’t have state associated with them (which we call stateless components), we can make our components into functions instead of ES6 classes.</p><p>In that case, our LikeIcon could look something like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d8aa29fb5e380d2570be01e3910f5c97/href">https://medium.com/media/d8aa29fb5e380d2570be01e3910f5c97/href</a></iframe><p>We just return the UI of the component instead of using the render method!</p><p><a href="https://codepen.io/aspittel/pen/NLrPWN">Here</a> is a CodePen that implements this refactor.</p><h3>Cheat Sheet</h3><p>I love cheatsheets, so I made one with the content of this post:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*jH9Vm3B7WVGr09-6.png" /></figure><p>You can also download it as a PDF <a href="https://zen-of-programming.com/react-intro/cheatsheet.pdf">here</a>!</p><h3>Next Steps</h3><p>To recap, we talked about the component architecture, the basic React syntax and JSX, state and props, event handlers, and functional components.</p><p>If you would like to view all the CodePens from this tutorial, <a href="https://codepen.io/collection/XpPbVv/">here</a> is a collection.</p><p>If you would like to try to extend the code from this tutorial, I would recommend changing likes to reactions or creating a photo component that reuses some of the components that we made!</p><p>Also, here are some other awesome places to learn React:</p><ul><li><a href="https://facebook.github.io/react/tutorial/tutorial.html">React Documentation</a></li><li><a href="https://www.youtube.com/watch?v=ZnRFerIP8aA">DevCoffee</a></li><li><a href="https://www.youtube.com/watch?v=hmwBow1PUuo&amp;list=PLu8EoSxDXHP5uyzEWxdlr9WQTJJIzr6jy">Wes Bos Redux</a></li></ul><h3>Keep in touch</h3><p>If you liked this article and want to read more, I have a <a href="https://tinyletter.com/ali_writes_code">weekly newsletter</a> with my favorite links from the week and my latest articles. Also, <a href="https://twitter.com/aspittel">tweet</a> me about things you want me to write tutorials on, or constructive feedback on how I could make these easier to follow! If you have any questions, my <a href="https://github.com/aspittel/ama">AMA repo</a> is the best place to reach me!</p><p><em>Originally published at </em><a href="https://zen-of-programming.com/beginners-guide-react"><em>zen-of-programming.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d490abc349c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/a-complete-beginners-guide-to-react-4d490abc349c">A Complete Beginner’s Guide to React</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Web Design Crash Course: from one non-designer to another]]></title>
            <link>https://medium.com/free-code-camp/a-web-design-crash-course-from-one-non-designer-to-another-a6f8da0e6aa?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a6f8da0e6aa</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[ui]]></category>
            <category><![CDATA[ux]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[design]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Fri, 24 Aug 2018 18:42:38 GMT</pubDate>
            <atom:updated>2018-08-24T18:42:38.012Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hUO_8TtnehSqpj_NPESE8Q.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/7okkFhxrxNw?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Kobu Agency</a> on <a href="https://unsplash.com/search/photos/web-design?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>I will preface this by saying that I’m not a professional designer. That being said, I like building pretty things and have had some success with that. A lot of developers seem overwhelmed by design. I wanted to do a quick write-up with visual examples with quick tips on how to improve the visuals of your site. Rules are made to be broken. If you want to make a great website as easily as possible, these are some good rules of thumb!</p><h3>Color</h3><p>I really enjoy playing with color on my websites, but there needs to be a balance and a coordinated color scheme for the site to look cohesive and professional. It’s essential that these colors don’t clash, that they have a reasonable level of contrast, and that they are consistent.</p><h4>Consistency</h4><p>Here’s my color scheme for <a href="https://the-zen-of-programming.com/">The Zen of Programming</a>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/316/0*6uVlBewyK2ur1klq.png" /></figure><p>I use the same hex codes for green, pink, and grey for my backgrounds, headers, text, and buttons.</p><p>You can use CSS variables to make sure that your colors are the same throughout your code.</p><pre>body { <br>  --pink: #CF92B7; <br>  --green: #59876B; <br>  --grey: #4A4A4A; <br>} </pre><pre>h1 { <br>  color: var(--pink); <br>}</pre><p>If you are using SCSS or another CSS preprocessor, this is even easier!</p><p>As far as the number of colors involved in your theme, four is usually a good bet. Maybe make two of these colors neutrals (like black, white, or grey) and two bolder pops of color. Monochromatic color schemes that use shades of one color can definitely work as well!</p><p>When I work with rainbow color schemes, I treat the rainbow as one color and then use two neutrals for everything else. For example, on <a href="https://alispit.tel/">alispit.tel</a> I use a dark grey for some text, white for the background, and then the rainbow colors for letters and random shapes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6mtqc_byscDtNvYK.png" /></figure><h4>Clashing Colors</h4><p>It’s important to make sure your colors look good together and don’t clash. Usually, the colors opposite to each other on the color wheel clash. Of course, you can make excellent websites that utilize clashing colors, but it is more difficult and may be better left to designers. Some examples would be red and green or orange and purple.</p><p>Also, keep the tones of the colors in mind — if you are using a cool toned pink, a cool toned green may be good to pair with it instead of a warm-toned green. Warm-toned colors have redder undertones, and cool toned colors are bluer.</p><h4>Contrast</h4><p>Make sure there’s a reasonable level of contrast between the colors on your website. If there isn’t, it will be much more difficult to read your content. <a href="https://marijohannessen.github.io/color-contrast-checker/">Here’s</a> an awesome site that will check your contrast for you. Lighthouse testing will also check this for you! In general, put light colors on top of dark ones, and dark colors on top of light ones!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*gMVtpEK7LL3qjbEc.png" /></figure><h4>Color Meaning</h4><p>If you are working on a website for a brand, different colors have different <a href="https://graf1x.com/color-psychology-emotion-meaning-poster/">implicit meanings</a> to readers. They can convey different moods so it can be helpful to keep those in mind.</p><h4>Tips for choosing colors</h4><p>There are a lot of awesome websites that make it easier to pick good color palettes that coordinate well.</p><p>I sometimes use the <a href="https://coolors.co/">Coolors</a> generator when I’m building a new site. I also follow <a href="https://www.instagram.com/colours.cafe/">this account</a> on Instagram, and I will save color palettes that I like when I see them. Finally, if I just want to see a bunch of colors and choose between them, I use the <a href="https://materializecss.com/color.html">color</a> page on Materialize — I like their colors!</p><h3>Text</h3><p>On most sites, the text will be the most critical part. You need it to be easy to read and for the most important content to be emphasized.</p><p>Here’s an example of really hard to read text:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/0*DDfMAMIyRJGj8Rm-.png" /></figure><p>Let’s work on making it more readable!</p><h4>Spacing</h4><p>Add spacing to your text content. There are a few types of spacing that can make your content more readable. The first is adding padding on the sides of your page.</p><p><strong>On the sides of your content:</strong></p><p>On a lot of websites — the text won’t span the width of the page, it will be inside of a container that takes up only part of the page. This makes the content more comfortable to read since your eyes need to move less, and the page will look better. The <a href="https://www.w3.org/TR/2008/REC-WCAG20-20081211/#visual-audio-contrast-visual-presentation">W3C</a> recommends fewer than 80 characters per line.</p><pre>&lt;style&gt; <br>.container { <br>  width: 80%; margin: 0 auto; <br>} <br>&lt;/style&gt; </pre><pre>&lt;div class=&quot;container&quot;&gt; <br>  &lt;p&gt; <br>  Lorem ipsum dolor amet master cleanse cloud bread brunch pug PBR&amp;B<br>  actually. Thundercats marfa art party man bun gluten-free<br>  sriracha. DIY tofu cred blue bottle etsy. Retro listicle normcore<br>  glossier next level etsy lumbersexual polaroid pour-over 90&#39;s<br>  slow-carb health goth banjo. Unicorn chicharrones 8-bit poke <br>  glossier. <br>  &lt;/p&gt; <br>&lt;/div&gt;</pre><p><strong>Line Height:</strong></p><p>We can add line-height to add more space between lines of text. The most recent Android operating system added a more substantial line-height to notifications. This makes them easier to read at a glance.</p><p>Also, it is best for accessibility purposes to add more line-height — the W3C recommendation is 1.5 to 2.0. Remember having to double space essays in high school? We’re doing the same thing here, just online this time!</p><pre>p { <br>  font-size: 18px; <br>  line-height: 2.0; <br>}</pre><p>This will transform the text on the left to the text on the right in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*0JnA__HVvsoV_Dgd.png" /></figure><p><strong>Paragraph Padding:</strong></p><p>I would also make sure to add padding in between your paragraphs so that it is easy to differentiate between them.</p><pre>p { <br>  padding-bottom: 27px; <br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/0*1sFABdqoOnGElrHY.png" /></figure><p><strong>Word Spacing:</strong></p><p>If you are using all-caps for a header, you may want to add more spacing in between words so that it is easier to differentiate between them.</p><p>Here is my blog’s header with additional word spacing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/0*CSv-kyX9uFpoDn59.png" /></figure><p>And here it is without:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/0*bwFU3evvMkES7bDy.png" /></figure><pre>h1 { <br>  word-spacing: 9px; <br>}</pre><p>The first is a lot easier to read!</p><h4>Alignment</h4><p>It is easiest to read content if it is aligned to the left and un-justified for English and other top-left to right languages. Your content will be this way by default! Just make sure you don’t have a text-align: center; on it! Feel free to center your headers or the container your text is in, but have long blocks of content left-aligned.</p><h4>Readable fonts</h4><p>Some fonts are easier to read than others. For content on the web, it is generally easier to read fonts that are sans-serif. Serifs are the little points that come off of the ends of letters in some fonts — you can see a serif in the green circle in the diagram below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/236/0*Hn0mtoRf9ux42EHb.png" /></figure><p>My rule of thumb is one decorative (think cursive or un-traditional) font or a serif font for headers and one sans-serif font for content per website.</p><h4>Some of my favorite fonts:</h4><p><strong>Serif and Decorative</strong></p><ul><li><a href="https://fonts.google.com/specimen/Pacifico">Pacifico</a></li><li><a href="https://fonts.google.com/specimen/Righteous">Righteous</a></li><li><a href="https://fonts.google.com/specimen/Fira+Sans">Fira Sans</a></li></ul><p><strong>Sans-Serif</strong></p><ul><li><a href="https://fonts.google.com/specimen/Roboto">Roboto</a></li><li><a href="https://fonts.google.com/specimen/Lato">Lato</a></li><li><a href="https://fonts.google.com/specimen/Montserrat">Montserrat</a></li><li>Arial — this one comes on your computer</li></ul><h4>Color</h4><p>Black text on a white background can cause eye strain because of too much contrast. I use dark greys for my content. Then, there is still a lot of contrast, but not as much as there would be with black text.</p><p>The same is true with backgrounds — a pure black is often not the best choice — a dark navy or grey will make your content easier to read.</p><h4>Sizing</h4><p>There are differing opinions on how large your content should be and what unit of measurement you should use (em vs. px for example). The consensus leans towards 16–18 pixels and having that scale for people who zoom in or out on your site.</p><p>Headers of varying types should be larger than your content. Also, use different font weights to differentiate text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*a0Rb3mFd0X52iNWG.png" /></figure><h4>Once we change these things…</h4><p>Our content becomes a lot easier to read!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/0*xcjyRs99AEh3Wpgq.png" /></figure><h3>Backgrounds</h3><p>Making background images look good, especially with text on top of them, is really difficult. I would avoid background images unless they are critical to the site. I’m going to give a couple alternatives and solutions for making background images work if you still decide to use one!</p><p>On the below image, the text is challenging to read.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*tDI7dY0Bt6UP2GG_.png" /></figure><h4>Split the Page</h4><p>If you want to keep the image, you could split the page so that the picture displays on one half and the text on the other.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*P2gGaHDDiNzJlM8t.png" /></figure><pre>&lt;style&gt; <br>  .container { <br>    display: grid; <br>    grid-template-columns: 1fr 1fr; <br>  } <br>&lt;/style&gt;</pre><pre>&lt;div class=&quot;container&quot;&gt; <br>  &lt;div class=&quot;text&quot;&gt;My Text&lt;/div&gt;<br>  &lt;img src=&quot;path/to/img&quot;&gt; <br>&lt;/div&gt;</pre><h4>Use a less busy picture</h4><p>If you want to keep the full page background image, if possible, use a simple picture without too much going on. In the one I’m using above, there are a lot of colors and large text that the user can still read. Using an image of a landscape or a pattern will be less distracting.</p><h4>Add Text Shadow</h4><p>You can also add a text shadow below your text to make it more readable.</p><pre>.text { <br>  text-shadow: #4A4A4A 1px 1px 8px; <br>}</pre><p>With the above changes in place and an increased font-size, the font on a background image becomes a lot easier to read!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/0*4GhOPGXDuMU_l9A-.png" /></figure><h4>Background Colors</h4><p>I wouldn’t use a super bright color for your background. Pretty much any color will be difficult to read on top of it, and it may strain people’s eyes to read.</p><h3>Calls to Action</h3><p>When you build a website, there’s usually something that you want the user to do. On e-commerce sites, you want the user to buy something. On a portfolio, you probably want the viewer to contact you. On a blog, you want the user to subscribe. When you’re designing a site, keep that action in mind. You may want to use a bright color, larger text, or feature that “call to action” on multiple places on your site. You also may want to make sure that it is visible everywhere on the site.</p><p>For example, my subscribe form for my blog is always in the sidebar, and it has color on it to grab the reader’s attention. On my portfolio, I have links to my social media accounts on the home, about, and contact pages.</p><p>Emphasizing the important content will look different on every site. It’s important to keep the action you want the user to take in mind with each design choice you make.</p><h4>More Reading</h4><ul><li><a href="https://www.smashingmagazine.com/articles/">Smashing Magazine</a> — lots of design articles on here</li><li><a href="https://dev.to/aspittel/designing-with-sketch-42jp">Designing with Sketch</a> — an article I wrote on how to use the design software Sketch, which is what I use to design everything. A lot of the steps will apply to other design software as well.</li><li><a href="https://hellowebbooks.com/learn-design/">Hello Web Design</a> — This is an awesome book that discusses web design geared towards beginners.</li><li><a href="https://speakerdeck.com/sschoger/the-little-details-of-ui-design">The Little Details of UI Design</a> — An excellent slide deck that goes through a LinkedIn redesign — this one is a little more advanced.</li></ul><h3>UI Frameworks</h3><p>You may not want to start from scratch when you design a site, so using a UI Framework may be helpful. Some of these include:</p><ul><li><a href="https://v4-alpha.getbootstrap.com/">Bootstrap</a>, which I would make sure to customize since its heavily used</li><li><a href="https://materializecss.com/">Materialize</a>, which follows Google’s Material design philosophy, and</li><li><a href="http://grommet.io/">Grommet</a>, my favorite aesthetically — it also emphasizes accessibility.</li></ul><h3>Design Checklist</h3><p>Since this is a pretty long post with a lot of tips, I wanted to distill the most important information into a checklist. It’s written in GitHub markdown, so you can copy and paste it onto an issue or into a markdown file. Then you can either check the box or replace the space with an x for each action item.</p><pre>## Color <br>- [ ] Uses consistent colors throughout <br>- [ ] Uses non-clashing colors <br>- [ ] The color choice makes sense for the business purpose of the site </pre><pre>## Text <br>- [ ] The text has padding on both sides. <br>- [ ] The line-height is 1.5-2.0 <br>- [ ] There&#39;s padding between paragraphs <br>- [ ] If your headings are in all caps, there&#39;s increased word spacing <br>- [ ] Blocks of text are un-justified <br>- [ ] Blocks of text are left-aligned <br>- [ ] Sans-serif fonts are used for body text <br>- [ ] A maximum of two fonts are used - one decorative or serif and one sans-serif <br>- [ ] body text isn&#39;t pure black on white <br>- [ ] body text is 16-18px and is scalable </pre><pre>## Backgrounds <br>- [ ] Use a pattern or simple image <br>- [ ] A text shadow is used to make headings readable <br>- [ ] The background isn&#39;t too bright </pre><pre>## Calls to Action <br>- [ ] Important information is highlighted in order to attract user interaction</pre><h3>Keep in Touch</h3><p>If you liked this article and want to read more, I have a <a href="https://tinyletter.com/ali_writes_code">weekly newsletter</a> with my favorite links from the week and my latest articles. Also, <a href="https://twitter.com/aspittel">tweet</a> me your favorite design tips! I have a ton more than I could have discussed in this article like responsiveness, whitespace, and alignment. If you want to see more posts like this, let me know!</p><p><em>Originally published at </em><a href="https://zen-of-programming.com/design"><em>zen-of-programming.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a6f8da0e6aa" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/a-web-design-crash-course-from-one-non-designer-to-another-a6f8da0e6aa">A Web Design Crash Course: from one non-designer to another</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My best tips for new developers: advice from a (mostly) self-taught software engineer]]></title>
            <link>https://medium.com/free-code-camp/my-best-tips-for-new-developers-advice-from-a-mostly-self-taught-software-engineer-9cb2f6238177?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cb2f6238177</guid>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Sun, 19 Aug 2018 20:42:21 GMT</pubDate>
            <atom:updated>2018-08-19T20:42:21.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*79DTI6nfnHUqJ7dlRNnPAQ.png" /></figure><p>The most common question I get from blog readers is “What is your advice for new programmers?” So, I thought it was time to write up my thoughts.</p><p>I will write up my full story in the future, but I took two computer science classes in college. Then, I got a software engineering internship shortly after. I started doing web development work. Initially, I worked on the backend and then eventually on the frontend. My college definitely did not teach web development in those first few computer science classes, so I taught myself.</p><p>I don’t think my story is unique. All programmers are self-taught to some degree, whether they’re fully self-taught or have a masters in computer science. Everyone has taught themselves something like RegEx along the way. In fact, self-teaching may be one of the most important skills you can have as a developer.</p><p>In addition to my own experience, I also teach people to code as my primary job and for organizations I volunteer with. So this article is drawing on that experience as well.</p><p>So here are my tips for getting started.</p><h3>My Tips for New Programmers</h3><h4>1. Have your reason, and remember it</h4><p>If you want to start programming, there has to be a reason for that. That reason can be you love writing code or that you want to have a more lucrative career. It could be that you are doing a bunch of Excel work and you want to make that more efficient.</p><p>Keep track of that reason. Programming is hard, and you will get frustrated sometimes. It is essential to keep that reason in mind and to stick with it. You could put a sticky note on your computer or a note on your home screen. Or (like me) write it on your mirror with a dry erase marker.</p><h4>2. Build a solid foundation</h4><p>This may be a less common piece of advice, but I think its really helpful. Before you start writing code, if you haven’t looked at math in a while, I would revisit the concepts from Algebra 1. Programming is built on Algebra 1 math, like functions and variables. Understanding these concepts outside of programming will be super valuable in the future. I recommend <a href="https://www.khanacademy.org/math/algebra/">Khan Academy’s</a> Algebra 1 course!</p><pre>let x = 1; // conceptually the same as algebraic variables!</pre><pre>function add (x, y) { // the same as algebraic functions!<br>  return x + y<br>}</pre><h4>3. Find a community</h4><p>Finding a community to support you as you start writing code will be helpful. This community will be valuable, because other people will be in the same place as you. They can offer resources that helped them and offer encouragement.</p><p>I would suggest finding a meetup in your area as the top solution here. Even small cities tend to have a group somewhat nearby. If there isn’t one, I would suggest <a href="https://dev.to/">dev.to</a> and the CodeNewbie community as two excellent alternatives. CodeNewbie has a weekly Twitter chat, a Slack group, and podcasts to listen to. Dev.to has a bunch of blog posts and a #discuss tag where you can post your questions.</p><h4>4. Break down problems into smaller ones</h4><p>One of the most important parts of programming is taking a large problem and breaking it into smaller and smaller pieces until those pieces are solvable. If you are looking at a blank text editor not knowing where to start, it may be because you haven’t broken down the problem enough!</p><h4>5. Pseudocode</h4><p>Related to the previous point, a lot of times it is beneficial to write down in detail what you are trying to do in plain words before even trying to write code. This process is called pseudocoding, and it can take whatever form you want it to. It can also be helpful to solve a problem really slowly on paper first. You think about or even write down the individual steps you are going to take to solve that problem.</p><pre>// if the user has more than ten points<br>//     display &quot;winner&quot; on the page<br>// else<br>//     keep playing</pre><h4>6. Embrace the cycle of learning</h4><p>If you’re learning to code as a second career, especially if you’ve been away from the classroom for a while, learning how to learn is going to be a big part of your process. There are lots of ups and downs involved, which is very natural! I would brace yourself for that rollercoaster before starting out.</p><h4>7. Start with free resources</h4><p>There are a million and one resources for learning how to code. Some are free, and some are paid. I would start with the <a href="https://zen-of-programming.com/favorite-free-resources">free resources</a>. Make sure you like writing code first. Then after that, you could think about moving onto paid resources or even a bootcamp.</p><h4>8. Find your niche</h4><p>There are a lot of worlds within programming, so try to find one world that you love and focus on that. Instead of trying to learn 8 programming languages, frontend and backend, compiled and interpreted languages, all the text editors, developer tools, and so on, find a few things you are really interested in and get good at them.</p><h4>9. Get good at pattern recognition</h4><p>Recognizing patterns in code is one of the most important skills you can have. When people talk about writing “DRY” code (i.e., Don’t Repeat Yourself) they are talking about reducing the patterns in your code. I recommend the game Set for pattern recognition — you can even <a href="https://www.nytimes.com/crosswords/game/set">play online each day</a> on the New York Times’ website!</p><pre>// not DRY code<br>let reversedString = string.split(&quot;&quot;).reverse().join(&quot;&quot;)<br>let reversedString2 = string2.split(&quot;&quot;).reverse().join(&quot;&quot;)</pre><pre>// cleaner code</pre><pre>const reverse = string =&gt; string.split(&quot;&quot;).reverse().join(&quot;&quot;)<br>let reversedString = reverse(string)<br>let reversedString2 = reverse(string2)</pre><h4>10. Make good habits early</h4><p>It will be easier to write clean code in the future if you get into the habit early. Bad habits can be hard to break. <a href="https://zen-of-programming.com/cleaner-code">Here</a> are my tips for writing cleaner code. If you are doing web development, running <a href="https://validator.w3.org/">HTML</a> and <a href="https://jigsaw.w3.org/css-validator/">CSS</a> validators on your code can tell you exactly what to fix!</p><pre>// Not great</pre><pre>function avg (a) {<br>  let s = a.reduce((x, y) =&gt; x + y)<br>  return s / a.length<br>}</pre><pre>// Much better!</pre><pre>function sumArray(array) {<br>  return array.reduce((number, currentSum) =&gt; number + currentSum)<br>}<br><br>function averageArray(array) {<br>  return sumArray(array) / array.length<br>}</pre><h4>11. Identify your learning style</h4><p>Everybody learns differently. Whether you are a visual, audio, or kinesthetic learner, you learn differently than the next person. Identify how you learn best, and rely on resources that fit that style well. For example, I learn best from reading the documentation and its code examples. I lose focus easily in tutorials.</p><h4>12. Struggle, but not too much</h4><p>Struggling a little bit when you are learning is really important. You want to solve the problem yourself and find an answer using resources that exist. That said, it is unproductive and demotivating to struggle with a problem for too long. After a few hours, reach out to someone for help!</p><h4>13. Get comfortable with failure</h4><p>Programming is hard, and finding the right answer won’t be immediate. One of the most pivotal moments in my programming journey was <a href="https://dev.to/aspittel/how-i-finally-wrote-a-sudoku-solver-177g">failing at writing a Sudoku solver</a>. It can be challenging to adjust to not getting everything right away and seeing those error messages. But that is a huge part of programming.</p><h4>14. Love your error messages</h4><p>Error messages are super helpful! When you are starting out, that red error message can be terrifying! One huge step to take is to read through those messages, understand them, and then use them to solve the problem. In fact, you will get to a point where a program silently failing will be far more annoying than a useful error message.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beEXOF4qTdoCqxdlNtLLFA.png" /><figcaption>Python Error Message</figcaption></figure><h4>15. Some programming languages are easier than others</h4><p>There isn’t a right answer for what programming language to learn first. Some will be easier to pick up. My top three are Python, Ruby, and JavaScript. I like them because they have a large community behind them, have more straightforward syntax, and are interpreted, so you don’t need to go through a compiling process.</p><h4>16. You don’t need to know everything</h4><p>It is straight up 100% impossible to know everything about programming. Nobody knows every programming language, every single method that’s out there, every library and framework, or the perfect solution to every problem. Don’t worry about learning everything, just focus on what you do know and extend that.</p><h4>17. Focus on depth over breadth</h4><p>Learning one thing in depth is better than learning a tiny bit about a lot of things, especially at first. That in-depth knowledge will carry over and make learning that next thing easier. Put the blinders on, so you don’t get tempted to drop what you’re learning and move to something new.</p><h4>18. Focus on the fundamentals first</h4><p>The fundamentals of programming are invaluable. You will use them no matter what you end up doing with programming. Focus on having a solid knowledge of loops, conditionals, functions, data types, and (in most languages) object-oriented programming before moving on to learning about that awesome library that everyone’s talking about.</p><p>It will be so much easier to learn that library once you know the fundamentals really well. They will also carry over from language to language, so you only have to really learn them once. After that it’s just syntax!</p><h4>19. Get good at Problem-solving</h4><p>Problem-solving is the basis of programming! Getting better at this is critical. Solving riddles, writing code on paper, and breaking down problems can really help with problem-solving.</p><p>Something I sometimes see with new developers is that they approach programming like a research problem instead of a problem-solving project. If they Google something well enough, then they’ll have a solution. Yes, Google and Stack Overflow are super helpful, but rely on yourself sometimes too. Try something out a few different ways before researching it. Or, research small parts of the problem instead of the problem itself — i.e. “turn a String into an array JavaScript” instead of “reverse string JavaScript.”</p><h4>20. Get good at researching</h4><p>One of the biggest things to learn is how to find good answers to your questions or to learn new features of your language or library. Using Google is important, so is joining communities and subscribing to resources. The Google template I normally use is “problem language/framework/library” in as few words as possible and without filler. So, “sort array JavaScript”, “spin element CSS”, or “create router Vue.”</p><h4>21. Build projects you love</h4><p>When you’re learning, you will be building various projects to practice (and show off) your skills. Pick project ideas that are interesting to you — you will be much more likely to finish them and want to put work into them. Related: complete those projects. A few really good finished projects is way more impressive than a bunch of half-finished ones!</p><h4>22. Compare yourself only to yourself</h4><p>There are a lot of people learning to code out there. Don’t compare your progress to someone else’s. Instead, compare yourself to previous you and focus on your own growth.</p><h4>23. Do a bunch of code challenges</h4><p>Doing quick code challenges can really help solidify the fundamentals. They are great for problem-solving and practicing for interviews. I post one on <a href="https://twitter.com/aspittel">Twitter</a> every day with the hashtag <a href="https://twitter.com/hashtag/CodingPuzzle?src=hash">#CodingPuzzle</a> if you want someone else to solve them with!</p><pre>&quot;&quot;&quot;<br>Find the element in an array that only occurs once<br>from <a href="https://www.hackerrank.com/challenges/ctci-lonely-integer">https://www.hackerrank.com/challenges/ctci-lonely-integer</a><br>&quot;&quot;&quot; <br>from collections import Counter</pre><pre>def lonely_integer(a):<br>    a_counter = Counter(a)<br>    for l, count in a_counter.items():<br>        if count == 1:<br>            return l</pre><h4>24. Celebrate your wins</h4><p>Learning to program can be a really difficult process, so when you accomplish something, even if its small, celebrate it! I keep track of my wins in <a href="https://keep.google.com/">Google Keep</a> so, if I have a bad day, I can come back to those wins and remember them.</p><h4>25. Programming is awesome</h4><p>Programming is really cool because you get to build things. I always come back to this Sandi Metz quote:</p><blockquote><em>Those of us whose work is to write software are incredibly lucky. Building software is a guiltless pleasure because we get to use our creative energy to get things done. We have arranged our lives to have it both ways; we can enjoy the pure act of writing code in sure knowledge that the code we write has use. We produce things that matter. We are modern craftspeople, building structures that make up present-day reality, and no less than bricklayers or bridge builders, we take justifiable pride in our accomplishments.</em></blockquote><blockquote><em>This all programmers share, from the most enthusiastic newbie to the apparently jaded elder, whether working at the lightest weight Internet startup or the most staid, long-entrenched enterprise. We want to do our best work. We want our work to have meaning. We want to have fun along the way.</em></blockquote><blockquote><strong><em>Sandi Metz</em></strong></blockquote><h3>Keep in Touch!</h3><p>If you liked this article, there’s a lot more where it came from! I send out a <a href="https://tinyletter.com/ali_writes_code">newsletter</a> every week with my favorite links and what I’ve written that week. You can also <a href="https://twitter.com/ASpittel">follow me</a> on Twitter to see my posts as they come out!</p><p><em>Originally published at </em><a href="https://zen-of-programming.com/start-programming"><em>zen-of-programming.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cb2f6238177" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/my-best-tips-for-new-developers-advice-from-a-mostly-self-taught-software-engineer-9cb2f6238177">My best tips for new developers: advice from a (mostly) self-taught software engineer</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to build a kickbutt portfolio]]></title>
            <link>https://medium.com/free-code-camp/how-to-build-a-kickbutt-portfolio-57b26a0b825d?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/57b26a0b825d</guid>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[portfolio]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Tue, 07 Aug 2018 19:46:27 GMT</pubDate>
            <atom:updated>2018-08-07T19:46:27.368Z</atom:updated>
            <content:encoded><![CDATA[<p>Over the years, I’ve rebuilt my website a few times and have made changes to the way my portfolio is displayed. In this article, I’ll share my personal tips and provide an in-depth look on what worked and what didn’t to help you build an awesome portfolio. I’ll also provide you a few links to other people’s portfolios that I love.</p><p>According to GitHub, I’ve had a personal site with my portfolio since September 2016. Looking at the Google Analytics for my site, I got less than 300 views on the two iterations of my portfolio from September 2016 through October 2017. I was pretty demotivated, but I didn’t give up. 💪</p><p>In October 2017, I did a complete rewrite of <a href="https://www.alispit.tel/">my site</a>, and the results were pretty dramatic. I got 1,861 views in the first month, and I’ve averaged around thousand hits a month since then.</p><p>Of course, correlation is not causation, but I do think the redesign definitely had a positive impact. It’s not exactly Facebook, but for a portfolio site that doesn’t provide the viewer with anything but information about me, I think these numbers are pretty good. 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*S_2sOF62M8IJS1l8.png" /><figcaption>Personal Site Visitors</figcaption></figure><h3>What Didn’t Work</h3><p>Before I get to my current portfolio that I really love, I want to talk about my first two sites.</p><h4>My First Portfolio</h4><p>The first portfolio was a Jekyll site which used SASS and Pug. I deployed it <a href="http://average-cause.surge.sh/">here</a> for nostalgia’s sake. Check out the projects, they’re all from college, and most are in C++!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*of05m18Zk9nzalzl.png" /><figcaption>My first iteration - Learning CSS</figcaption></figure><p>This setup was unnecessarily complex for the actual content of the website. I used Jekyll, Materialize (CSS framework), SASS, and Pug for such a simple page. I think the Gulp setup was longer than the actual CSS needed. 😆</p><p>I was just transitioning to writing frontend code at any capacity, so this was really a learning opportunity for me to use SASS and Gulp. I had no need for Jekyll either. I only had a few projects listed and only one page.</p><p>Also, there were a bunch of 404’s showing up in the console for resources that were not found. If I was a developer looking at the site, I would definitely be critical of that.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dDIGrR68O2a05_XA.png" /></figure><p>The screenshots for my projects were not great. They were all either of code or cropped in an un-optimal way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZFKgufS18jyGqjOv.png" /></figure><p>The fonts were also too small, so it was difficult to read the text. My social icons were not exactly the most prominent, which meant that they probably didn’t have too high of an engagement rate.</p><p>There were some things that I did well, though. I really like the highlighted words in the bio. It draws the user to look at those keywords, even if they don’t read the whole bio. I also appreciate that the site was responsive, so users could view the site on different sized screens. Currently, around a third of my traffic comes from mobile sources, so its important to remember those users.</p><h4>My Second Portfolio</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FtH4b9t7d77RCqXB.png" /><figcaption>My second iteration - Polka Dots :-)</figcaption></figure><p>The second iteration was an HTML and CSS site with moving polka dots in the background. You can check it out <a href="http://third-match.surge.sh/">here</a>. I will admit that I still have a soft spot for this portfolio.</p><p>I really like the moving bubbles, and how they changed with user interaction. I also enjoy the minimalism of the site. I think the quick bio on the homepage was effective and expressed my interests well.</p><p>Again, the fonts are somewhat small, and having to navigate to a new HTML page to view any information about me is probably not the best user experience. Also, having my talks and my code projects on the same page makes it look unbalanced and cluttered.</p><p>Overall, though, you can see a lot of the themes from this portfolio in my current one.</p><h3>What Worked</h3><p>In October of last year, I started from scratch and built a <a href="https://www.alispit.tel/">portfolio</a> that was a little bit out of the box. <strong>Your portfolio is one of the only sites that you will build that is a complete creative expression of yourself with no constraints.</strong></p><p>So, I went all in — built interactivity, animations, you name it, the portfolio had it all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*M8Ne74MXrMTJyHF-.png" /><figcaption>My final iteration - The Works</figcaption></figure><p>If you click anywhere on the homepage, a random shape appears. If you hover over the letters, they animate. If you hover over my picture on the bio page, it spins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bMH1CrkWPH0FE8EC.png" /></figure><p>I used Vue for this portfolio, so it seamlessly transitions from page to page. I also increased the font sizes, so readers could gather information more quickly and easily. My contact page offers large buttons to follow me elsewhere on the internet.</p><p>The original version of this design was built in HTML, CSS, and a very few lines of JavaScript. As far as my technology needs go, this was totally fine. I wanted to move to Vue for my own maintainability needs. The reconfigured setup makes adding new projects a lot easier. I also like the smooth routing that Vue Router offers, instead of navigating to an actual new page.</p><p>This design grabs people’s attention, and they stay on the site in order to interact with it. Also, people reach out to me about my site a lot, which, if I was looking for a job, would be awesome!</p><h3>What I could still do better</h3><p>Here is a list of few things I could still work on improving</p><ul><li>As far as effectiveness for converting people to my other social media, I could have links to my other social media on each page rather than just the contact page.</li><li>I also probably need to cull through my projects and choose a few to feature, rather than have 26 personal projects listed.</li><li>I also don’t have screenshots of my projects. This is intentional, but I could probably get more traffic to them if I put a screenshot of the project on them. I didn’t like the different color palettes that adding in screenshots of my program would create.</li></ul><p>I don’t have many projects that I find super impressive. For the most part, they are pretty small, and I had created them to learn something. I could further optimize my site, but for now, I really like where it is at.</p><h3>My tips for building a kickbutt portfolio</h3><ul><li>Make a portfolio that is a true expression of yourself. Programming is, in a lot of ways, a creative field, so use your creativity!</li><li>Make the site interactive so people want to stay on your site, and they remember it.</li><li>Buy a domain name. I moved from aspittel.github.io to alispit.tel. I really like the play on my name, and you can get a lot of domains for pretty cheap. I use NameCheap, and it’s totally worth the $8.00 a year for the domain.</li><li>Make sure you don’t have console errors. Alot of technical employers look for this, so make sure that your site is bug-free!</li><li>Don’t use a technology just for the sake of it. If you have a super minimalistic personal website, don’t use a heavy-duty framework or library just for the sake of using it. <strong>Having a simple site that is super slow is a bad user experience.</strong></li><li>Make sure your website is responsive and works on mobile phones. I would also encourage you to make it work for users that use a split-screen setup.</li><li>I would steer away from using a template found online. To me, it’s pretty apparent when these are used. I understand using them for people who aren’t web developers, but if you are a web developer, show off your skills!</li><li>Use the portfolio to market yourself. If you want to show off specific skills to employers, make sure those skills are featured on your site. I want people to visit <a href="https://zen-of-programming.com/">my blog</a>, so I have it featured on my home page. I also want to do more speaking, so I have a whole page dedicated to my talks. I no longer want to write C++ code professionally, so I took those projects off of my site.</li><li>Make sure your links aren’t broken. I have totally been guilty of this at certain points, but it doesn’t look great, and then your viewers can’t see that destination!</li><li>Keep your portfolio up to date. I’m guilty of not doing this that often too, but I try at least every few months to add new projects and talks to my site.</li><li>Use a critical eye, and be intentional about the design. I use Sketch to draft my sites before moving to code.</li><li>Think about page speed. I run <a href="https://developers.google.com/web/tools/lighthouse/">lighthouse</a> testing on all of my sites to make sure they are performant.</li></ul><h3>A few of my favorite portfolios</h3><ul><li><a href="https://timobecker.com/">Timo Becker</a> - You connect the dots and create different illustrations — just play with it, it’s awesome.</li><li><a href="http://benhalpern.com/">Ben Halpern</a> - this site is so memorable and fun.</li><li><a href="http://julia.im/">Julia Khusainova</a> - This site is really minimalistic, but gets the point across.</li><li><a href="http://nik.org/">Nik Papic</a> - another simple but pretty one.</li><li><a href="http://www.rleonardi.com/interactive-resume/">Robby Leonardi</a> - a game resume!</li><li><a href="https://flexdinesh.github.io/">Dinesh Pandiyan</a> - the color change is a really cool feature, and I like the minimalist design.</li></ul><h3>Your site</h3><p>I love looking at other people’s portfolios and offering advice on them. I comment on portfolio feedback threads all the time when I see them. If you have one you’re looking for feedback on, <a href="https://twitter.com/aspittel">Tweet</a> me a link to your site, and I will look over it and send some feedback! Or, if you just have an awesome one, send it to me too! I would love to add it to my list of favorites.</p><p>Also, if you liked this article, <a href="https://tinyletter.com/ali_writes_code">subscribe</a> to my weekly newsletter that contains my favorite links from the week!</p><p><em>Originally published at </em><a href="https://zen-of-programming.com/kickass-portfolio"><em>zen-of-programming.com</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=57b26a0b825d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/how-to-build-a-kickbutt-portfolio-57b26a0b825d">How to build a kickbutt portfolio</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I came back to an old problem and finally wrote a Sudoku-solving algorithm]]></title>
            <link>https://medium.com/free-code-camp/coming-back-to-old-problems-how-i-finally-wrote-a-sudoku-solving-algorithm-3b371e6c63bd?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/3b371e6c63bd</guid>
            <category><![CDATA[sudoku]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[computer-science]]></category>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Wed, 27 Jun 2018 13:45:12 GMT</pubDate>
            <atom:updated>2018-08-09T14:40:41.927Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ERYVo0W3nlPCEQGOHul6Rw.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/vAqmcvSMWMU?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Mike Wilson</a> on <a href="https://unsplash.com/search/photos/success?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>This article will be part technical, part personal story, and part cultural critique. If you are just here for the code and explanation, jump to the <strong>The Initial Approach</strong> header!</p><p>This story starts a few years ago in a college computer science classroom. I had an untraditional path to writing code — I randomly enrolled in a computer science class during my sophomore year of college, because I had an extra credit hour and I was curious what it was about. I thought we would learn how to use Microsoft Word and Excel — I genuinely had no idea what code was.</p><p>My high school definitely did not have any coding classes, they barely had functioning computers! I didn’t play video games or engage in activities that traditionally lead to kids learning how to code, either. So coding was brand new to me when I took that Python class in college.</p><p>As soon as I walked into the classroom, they had us type Python code into Idle, a text editor that comes with the Python language. They had printed the code and just had us type it in and run it — I was immediately hooked. Over the course of that class, I built a Tic Tac Toe script with a GUI to input pieces and a Flappy Bird clone. It honestly came pretty easily to me, and I had a ton of fun. I quickly decided to minor in computer science, and I just wanted to write more code.</p><p>The next semester, I enrolled in a Data Structures and Algorithms course which was next in the computer science sequence. The class was taught in C++, which, unbeknownst to me, was supposed to be learned over the summer before the class. It quickly became obvious that the professors were trying to use the class to filter out students — around 50% of the enrollees on day one made it through the semester. We even changed classrooms from a lecture hall to a break out room. My pride was the only thing keeping me in the class. I felt completely lost in pretty much every lesson. I spent many all-nighters working on projects and studying for the exams.</p><p>One problem in particular really got me — we were supposed to build a program in C++ that would solve any Sudoku problem. Again, I spent countless hours on the assignment trying to get the code working. By the time the project was due, my solution worked for some of the test cases but not all of them. I ended up getting a C+ on my assignment — one of my worst grades in all of college.</p><p>After that semester, I abandoned my idea of minoring in computer science, completely quit coding, and stuck to what I thought I was good at — writing and politics.</p><p>Of course, funny things happen in life and I obviously started coding again, but it took me a long time to feel like I was a competent programmer.</p><p>All that being said, a few years later into my programming journey, I decided to retry implementing the Sudoku solving algorithm to prove to myself that I could implement it now. The code isn’t perfect, but it will solve pretty much any Sudoku puzzle. Let’s walk through the algorithm and then the implementation.</p><h3>Sudoku Puzzles</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/305/0*1x7HCRDGuNSG0BS5.gif" /></figure><p>In case you haven’t played Sudoku puzzles before, they are number puzzles in which each row, column, and 3x3 square in the puzzle must have the numbers 1–9 represented exactly once. There are lots of approaches to solving these puzzles, many of which can be replicated by a computer instead of a person. Usually, when we solve them using a computer, we will use nested arrays to represent the Sudoku board like so:</p><pre>puzzle = [[5, 3, 0, 0, 7, 0, 0, 0, 0],<br>          [6, 0, 0, 1, 9, 5, 0, 0, 0],<br>          [0, 9, 8, 0, 0, 0, 0, 6, 0],<br>          [8, 0, 0, 0, 6, 0, 0, 0, 3],<br>          [4, 0, 0, 8, 0, 3, 0, 0, 1],<br>          [7, 0, 0, 0, 2, 0, 0, 0, 6],<br>          [0, 6, 0, 0, 0, 0, 2, 8, 0],<br>          [0, 0, 0, 4, 1, 9, 0, 0, 5],<br>          [0, 0, 0, 0, 8, 0, 0, 7, 9]]</pre><p>When solved, the zeros will be filled in with actual numbers:</p><pre>solution = [[5, 3, 4, 6, 7, 8, 9, 1, 2],<br>            [6, 7, 2, 1, 9, 5, 3, 4, 8],<br>            [1, 9, 8, 3, 4, 2, 5, 6, 7],<br>            [8, 5, 9, 7, 6, 1, 4, 2, 3],<br>            [4, 2, 6, 8, 5, 3, 7, 9, 1],<br>            [7, 1, 3, 9, 2, 4, 8, 5, 6],<br>            [9, 6, 1, 5, 3, 7, 2, 8, 4],<br>            [2, 8, 7, 4, 1, 9, 6, 3, 5],<br>            [3, 4, 5, 2, 8, 6, 1, 7, 9]]</pre><h3>The Initial Approach</h3><p>Because I didn’t feel like writing a full test suite with different puzzles, I used the challenges on <a href="https://www.codewars.com/">CodeWars</a> to test myself. The first problem I tried was <a href="https://www.codewars.com/kata/sudoku-solver">this</a> — where all of the puzzles were “easy” Sudokus that could be solved without a more complex algorithm.</p><p>I decided to try and solve the Sudokus in the way I personally do — where I would find the possible numbers for a space, keep track of them, and if there is only one possible number, plug it into that spot. Since these were easier Sudokus, this approach worked fine for this Kata, and I passed.</p><p>Here’s my (uncleaned) code!</p><pre>class SudokuSolver:<br>    def __init__(self, puzzle):<br>        self.puzzle = puzzle<br>        self.box_size = 3</pre><pre>    def find_possibilities(self, row_number, column_number):<br>        possibilities = set(range(1, 10))<br>        row = self.get_row(row_number)<br>        column = self.get_column(column_number)<br>        box = self.get_box(row_number, column_number)<br>        for item in row + column + box:<br>            if not isinstance(item, list)and item in possibilities:<br>                possibilities.remove(item)<br>        return possibilities</pre><pre>    def get_row(self, row_number):<br>        return self.puzzle[row_number]</pre><pre>    def get_column(self, column_number):<br>        return [row[column_number] for row in self.puzzle]</pre><pre>    def get_box(self, row_number, column_number):<br>        start_y = column_number // 3 * 3<br>        start_x = row_number // 3 * 3<br>        if start_x &lt; 0:<br>            start_x = 0<br>        if start_y &lt; 0:<br>            start_y = 0<br>        box = []<br>        for i in range(start_x, self.box_size + start_x):<br>            box.extend(self.puzzle[i][start_y:start_y+self.box_size])<br>        return box</pre><pre>    def find_spot(self):<br>        unsolved = True<br>        while unsolved:<br>            unsolved = False<br>            for row_number, row in enumerate(self.puzzle):<br>                for column_number, item in enumerate(row):<br>                    if item == 0:<br>                        unsolved = True<br>                        possibilities = self.find_possibilities(<br>                            row_number, column_number)<br>                        if len(possibilities) == 1:<br>                            self.puzzle[row_number][column_number] = list(possibilities)[<br>                                0]<br>        return self.puzzle</pre><pre>def sudoku(puzzle):<br>    sudoku = SudokuSolver(puzzle)<br>    return sudoku.find_spot()</pre><p>Of course, I also wanted to solve more difficult Sudoku puzzles, so I decided to implement a more complex algorithm in order to solve those puzzles.</p><h3>The Algorithm</h3><p>One algorithm to solve Sudoku puzzles is the backtracking algorithm. Essentially, you keep trying numbers in empty spots until there aren’t any that are possible, then you backtrack and try different numbers in the previous slots.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/0*r3mRojEAR9j0EcUs.gif" /><figcaption>Shoutout to Wikipedia for the awesome visualization!</figcaption></figure><p>The first thing that I did was continue my “easy” Sudoku solver’s approach of finding the possible values for each square based on which values were already in that square’s row, column, and box. I stored all of these values in a list so that I could quickly refer to them while backtracking or finding which value to use in that square.</p><p>Next, I needed to implement the forward moving and backtracking of putting items in each space. I put markers on each non-given space (so the ones that were zeros when the game started) so that those spaces would be included in the backtracking and given spots wouldn’t be. I then iterated through those un-solved spots. I would put the first item of the possible value list in that spot and then move to the next unsolved spot. I would then put the first possible value of that spot in its place. If it conflicted with the value of the previous slot, I would then move to the second item in the list of possible values and then move to the next slot.</p><p>That process would continue until there was no possible move for a given spot — that is, the end of the possible value list was reached and none of the values worked in that row, column, or box. Then, the backtracking algorithm kicked in.</p><p>Within the backtracking implementation, the code would move back to the last spot that was filled in and move to the next possible value and then start moving forward again. If the last of the possible values was reached at that spot as well, the backtracking algorithm would keep moving backwards until there was a spot that could be incremented.</p><p>Once the end of the puzzle was reached with correct values in each square, the puzzle was solved!</p><h3>My Approach</h3><p>I like object oriented approaches, so I have two different classes in my solution: one for the cell and one for the Sudoku board. My very imperfect code looks like this:</p><pre>class Cell:<br>    &quot;&quot;&quot;One individual cell on the Sudoku board&quot;&quot;&quot;</pre><pre>    def __init__(self, column_number, row_number, number, game):<br>        # Whether or not to include the cell in the backtracking<br>        self.solved = True if number &gt; 0 else False<br>        self.number = number  # the current value of the cell<br>        # Which numbers the cell could potentially be<br>        self.possibilities = set(range(1, 10)) if not self.solved else []<br>        self.row = row_number  # the index of the row the cell is in<br>        self.column = column_number  # the index of the column the cell is in<br>        self.current_index = 0  # the index of the current possibility<br>        self.game = game  # the sudoku game the cell belongs to<br>        if not self.solved:  # runs the possibility checker<br>            self.find_possibilities()</pre><pre>    def check_area(self, area):<br>        &quot;&quot;&quot;Checks to see if the cell&#39;s current value is a valid sudoku move&quot;&quot;&quot;<br>        values = [item for item in area if item != 0]<br>        return len(values) == len(set(values))</pre><pre>    def set_number(self):<br>        &quot;&quot;&quot;changes the number attribute and also changes the cell&#39;s value in the larger puzzle&quot;&quot;&quot;<br>        if not self.solved:<br>            self.number = self.possibilities[self.current_index]<br>            self.game.puzzle[self.row][self.column] = self.possibilities[self.current_index]</pre><pre>    def handle_one_possibility(self):<br>        &quot;&quot;&quot;If the cell only has one possibility, set the cell to that value and mark it as solved&quot;&quot;&quot;<br>        if len(self.possibilities) == 1:<br>            self.solved = True<br>            self.set_number()</pre><pre>    def find_possibilities(self):<br>        &quot;&quot;&quot;filter the possible values for the cell&quot;&quot;&quot;<br>        for item in self.game.get_row(self.row) + self.game.get_column(self.column) + self.game.get_box(self.row, self.column):<br>            if not isinstance(item, list) and item in self.possibilities:<br>                self.possibilities.remove(item)<br>        self.possibilities = list(self.possibilities)<br>        self.handle_one_possibility()</pre><pre>    def is_valid(self):<br>        &quot;&quot;&quot;checks to see if the current number is valid in its row, column, and box&quot;&quot;&quot;<br>        for unit in [self.game.get_row(self.row), self.game.get_column(self.column), self.game.get_box(self.row, self.column)]:<br>            if not self.check_area(unit):<br>                return False<br>        return True</pre><pre>    def increment_value(self):<br>        &quot;&quot;&quot;move number to the next possibility while the current number is invalid and there are possibilities left&quot;&quot;&quot;<br>        while not self.is_valid() and self.current_index &lt; len(self.possibilities) - 1:<br>            self.current_index += 1<br>            self.set_number()<br></pre><pre>class SudokuSolver:<br>    &quot;&quot;&quot;contains logic for solving a sudoku puzzle -- even very difficult ones using a backtracking algorithm&quot;&quot;&quot;</pre><pre>    def __init__(self, puzzle):<br>        self.puzzle = puzzle  # the 2d list of spots on the board<br>        self.solve_puzzle = []  # 1d list of the Cell objects<br>        # the size of the boxes within the puzzle -- 3 for a typical puzzle<br>        self.box_size = int(len(self.puzzle) ** .5)<br>        self.backtrack_coord = 0  # what index the backtracking is currently at</pre><pre>    def get_row(self, row_number):<br>        &quot;&quot;&quot;Get the full row from the puzzle based on the row index&quot;&quot;&quot;<br>        return self.puzzle[row_number]</pre><pre>    def get_column(self, column_number):<br>        &quot;&quot;&quot;Get the full column&quot;&quot;&quot;<br>        return [row[column_number] for row in self.puzzle]</pre><pre>    def find_box_start(self, coordinate):<br>        &quot;&quot;&quot;Get the start coordinate for the small sudoku box&quot;&quot;&quot;<br>        return coordinate // self.box_size * self.box_size</pre><pre>    def get_box_coordinates(self, row_number, column_number):<br>        &quot;&quot;&quot;Get the numbers of the small sudoku box&quot;&quot;&quot;<br>        return self.find_box_start(column_number), self.find_box_start(row_number)</pre><pre>    def get_box(self, row_number, column_number):<br>        &quot;&quot;&quot;Get the small sudoku box for an x and y coordinate&quot;&quot;&quot;<br>        start_y, start_x = self.get_box_coordinates(row_number, column_number)<br>        box = []<br>        for i in range(start_x, self.box_size + start_x):<br>            box.extend(self.puzzle[i][start_y:start_y+self.box_size])<br>        return box</pre><pre>    def initialize_board(self):<br>        &quot;&quot;&quot;create the Cells for each item in the puzzle and get its possibilities&quot;&quot;&quot;<br>        for row_number, row in enumerate(self.puzzle):<br>            for column_number, item in enumerate(row):<br>                self.solve_puzzle.append(<br>                    Cell(column_number, row_number, item, self))</pre><pre>    def move_forward(self):<br>        &quot;&quot;&quot;Move forwards to the next cell&quot;&quot;&quot;<br>        while self.backtrack_coord &lt; len(self.solve_puzzle) - 1 and self.solve_puzzle[self.backtrack_coord].solved:<br>            self.backtrack_coord += 1</pre><pre>    def backtrack(self):<br>        &quot;&quot;&quot;Move forwards to the next cell&quot;&quot;&quot;<br>        self.backtrack_coord -= 1<br>        while self.solve_puzzle[self.backtrack_coord].solved:<br>            self.backtrack_coord -= 1</pre><pre>    def set_cell(self):<br>        &quot;&quot;&quot;Set the current cell to work on&quot;&quot;&quot;<br>        cell = self.solve_puzzle[self.backtrack_coord]<br>        cell.set_number()<br>        return cell</pre><pre>    def reset_cell(self, cell):<br>        &quot;&quot;&quot;set a cell back to zero&quot;&quot;&quot;<br>        cell.current_index = 0<br>        cell.number = 0<br>        self.puzzle[cell.row][cell.column] = 0</pre><pre>    def decrement_cell(self, cell):<br>        &quot;&quot;&quot;runs the backtracking algorithm&quot;&quot;&quot;<br>        while cell.current_index == len(cell.possibilities) - 1:<br>            self.reset_cell(cell)<br>            self.backtrack()<br>            cell = self.solve_puzzle[self.backtrack_coord]<br>        cell.current_index += 1</pre><pre>    def change_cells(self, cell):<br>        &quot;&quot;&quot;move forwards or backwards based on the validity of a cell&quot;&quot;&quot;<br>        if cell.is_valid():<br>            self.backtrack_coord += 1<br>        else:<br>            self.decrement_cell(cell)</pre><pre>    def solve(self):<br>        &quot;&quot;&quot;run the other functions necessary for solving the sudoku puzzle&quot;&quot;&quot;<br>        self.move_forward()<br>        cell = self.set_cell()<br>        cell.increment_value()<br>        self.change_cells(cell)</pre><pre>    def run_solve(self):<br>        &quot;&quot;&quot;runs the solver until we are at the end of the puzzle&quot;&quot;&quot;<br>        while self.backtrack_coord &lt;= len(self.solve_puzzle) - 1:<br>            self.solve()<br></pre><pre>def solve(puzzle):<br>    solver = SudokuSolver(puzzle)<br>    solver.initialize_board()<br>    solver.run_solve()<br>    return solver.puzzle</pre><p><a href="https://www.codewars.com/kata/hard-sudoku-solver">Hard Sudoku Solver</a></p><h3>My Takeaways</h3><p>Sometimes it just takes time and practice. The Sudoku solver I spent countless college hours on took me less than an hour a few years later.</p><p>I will say that computer science programs don’t tend to start in a way that allows people who didn’t write code earlier in life to participate. In a few years, computer science education policies may change. But for now, this eliminates people who grew up in small towns, who weren’t interested in coding growing up, or who went to weaker high schools.</p><p>In part, this definitely contributes to the success of coding bootcamps which start with the fundamentals and teach the less conceptual web development skills rather than heavy algorithms.</p><p>I can now write the Sudoku solving algorithm, but I don’t think it’s a necessary skill for developers to have — I still became a successful software engineer shortly after that time when I couldn’t implement the Sudoku solver.</p><p>I do think that some computer science fundamentals can be very helpful, even for new developers. For example, the concepts behind Big-O notation can be really helpful for deciding between approaches. That being said, most data structures and algorithms aren’t used on a day to day basis, so why are they the basis for interviews and computer science classes instead of the more important things used every day?</p><p>I’m happy to see my own personal growth in coding; however, I can’t wait for a day when developers aren’t jumping through imaginary hoops to prove themselves, and when learning environments are much more constructive.</p><p><em>If you liked this article, please </em><a href="https://tinyletter.com/ali_writes_code"><em>subscribe</em></a><em> to my weekly newsletter where you’ll receive my favorite links from the week and my latest articles.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3b371e6c63bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/free-code-camp/coming-back-to-old-problems-how-i-finally-wrote-a-sudoku-solving-algorithm-3b371e6c63bd">How I came back to an old problem and finally wrote a Sudoku-solving algorithm</a> was originally published in <a href="https://medium.com/free-code-camp">We’ve moved to freeCodeCamp.org/news</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Objection + Knex = Painless PostgreSQL in your Node App]]></title>
            <link>https://medium.com/hackernoon/objection-knex-painless-postgresql-in-your-node-app-6c21e2703ac6?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/6c21e2703ac6</guid>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[node]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[postgresql-node-app]]></category>
            <category><![CDATA[express]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Tue, 20 Feb 2018 03:57:51 GMT</pubDate>
            <atom:updated>2018-08-01T16:12:50.165Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s no secret that I’m a total PostgreSQL fangirl — I rarely see a use case for using a different database, especially with the support for array and JSON fields. I also love Node and Express for simple APIs (without auth). In the past, SQL support within Node and Express hasn’t been perfect. I’ve been hearing great things about <a href="https://vincit.github.io/objection.js">Objection</a>, so I decided to try it out!</p><p>Objection, which is built on top of <a href="http://knexjs.org/">Knex</a>, uses the new ES7 class features to build a nice ORM query language for Node. ORMs allow you to use whatever programming language you are using for your app to query a database rather than querying in the natie language of the database (here we will use JavaScript to interact with our database instead of SQL). Since Objection is still really new, I will be walking through all of my code step by step.</p><h3>The Learning Process</h3><p>For this project, I relied pretty much exclusively on the documentation. The Knex documentation was great, and there were <a href="https://github.com/Vincit/objection.js/tree/master/examples/express-es6">examples</a> on the Objection GitHub that were very helpful as well. Since I make so many Express apps, given that I teach Express pretty extensively to my students, I felt pretty comfortable continuing with the project after skimming these resources.</p><h3>The Final Project</h3><p>I’ve been having trouble coming up with app ideas for this blog! So, I built an app idea app! The models were relatively simple: ideas and comments, but they still demonstrate one of the biggest use cases for Objection: relations between data. The ideas will be the &quot;parents&quot; with &quot;child&quot; comments attached to them. Essentially, users will be able to comment on various app ideas.</p><h4>Knex Initialization</h4><p>First, I initialized Knex, which will facilitate our database connection using pg, our migrations, and our seeds. After setting up my typical Express API boilerplate in my <a href="https://github.com/aspittel/app-ideas/blob/master/index.js">index file</a> and installing the requirements in my <a href="https://github.com/aspittel/app-ideas/blob/master/package.json">package.json</a>, I ran knex init in the root of my project. This created a knexfile.js that contains a boilerplate with example connections to databases. I decided to remove the production, development, and staging options in favor of just specifying a database connection string in my .env file. The knexfile ended up looking like:</p><pre>require(&#39;dotenv&#39;).config()</pre><pre>const pg = require(&#39;pg&#39;)<br>pg.defaults.ssl = true</pre><pre>module.exports = {<br>  client: &#39;pg&#39;,<br>  connection: process.env.DATABASE_URL<br>}</pre><p>The ssl configuration is only necessary if you are using a database on Heroku or another provider that requires an SSL connection. dotenv allows us to retrieve environmental variables from a .env file! That variable is a standard PostgreSQL connection string:</p><pre>DATABASE_URL=postgres://username:password@host:port/db_name</pre><p>I created the database on my computer using psql, I created the production database using a <a href="https://elements.heroku.com/addons/heroku-postgresql">Heroku add-on</a>.</p><h4>Migrations</h4><p>Migrations are changes to a database’s schema specified within your ORM, so we will be defining the tables and columns of our database straight in JavaScript rather than using SQL.</p><p>From there, I generated my migrations:</p><pre>$ knex migrate:make create_ideas<br>$ knex migrate:make create_comments</pre><p>Each migrate command created its own separate file in the migrationsfolder. Knex also puts a timestamp on each so that the migration name is unique and is run in order, for example: migrations/20180218215453_create_ideas.js. I created two separate migrations to keep things organized, and because I created the comments after the ideas. These could be combined, though.</p><p>The migration is generated with:</p><pre>exports.up = function (knex, Promise) {<br>}</pre><pre>exports.down = function (knex, Promise) {<br>}</pre><p>The migration itself goes within the body of the exports.up function and then whatever the opposite of that migration does goes within exports.down. The exports.down allows us to undo migrations that we no longer want. For the create_ideas migration, I added the following:</p><pre>exports.up = function (knex, Promise) {<br>  return Promise.all([<br>    knex.schema.createTable(&#39;ideas&#39;, table =&gt; {<br>      table.increments(&#39;id&#39;).primary()<br>      table.string(&#39;idea&#39;)<br>      table.string(&#39;creator&#39;)<br>    })<br>  ])<br>}</pre><pre>exports.down = function (knex, Promise) {<br>  return Promise.all([<br>    knex.schema.dropTable(&#39;ideas&#39;)<br>  ])<br>}</pre><p>Knex migration functions should “always return a promise” according to its documentation. We can use Promise.all() in order to return an array of promises to resolve. Even though each function only has one action in this case, I could have added more actions separated by ,&#39;s. The exports.upcontains the table creation logic for the ideas table, including a primary key that is auto-incremented table.increments(&#39;id&#39;).primary(). It also has two other string columns called idea and creator. To undo the migration, we would drop the ideas table, as specified in the exports.down function.</p><p>The second migration to create the comments file is similar:</p><pre>exports.up = function (knex, Promise) {<br>  return Promise.all([<br>    knex.schema.createTable(&#39;comments&#39;, table =&gt; {<br>      table.increments(&#39;id&#39;).primary()<br>      table.string(&#39;comment&#39;)<br>      table.string(&#39;creator&#39;)<br>      table.integer(&#39;ideas_id&#39;).references(&#39;ideas.id&#39;)<br>    })<br>  ])<br>}</pre><pre>exports.down = function (knex, Promise) {<br>  return Promise.all([<br>    knex.schema.dropTable(&#39;comments&#39;)<br>  ])<br>}</pre><p>This migration looks very similar to the ideas one, the only difference is the foreign key: table.integer(&#39;ideas_id&#39;).references(&#39;ideas.id&#39;). There are many ways to do this specified in the documentation; however, the Objection documentation does it this way so I did as well. Knex enforced the column name ideas_id rather than idea_id which was unsemantic. I am sure there is a way around that naming mandate; however, I didn&#39;t put much effort into looking it up!</p><p>Finally, I ran the migrations using the command:</p><pre>$ knex migrate:latest</pre><p>Even though the command implies it runs only the latest migration, it instead runs all migrations that haven’t been run yet.</p><h4>Database Seeding</h4><p>Knex also has some built-in functionality to help us seed, or add initial test data, to our database.</p><pre>$ knex seed:make ideas</pre><p>The above command created a seeds directory with an ideas.js file within it. That file also had the following code in it:</p><pre>exports.seed = function (knex, Promise) {<br>}</pre><p>I added the following:</p><pre>exports.seed = function (knex, Promise) {<br>  return knex(&#39;ideas&#39;).del().then(() =&gt; {<br>    return knex(&#39;ideas&#39;).insert([<br>        {creator: &#39;Ali&#39;, idea: &#39;A To Do List app!&#39;},<br>        {creator: &#39;Ali&#39;, idea: &#39;A Blog!&#39;},<br>        {creator: &#39;Ali&#39;, idea: &#39;A calculator&#39;}<br>    ])<br>  })<br>}</pre><p>This cleared the ideas table, so there wasn&#39;t any data in the table, and then it inserted three records into the database. It used the JSON keys and values to create those rows. I only seeded the ideas table, but you could definitely seed the comments table as well!</p><p>I then ran the following command to update the database:</p><pre>$ knex seed:run</pre><h4>Models</h4><p>Up until this point, we have been using Knex to interact with our database. Now, we are going to create some models using Objection in order to deal with the relationships between our database tables and to make our querying more explicit! I created a models folder with a schema.js file within it. You could structure this pretty much anyway -- one good way would be to have each model in a different file. I kept everything together, though, for demonstration&#39;s sake!</p><p>First, let’s take care of some administrative things at the top:</p><pre>const Knex = require(&#39;knex&#39;)<br>const connection = require(&#39;../knexfile&#39;)<br>const { Model } = require(&#39;objection&#39;)</pre><pre>const knexConnection = Knex(connection)</pre><pre>Model.knex(knexConnection)</pre><p>These lines of code connect us to the database using our knexfile from earlier. We are also attaching Objection to our database connection.</p><p>Now, let’s create our model for our Comment data. The models will allow us to interact cleanly with the data we are retrieving from our database.</p><pre>class Comment extends Model {<br>  static get tableName () {<br>    return &#39;comments&#39;<br>  }</pre><pre>  static get relationMappings () {<br>    return {<br>      idea: {<br>        relation: Model.BelongsToOneRelation,<br>        modelClass: Idea,<br>        join: {<br>          from: &#39;comments.ideas_id&#39;,<br>          to: &#39;ideas.id&#39;<br>        }<br>      }<br>    }<br>  }<br>}</pre><p>Let’s break this down. The static getter method tableName returns the name comments: the name of the database table we want our Comment class to model! We also have a second static getter method that defines the Commentmodel&#39;s relationships to other models. In this case, the key of the outside object idea is how we will refer to the parent class. The relation key within the child object has the value Model.BelongsToOneRelation which says that each comment is going to have one parent idea. The modelClasssays that the idea is coming from the Idea model and then the joinspecifies the database table and column names to perform a SQL join on, in this case, the ideas_id column in the comments table to the id column in the ideas table. <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/static">static</a> and <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get">get</a> were added in ES6!</p><p>The Idea class looks almost identical, though the relationships are inverted!</p><pre>class Idea extends Model {<br>  static get tableName () {<br>    return &#39;ideas&#39;<br>  }</pre><pre>  static get relationMappings () {<br>    return {<br>      comments: {<br>        relation: Model.HasManyRelation,<br>        modelClass: Comment,<br>        join: {<br>          from: &#39;ideas.id&#39;,<br>          to: &#39;comments.ideas_id&#39;<br>        }<br>      }<br>    }<br>  }<br>}</pre><pre>module.exports = { Idea, Comment }</pre><p>In this case, our relationship is Model.HasManyRelation since one idea can have multiple comments! I also exported the models so they could be used within our other files.</p><h4>Querying</h4><p>The final file I worked with was controllers/ideas.js. I usually separate all my &quot;controller&quot; functions -- the routing functions that decide what each route renders -- into a file or files if there are lots of them! This week, I built an API that I will build a front-end for in the future.</p><p>First, some imports:</p><pre>const express = require(&#39;express&#39;)</pre><pre>const { Idea, Comment } = require(&#39;../models/schema&#39;)</pre><pre>const router = express.Router()</pre><p>Let’s walk through the first method, a get request that returns all of the ideas:</p><pre>router.get(&#39;/&#39;, async (req, res) =&gt; {<br>  const ideas = await Idea.query()<br>  res.json(ideas)<br>})</pre><p>In the above example, we are making the arrow function callback that handles the request and response asynchronous using async, then we can &quot;pause&quot; the body of the function until the promise from our Idea.query()resolves. That query will return a JavaScript object with all of the items in our ideas table using our res.json(ideas) method. If we navigate to localhost:3000/ideas locally or https://application-ideas.herokuapp.com/ideas in production we see:</p><pre>[<br>    {<br>        &quot;id&quot;: 1,<br>        &quot;idea&quot;: &quot;A To Do List app!&quot;,<br>        &quot;creator&quot;: &quot;Ali&quot;<br>    },<br>    {<br>        &quot;id&quot;: 2,<br>        &quot;idea&quot;: &quot;A Blog!&quot;,<br>        &quot;creator&quot;: &quot;Ali&quot;<br>    },<br>    {<br>        &quot;id&quot;: 3,<br>        &quot;idea&quot;: &quot;A calculator&quot;,<br>        &quot;creator&quot;: &quot;Ali&quot;<br>    }<br>]</pre><p>Note: The Objection documentation uses <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function">async and await</a> to handle <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise">promises</a> in JavaScript; however, we could rewrite the above function to look like the following and that would work equally as well!</p><pre>router.get(&#39;/&#39;, (req, res) =&gt; {<br>  Idea.query().then(ideas =&gt; {<br>    res.json(ideas)<br>  })<br>})</pre><p>Instead of going through the other routes in paragraph form, I am going to put the annotated code below:</p><pre>router.get(&#39;/:id&#39;, async (req, res) =&gt; {<br>  // gets one idea, found by id.<br>  //Also fetches the related comments using the .eager method<br>  const idea = await Idea.query().findById(req.params.id).eager(&#39;comments&#39;)<br>  res.json(idea)<br>})</pre><pre>router.post(&#39;/&#39;, async (req, res) =&gt; {<br>  // creates a new idea from the request body<br>  // only allows the idea and creator fields for safety<br>  const newIdea = req.body</pre><pre>  const idea = await Idea.query()<br>                         .allowInsert(&#39;[idea, creator]&#39;)<br>                         .insert(newIdea)</pre><pre>  res.send(idea)<br>})</pre><pre>router.post(&#39;/:id/comments&#39;, async (req, res) =&gt; {<br>  // creates a new comment that is a child of an idea, again sanitizes fields.<br>  const idea = await Idea.query().findById(req.params.id)</pre><pre>  await idea.$relatedQuery(&#39;comments&#39;)<br>            .allowInsert(&#39;[comment, creator]&#39;)<br>            .insert(req.body)</pre><pre>  res.send(idea)<br>})</pre><pre>router.delete(&#39;/:id&#39;, async (req, res) =&gt; {<br>  // deletes an idea<br>  await Idea.query().deleteById(req.params.id)</pre><pre>  res.redirect(&#39;/ideas&#39;)<br>})</pre><pre>router.delete(&#39;/:id/comments/:commentId&#39;, async (req, res) =&gt; {<br>  // deletes a comment<br>  await Comment.query().deleteById(req.params.commentId)</pre><pre>  res.redirect(`/ideas/${req.params.id}`)<br>})</pre><pre>module.exports = router</pre><p>There’s a bunch more you can do with Objection, like <a href="http://vincit.github.io/objection.js/#raw-queries">raw queries</a>, interaction with <a href="http://vincit.github.io/objection.js/#json-queries">JSON fields</a>, and <a href="http://vincit.github.io/objection.js/#validation">validations</a>.</p><h3>Next Steps</h3><p>I had a really fun time working with Objection and Knex! It is honestly very similar to working with Mongoose and MongoDB from a configuration standpoint, but it makes hierarchical and related data so much easier to work with! I would definitely keep using these libraries in the future with Express apps! Definitely a must-try if you use Node frequently!</p><p><a href="https://github.com/aspittel/app-ideas">Full Code</a><br><a href="https://application-ideas.herokuapp.com/ideas">Deployed App</a><br><a href="http://vincit.github.io/objection.js">Objection Documentation</a><br><a href="http://knexjs.org/">Knex Documentation</a></p><p><em>If you liked this article, please </em><a href="https://tinyletter.com/ali_writes_code"><em>subscribe</em></a><em> to my weekly newsletter where you’ll receive my favorite links from the week and my latest articles.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6c21e2703ac6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/hackernoon/objection-knex-painless-postgresql-in-your-node-app-6c21e2703ac6">Objection + Knex = Painless PostgreSQL in your Node App</a> was originally published in <a href="https://medium.com/hackernoon">HackerNoon.com</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building Web Components with Vanilla JavaScript]]></title>
            <link>https://medium.com/@ali07cat07/building-web-components-with-vanilla-javascript-8cb09a1c6a12?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/8cb09a1c6a12</guid>
            <category><![CDATA[tutorial]]></category>
            <category><![CDATA[learning-to-code]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-components]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Sun, 11 Feb 2018 17:55:26 GMT</pubDate>
            <atom:updated>2018-02-11T17:55:26.775Z</atom:updated>
            <content:encoded><![CDATA[<p>Back in 2015, I was in the midst of learning my first front-end framework — AngularJS. The way I thought of it was that I was building my own HTML tags with custom features. Of course, that wasn’t what was really happening, but it helped lower the learning curve.</p><p>Now, you can actually build your own HTML tags using web components! They are still an experimental feature — they work in Chrome and Opera, can be enabled in FireFox, but they are still unimplemented in Safari and Edge. Once they fully roll out, they will be an even more awesome tool for building reusable components in purely vanilla JavaScript — no library or framework needed!</p><h3>Learning Process</h3><p>I had a lot of difficulty finding articles and examples on web components written in Vanilla JS. There are a bunch of examples and articles on Polymer, which is a framework for writing web components that includes polyfills for browsers that don’t support web components yet. The framework sounds awesome, and I may try working with it in the future, but I wanted to use just vanilla JavaScript for this particular project.</p><p>I ended up mostly using the <a href="https://developer.mozilla.org/en-US/docs/Web/Web_Components/Using_shadow_DOM">MDN</a> documentation on the Shadow DOM in order to build my project. I also looked through CodePen and the WebComponents site, though I didn’t find too much on either that was similar to what I wanted to build.</p><p>I also really liked <a href="https://dev.to/thatjoemoore/bringing-order-to-web-design-chaos--3fhb">Joseph Moore’s article on web components which came out while I was working on this project</a>! It covered some of the benefits of using web components:they work with all frameworks and they are simple to implement and understand since they just use vanilla JavaScript.</p><h3>Final Project</h3><p>On a lot of my projects, I use a similar design scheme for both personal branding and to make it so that I don’t have to come up with a new design! In particular, I use a heading where each letter is a different color and has a falling animation on it. My personal site <a href="https://www.alispit.tel/">alispit.tel</a> is a pretty good example of this! I also have that text on my resume, conference slides, and I have plans to use it for other sites in the near future as well! The catch with it is that CSS doesn’t allow you to target individual characters — other than the first one. Therefore, each letter has to be wrapped in a span. This can get pretty painful to write, so I decided this was the perfect place to use a webcomponent!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/880/0*rmBMIMNTnwuKEs5I.png" /></figure><p>Since I had difficulty finding articles on people writing web components, I’m going to go pretty in depth with the code here.</p><p>First, the HTML code to get the web component to render looks like this:</p><pre>&lt;rainbow-text text=&quot;hello world&quot; font-size=&quot;100&quot;&gt;&lt;/rainbow-text&gt;</pre><p>The web component is called rainbow-text and it has two attributes: the text, which will be what the component renders, and the font size. You can also use slots and templates to insert content; however, in my use case, they would have added additional overhead. I wanted to input text and then output a series of HTML elements with the text separated by a character, so the easiest way was to pass in the text via an attribute -- especially with the Shadow DOM.</p><p>So, what is the Shadow DOM? It actually isn’t new and it isn’t specific to web components. The shadow DOM introduces a subtree of DOM elements with its own scope. It also allows us to hide child elements. For example, a video element actually is a collection of HTML elements; however, when we create one and inspect it, we only see the video tag! The coolest part of the shadow DOM, for me, was that the styling was scoped! If I add a style on my document that, for example, modifies all divs, that style won&#39;t affect any element inside the shadow DOM. Inversely, styles inside the shadow DOM won&#39;t affect elements on the outer document&#39;s DOM. This is one of my favorite features of Vue, so I was super excited that I could implement something similar without a framework!</p><p>Let’s now move on to JavaScript code which implements the custom element. First, you write a JavaScript class that extends the built-in HTMLElement class. I used an ES6 class, but you could also use the older OOP syntax for JavaScript if you wanted. I really enjoy using ES6 classes, especially since I am so used to them from React! The syntax felt familiar and simple.</p><p>The first thing that I did was write the connectedCallback lifecycle method. This is called automatically when the element is rendered -- similar to componentDidMount in React. You could also use a constructor similar to any other ES6 class; however, I didn&#39;t really have a need for one since I wasn&#39;t setting any default values or anything.</p><p>Inside the connectedCallback, I first instantiated the shadow DOM for the element by calling this.createShadowRoot(). Now, the rainbow-textelement is the root of its own shadow DOM, so it&#39;s child elements will be hidden and have their own scope for styling and external JavaScript mutations. Then, I set attributes within the class from the HTML attributes being passed in. Within the class, you can think of this referring to the rainbow-text element. Instead of running document.querySelector(&#39;rainbow-text&#39;).getAttribute(&#39;text&#39;), you can just run this.getAttribute(&#39;text&#39;) to get the text attribute from the element.</p><pre>class RainbowText extends HTMLElement {<br>  connectedCallback () {<br>    this.createShadowRoot()<br>    this.text = this.getAttribute(&#39;text&#39;)<br>    this.size = this.getAttribute(&#39;font-size&#39;)<br>    this.render()<br>  }</pre><p>render is a method that I wrote, that is called in the connectedCallback. You can also use the disconnectedCallback and the attributeChangedCallback lifecycle methods if they would be helpful in your code! I just separated it out in order to adhere to Sandi Metz&#39;s rules which I adhere to pretty religiously! The one thing in this method that is different from normal vanilla DOM manipulation is that I append the elements that I create to the shadowRoot instead of the document or to the element directly! This just attaches the element to the shadow DOM instead of the root DOM of the document.</p><pre>render () {<br>    const div = document.createElement(&#39;div&#39;)<br>    div.classList.add(&#39;header&#39;)<br>    this.shadowRoot.appendChild(div)<br>    this.addSpans(div)<br>    this.addStyle()<br>  }</pre><p>I then added the individual spans for each letter to the DOM, this is essentially identical to vanilla JavaScript code:</p><pre>addSpanEventListeners (span) {<br>    span.addEventListener(&#39;mouseover&#39;, () =&gt; { span.classList.add(&#39;hovered&#39;) })<br>    span.addEventListener(&#39;animationend&#39;, () =&gt; { span.classList.remove(&#39;hovered&#39;) })<br>  }</pre><pre>  createSpan (letter) {<br>    const span = document.createElement(&#39;span&#39;)<br>    span.classList.add(&#39;letter&#39;)<br>    span.innerHTML = letter<br>    this.addSpanEventListeners(span)<br>    return span<br>  }</pre><pre>  addSpans (div) {<br>    [...this.text].forEach(letter =&gt; {<br>      let span = this.createSpan(letter)<br>      div.appendChild(span)<br>    })<br>  }</pre><p>Finally, I added the styling to the shadow DOM:</p><pre>addStyle () {<br>    const styleTag = document.createElement(&#39;style&#39;)<br>    styleTag.textContent = getStyle(this.size)<br>    this.shadowRoot.appendChild(styleTag)<br>  }</pre><p>This method adds a style tag to the shadow DOM to modify the elements within it. I used a function to plug in the font-size of the header to a template literal that contained all of the CSS.</p><p>After writing the component, I had to register my new element:</p><pre>try {<br>  customElements.define(&#39;rainbow-text&#39;, RainbowText)<br>} catch (err) {<br>  const h3 = document.createElement(&#39;h3&#39;)<br>  h3.innerHTML = &quot;This site uses webcomponents which don&#39;t work in all browsers! Try this site in a browser that supports them!&quot;<br>  document.body.appendChild(h3)<br>}</pre><p>I also added a warning for users on non-webcomponent friendly browsers!</p><p>Here’s how the element ended up showing up in the console:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/0*kOc2outVdoqnylKl.png" /></figure><h3>Next Steps</h3><p>I enjoyed working with web components! The idea of being able to create reusable components without a framework is awesome. The one I built will be really helpful for me since I use the multi-colored name so often. I will just include the script in other documents. I won&#39;t convert my personal site to using the component, though, since I want that to be supported across browsers. There also isn&#39;t a clear system for state or data management, which makes sense given the goal for web components; however, it does make other frontend frameworks still necessary. I think I will keep using frontend frameworks for these reasons; however, once they are fully supported, they will be awesome to use!</p><p><a href="https://github.com/aspittel/rainbow-word-webcomponent/blob/master/script.js">Full Code</a><br><a href="https://www.alispit.tel/">Example Use</a> — (doesn’t use webcomponents)</p><p><strong>Part of my </strong><a href="https://medium.com/on-learning-new-things/learning-new-things-f4db7f16724"><strong>On Learning New Things</strong></a><strong> Series</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8cb09a1c6a12" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing with Sketch]]></title>
            <link>https://medium.com/@ali07cat07/designing-with-sketch-a8f423a27fe9?source=rss-10780f3e5ed5------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8f423a27fe9</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[web-design]]></category>
            <category><![CDATA[learn-to-code]]></category>
            <category><![CDATA[sketch]]></category>
            <dc:creator><![CDATA[Ali Spittel]]></dc:creator>
            <pubDate>Sun, 04 Feb 2018 19:14:12 GMT</pubDate>
            <atom:updated>2018-02-04T19:14:12.621Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve gotten asked a couple times when showing people <a href="https://www.alispit.tel/">my portfolio site</a> what my design process is. Up until this week, I would (truthfully) say I didn’t have one. I would just code and then tweak my site until it looked the way I wanted it to. This week, I decided that I should at least <strong>try</strong> to use a design software when I prototype sites instead of just winging it. A lot of designers I know use <a href="https://www.sketchapp.com/">Sketch</a>, so I decided that was the way to go!</p><p>I hadn’t used any design software before, other than Inkscape for SVG editing, but the interface was very intuitive. I didn’t have many issues getting started. I did play through a few of the <a href="https://www.leveluptutorials.com/tutorials/sketch-app-tutorials/series-introduction">YouTube Sketch tutorials by LevelUpTutorials</a> on 2x speed to familiarize myself with the UI, but other than that it was mostly trial and error.</p><p>Full disclaimer, I actually wrote a resume in Sketch earlier this week, but I feel weird using that as my “final project”. Instead, I built three prototype websites for what my blog could look like if I made a website for it!</p><h3>The Final Project</h3><p>The first step I took was to create an artboard using the insert button on the top left. I used the desktop option so that I would have a standard webpage to work with. You can create artboards of various sizes and shapes in order to fit your needs! I used a standard paper-sized one for my resume! I also set the backgrounds to white so that when I download the artboards the background downloads as well.</p><p>Next, I added shapes and text to the board. On the right-hand side, you can edit features of them — like font, color, and opacity. I love this because you can align things down to the pixel! You can type in the pixels directly if needed rather than having to drag the item until it is in the perfect location. One helpful hint here for dragging, though, if you want the items to snap into location in a smaller unit, zoom in! It makes dragging a lot easier!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/216/0*AAL4OuGQoAoP4uX5.png" /></figure><p>You can also group items so that you can edit them together. For example, I would put all header items into a group so that if I wanted to move the whole header I could do so.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*oJpOD82T9oGPVaz5.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/165/0*oZqI-eB3dW1E6F29.png" /></figure><p>In order to get the fonts that I normally use in my code, I installed them onto my computer using the Font Book that comes pre-installed on Mac’s. I just clicked the download button on Google Fonts, then downloaded them. I didn’t end up using icons for this project, but if I did I would have used <a href="https://thenounproject.com/">these icons</a> as images in my designs. I also used <a href="https://hipsum.co/?paras=5&amp;type=hipster-centric&amp;start-with-lorem=1">Hipster Ipsum</a> for my article bodies!</p><p>Now let’s get on to the prototypes!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*el7InX-45YuDBH36.png" /></figure><p>My design style is relatively minimalist with some bold detailing. The first design has a bold header with graphic gold hexagons on it. It uses mostly Montserrat font mixed with some Playfair for headings. I also made a sidebar that repeated the hexagonal detailing. I really like the graphic details, and I think the final look is simple but still visually interesting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*tnyorIorQiB7rcUu.png" /></figure><p>For the next one, I wanted to challenge myself to add images from my projects. This is somewhat difficult since the posts have different color-schemes and have differently sized details. I decided to add in longer images that would usually be of the header of the site. The images turned out to be a little bit stretched out, but that could be easily improved in production! I also added some “millenial pink” polka-dot details to make the site more interesting! I think in the long run, the images would be difficult and impractical, but I do like the way this design looks as well!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/0*NWlE8uFB9QhqA_pd.png" /></figure><p>The third, and probably my favorite, design is based on my <a href="https://www.alispit.tel/">personal site</a>. I have a similar header with multi-colored text. This was kind of a pain to build in Sketch because I had to create a textbox for each letter. It’s also annoying to do in CSS, though, so that definitely isn’t Sketch specific! I also added different shapes to the sidebar to mimic the shape background I have on my site! My resume also follows the same theme, so I thought it would be kind of cool to have all of my main landing points cohesive! I really like the bright colors combined with minimalism elsewhere.</p><h3>Next Steps</h3><p>I really liked using Sketch to prototype! I think it was fun to be able to design so quickly, and it made the aesthetic more cohesive. I think I will keep using it moving forward, and I will be interested to see how it helps me write my frontend code!</p><p><a href="https://github.com/aspittel/designs/blob/master/sites.pdf">Full PDFs</a></p><p><strong>Part of my </strong><a href="https://medium.com/on-learning-new-things/learning-new-things-f4db7f16724"><strong>On Learning New Things</strong></a><strong> Series</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8f423a27fe9" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>