<?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 Kevin Mora Gamboa on Medium]]></title>
        <description><![CDATA[Stories by Kevin Mora Gamboa on Medium]]></description>
        <link>https://medium.com/@kevkevdev?source=rss-723ad347795f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*mhBX4QVp3OAhsPUbzikLsA.jpeg</url>
            <title>Stories by Kevin Mora Gamboa on Medium</title>
            <link>https://medium.com/@kevkevdev?source=rss-723ad347795f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 00:28:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@kevkevdev/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[Launch a basic ad campaign with Facebook Marketing API]]></title>
            <link>https://medium.com/leafgrowio-engineering/launch-a-basic-ad-campaign-with-facebook-marketing-api-c4cbeb0650d5?source=rss-723ad347795f------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4cbeb0650d5</guid>
            <category><![CDATA[open-graph]]></category>
            <category><![CDATA[facebook-api]]></category>
            <category><![CDATA[facebook-ad-campaigns]]></category>
            <category><![CDATA[facebook-marketing]]></category>
            <category><![CDATA[advertising]]></category>
            <dc:creator><![CDATA[Kevin Mora Gamboa]]></dc:creator>
            <pubDate>Fri, 19 Jul 2019 16:10:13 GMT</pubDate>
            <atom:updated>2019-07-19T16:10:13.277Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*7HFxq7MZA7K4gEZ2" /><figcaption>Photo by <a href="https://unsplash.com/@jeremydownes?utm_source=medium&amp;utm_medium=referral">Jeremy Downes</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Today we are going to work alongside one of the most successful social networks and use their <a href="https://developers.facebook.com/docs/marketing-apis/">marketing API </a>to create an ad campaign and grow our business or a friend’s business.</p><p>The goal here is to learn about Facebook’s marketing API so you can build something useful with it. To achieve our goal we are going to use a bloody useful Facebook tool: <a href="https://developers.facebook.com/tools/explorer/">Graph API Explorer</a>. This tool is like a playground where you can play around and make calls to the Facebook APIs. It is pretty helpful when you need to figure out how to get or post some information from/to Facebook.</p><p>To use the graph API explorer you need to register yourself as a Facebook developer (<a href="https://developers.facebook.com/docs/apps#register">click here to learn more</a>) and then create an app on Facebook (<a href="https://developers.facebook.com/?advanced_app_create=true">check here</a>). Also, to be able to successfully create an active ad campaign, you need an active ad account (<a href="https://www.facebook.com/ads/manager/">check here</a>). Because of time, we are not going through this but following Facebook’s steps makes it pretty easy.</p><h3>Campaigns</h3><p>The campaign is the highest level after the ad account; the first level of four that we are going to see on this document and it contains the ad sets. You can have one or more ad sets within a campaign. The campaign is where you add the advertising objective and will optimize the results for the objective you want, for example: let’s say you want to increase your page audience, you will, therefore, select Page Likes as the objective so the people who will see your ad is people that may like your content and will click the ‘like’ button on your page.</p><p>There are many types of campaign objectives you can select, but let’s go through the 8 main campaign types we promote through <a href="https://app.leafgrow.io/">Leaf Grow</a>:</p><ul><li><strong>Conversions:</strong></li></ul><p>Gets people to take valuable actions on your website, app or in Messenger, such as adding payment info or making a purchase. Use the Facebook pixel or app events to track and measure conversions. For example: if you have a Facebook pixel event code already installed on your website, like the <strong>Purchase</strong> event code in the view that you show when the checkout and payment process has been completed, you can target the people who recently bought an item and show them related items.</p><ul><li><strong>Link Clicks:</strong></li></ul><p>Sends more people to a destination on or off Facebook such as a website, app or Messenger conversation.</p><ul><li><strong>Video Views:</strong></li></ul><p>Promotes videos of your products, customer stories to raise awareness about your brand.</p><ul><li><strong>Post Engagement:</strong></li></ul><p>Gets more people to see and engage with your post or Page. Engagement can include comments, shares, likes, event responses and offer claims.</p><ul><li><strong>Page Likes:</strong></li></ul><p>Gets more people to like your Facebook Page.</p><ul><li><strong>App Installs:</strong></li></ul><p>Sends people to the app store where they can download your app.</p><ul><li><strong>Reach:</strong></li></ul><p>This objective shows your ad to the maximum number of people.</p><ul><li><strong>Brand Awareness:</strong></li></ul><p>Reaches people more likely to pay attention to your ads and increase awareness for your brand.</p><p>Now, let’s go back to the graph explorer — it is composed of nodes, edges, and fields.</p><p>Nodes are individual objects, for example, a Campaign or a Page.</p><p>Edges are collections of objects that are connected to a single object, for example, ad sets on a campaign or photos on a page.</p><p>And the fields are data about an object, for example, the campaign’s name, campaign’s effective status.</p><p>In order to create a campaign, we need to fill up some fields such as name, status, objective, buying type, bid strategy, and the budget. You can learn more about every campaign’s field on the <a href="https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group/#Creating">official Facebook documentation</a>. But basically:</p><ol><li><strong>Campaign’s name</strong> is: how we want to identify our campaign, I recommend you to specify what the campaign is about so you have a better idea of what the campaign objective is and it will be easier to identify it.</li><li><strong>Campaign’s status</strong>: During campaign creation only <em>ACTIVE</em> or <em>PAUSED</em> are valid. When <em>ACTIVE,</em> your campaign will run and start delivering ads. When <em>PAUSED,</em> the campaign will stop delivering your ads and will not spend your budget.</li><li><strong>Buying type</strong>: This is the method by which you pay for and target ads in your campaigns; this one is a little bit more complicated. I recommend you read <a href="https://www.facebook.com/business/help/654484604719506">this article</a>. For our test purpose, we are going to use <em>AUCTION</em>.</li><li><strong>Bid strategy</strong>: This is the cost that you will pay to show your ad to a user, the way Facebook decides to show your ad or not is by a bid, so the one who pays the most is the one who wins the opportunity to reach that user. To learn more read <a href="https://www.facebook.com/business/m/one-sheeters/facebook-bid-strategy-guide">this article</a>. I recommend you to use <em>LOWEST_COST_WITHOUT_CAP</em> but of course, it depends on your objective and strategy.</li><li><strong>Budget</strong>: The budget is basically how much you want to invest in your campaign. We can set a lifetime budget or a daily budget, for both GBP and USD currencies we should handle the amount in cents, for example, if we want to invest £50 we should multiply 50 by 100 = 5000. The list of the currencies supported on Facebook is <a href="https://developers.facebook.com/docs/marketing-api/currencies/">here</a>, I highly recommend you to read it.</li></ol><p>So, in order to create the campaign, we need to add the ad account ID on the graph explorer like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UnE2cRuNwiTpXxveGJrW0w.png" /></figure><p>If you don’t know your ad account ID, you can check it out on graph explorer, just while you are in <strong>me</strong> <strong>node</strong>, in the <em>search for a field</em> input, write down <em>adaccounts</em>, you can see how it will autocomplete what you write and also you can see that a list is coming up. This list shows all the fields we are able to request from the <strong>current node</strong>, in this case from the <strong>me node</strong>, this means we are requesting info from the user that is actually logged into the graph explorer.</p><p>Furthermore, you can see another <em>Search for a field </em>input is coming up related to the <strong>adaccounts</strong> field we just typed. In that input let’s write <strong>name</strong> so the data will be coming up with the specific ad account’s name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kS3LcdpIIIaqfun44AqzTw.png" /></figure><p>Now, we can just click on the ad account ID and it will be added to the URL as param and it will show basic data about the ad account automatically.</p><blockquote>Note: Our user access token has an expiry time, it will expire in one hour so if that happens you should reload the page. When the token expires, you will see this error:</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*gKterkFakza5BzHW3a4IZA.png" /></figure><p>To create the campaign we need to make a POST request to /act_{<em>ad_account_id</em>}/campaigns. For the purpose of this tutorial, we are going to create a Link Clicks campaign.</p><p>When we change the HTTP protocol from GET to POST, we can see an <em>add a field</em> option right below the POST protocol. We can click there to add the necessary fields we need to create the campaign. So we will have something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gzFWEHgEygy1Bm73JZ9Bxw.png" /></figure><p>Next step is to click on the <em>Submit</em> button and <em>‘Voila’;</em> we have created our first ad campaign successfully.</p><p>We know it was successful because we got an ID as a response, this ID is the campaign’s ID we just created. Copy this ID and paste it in a safe place so we can use it to create our ad sets later.</p><h3>Ad Sets</h3><p>An ad set is a group of ads; they have the logic behind to decide to which audience the ads will be shown. As you can imagine, there are many parameters to create an ad set as it is very complex and also it depends on our campaign strategy. For this case, we are going to create a very simple ad set for our link clicks campaign.</p><p>To create the ad set we need to make a POST request to /act_{<em>ad_account_id</em>}/<strong>adsets</strong>. As you can see it’s the same as when we create a campaign but instead of <strong>/campaigns</strong> we write down <strong>/adsets</strong>.</p><p>The fields we need to fill so we can create our ad set are the following:</p><p><strong>name:</strong> Basically the ad set name with a max length of 400 characters.</p><p><strong>billing_event:</strong> This is when we want to pay, for example, <em>APP_INSTALLS</em> pay when people install your app, <em>PAGE_LIKES</em> pay when people like your page, <em>IMPRESSIONS</em> pay when people see our ads, for our test purpose we are going to use this last one.</p><p><strong>optimization_goal:</strong> This one is like the campaign optimization, it is how our ad set will be optimized so we can achieve our campaign goal, for our test we are going to use <em>LINK_CLICKS</em>: optimize for people more likely to click in the link of the ad.</p><p><strong>promoted_object:</strong> it’s the object we are promoting across the ads.</p><p><strong>targeting:</strong> This is a structure when we can add the interests, the demographics where we want to show our ad, platforms placements, among others. To learn more <a href="https://developers.facebook.com/docs/marketing-api/buying-api/targeting">click here</a>.</p><p><strong>start_time:</strong> Basically when we want our campaign to start running</p><p><strong>end_time:</strong> Just like the start time but when we want our campaign to stop delivering ads.</p><p><strong>campaign_id:</strong> Finally the ID of the campaign we already created before and which we want to add our ad set to.</p><p><em>Note:</em> This is a pretty basic explanation about these fields if you want to learn more you can go to the official Facebook documentation <a href="https://developers.facebook.com/docs/marketing-api/reference/ad-campaign#Creating">right here</a>.</p><p>After we add all the necessary fields to create our ad set in the graph API explorer, you should have something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1IvgAHtQ7nW3LvoRDVfDYg.png" /></figure><p>Now, click again the <em>Submit</em> button and our ad set has been created! 🎉</p><p>Again, we know it was successful because we got an ID as a response, this ID is the ad set’s ID we just created. Copy this ID and paste it in a safe place so we can use it to create our ad in the next step.</p><h3>Ads</h3><p>The ads are what our target audience will see, the ads are associated with an ad set and these ads will be shown to the target audience we defined before on the ad set.</p><p>Before we can create a new ad, we need an existing ad creative. What is an ad creative? Basically, it is the structure of how our ad will look, in the ad creative is where we define what copy our ad will have, what image, also here is where we define the call to action, among others. To learn more, here is the official Facebook documentation (<a href="https://developers.facebook.com/docs/marketing-api/reference/ad-creative">click here</a>).</p><p>The fields we have in the ad creative are:</p><p><strong>name:</strong> The ad creative name, basically to identify it better in the creative library.</p><p><strong>object_story_spec:</strong> This as the name says, it’s an object where we add some attributes like the <em>page_id, instagram_actor_id</em> and the ad content using one of this link_data, photo_data, video_data, text_data or template_data.</p><p>For example, in <em>link_data</em> we add the copy for the ad, the image, the call to action and more. The <em>object_story_spec</em> is very complex, we have a lot of fields so we can create a lot of different kind of ads. <a href="https://developers.facebook.com/docs/marketing-api/reference/ad-creative-object-story-spec/">Click here</a> for more information.</p><p>To create the ad creative we need to make a POST request to /act_{<em>ad_account_id</em>}/<strong>adcreatives</strong>.</p><p>So, once we have completed our ad creative fields, your graph explorer will loke like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HnmiEO7soU9Dq6x0LFoKlA.png" /></figure><p>We click the <em>Submit</em> button and if the response is an ID, so we have created our ad creative successfully 🔥.</p><p>Now, the last but super important step, to create the ad.</p><p>Once we got the ad creative ID, we just need to add this ID in the <em>creative</em> field for the ad, set up the ad status and also we need to add the ad set ID in the <em>adset_id</em> field. All this will look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qGEY5-b0cbhQM2HDSZJL-w.png" /></figure><p>To create the ad we need to make a POST request to /act_{<em>ad_account_id</em>}/<strong>ads</strong>.</p><p>And we are done! We have launched an ad campaign on the Facebook platform successfully, and also we went through some super basic topics about campaigns, ad sets, ad creatives, and ads.</p><p>It is important to say that if you want a safer place to test the marketing API you can perform your testing in Sandbox mode, <a href="https://developers.facebook.com/ads/blog/post/2016/10/19/sandbox-ad-accounts/">click here</a> to learn more.</p><p>I really appreciate you reading until the end, I hope this helps you and it made for an insightful reading 🙂.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4cbeb0650d5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/leafgrowio-engineering/launch-a-basic-ad-campaign-with-facebook-marketing-api-c4cbeb0650d5">Launch a basic ad campaign with Facebook Marketing API</a> was originally published in <a href="https://medium.com/leafgrowio-engineering">Engineering @ Leaf</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deep Cloning Objects and Arrays in Javascript]]></title>
            <link>https://medium.com/leafgrowio-engineering/deep-cloning-objects-and-arrays-in-javascript-3e8936c3aefe?source=rss-723ad347795f------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e8936c3aefe</guid>
            <category><![CDATA[cloning]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Kevin Mora Gamboa]]></dc:creator>
            <pubDate>Fri, 24 May 2019 15:22:24 GMT</pubDate>
            <atom:updated>2019-05-24T16:26:48.343Z</atom:updated>
            <content:encoded><![CDATA[<h4>For when we need to create a real copy of a variable and not just a copy of its references</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_D2VlNi1GY-QOgTj" /><figcaption>Photo by <a href="https://unsplash.com/@jhaland?utm_source=medium&amp;utm_medium=referral">Jørgen Håland</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>There are times when we need to create a copy of the data inside a variable so that we can manipulate it without the risk of changing the original data referenced.</p><p>Now, more often than not, when you initiate the copy of a variable into another one, you expect that if you modify the new one, the original will keep the same value. In Javascript, this is easy if we are working with primitive values, but if we want to copy Arrays or Objects, reaching our goal becomes a little bit trickier.</p><p>In JavaScript, there are two ways to copy a variable value:</p><ul><li><strong>Shallow clone</strong></li><li><strong>Deep clone</strong></li></ul><p>Before we define what a Shallow Clone and Deep Clone are, I’m going to talk about copying primitive data types.</p><p>When we are working with primitive values, we don’t need to worry about shallow or deep cloning when copying variables, because when you create a copy of them, there will always be a brand new copy of its value on the receiver’s end.</p><p>Primitive data types are the building blocks of many programming languages and in JavaScript, they are defined by:</p><ul><li>Boolean</li><li>String</li><li>Number</li><li>Undefined</li><li>Null</li><li>Symbol (this one is new in ES6)</li></ul><p>Let’s see an example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d09e6341aad7a117c05401fc1e3dedbd/href">https://medium.com/media/d09e6341aad7a117c05401fc1e3dedbd/href</a></iframe><p>As you can see above, when we copy a primitive value and then we update the new variable, the original reference doesn’t get affected by the change.</p><p>So now that we have proven that primitive values don’t modify the original one, we need to define what is a Shallow or a Deep Clone when we try to copy an Object or an Array.</p><p><strong>What is Shallow Cloning?</strong></p><p>When we do a Shallow Clone, a new Array or Object is not created, instead a copy of the references is created i.e., only the memory addresses are copied. So if we were to make changes to the entries or members of the new copy, then effectively we will be making changes to the data referenced by the original one, as both variables will be pointing to the same memory space.</p><p><strong>What is Deep Cloning?</strong></p><p>A Deep Clone means actually creating a brand new Array or Object and iteratively copying over the values into new structures; this way, changes to it will <strong><em>never affect the original</em></strong> one and vice-versa.</p><p>Let’s take a look at how this works, say we have a simple array with Primitive Values inside, for example:</p><pre>const simpleArray = [1,2,3];</pre><p>If we copy this array to another variable and then we modify the new one, we can see that both arrays were affected.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ce10ba0f4834506f5df2813ec37536b5/href">https://medium.com/media/ce10ba0f4834506f5df2813ec37536b5/href</a></iframe><p>In the example above we made a Shallow Clone. This could be a problem sometimes if we expect the original variable will not be affected by changes into the new copy. It is very common to get a problem like this one and we can spend a lot of time debugging until we realize that we are actually doing a Shallow Clone.</p><p>Now, we can get the same error with an Object, for example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5d19f48bd3b588135afb04a05c1de1b0/href">https://medium.com/media/5d19f48bd3b588135afb04a05c1de1b0/href</a></iframe><p>It is important to say that when we copy Arrays and/or Objects, we are copying them by <em>reference</em> instead of by <em>value.</em></p><p>So, <em>how can I avoid this?</em> Well, it’s pretty easy! We can use the spread operator (ES5+).</p><p><strong>The Spread Operator on arrays works as</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b2e7d89f50d2b26e4207d76677f8d32/href">https://medium.com/media/5b2e7d89f50d2b26e4207d76677f8d32/href</a></iframe><p><strong>The Spread Operator on Objects work as</strong></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/b0429d94e9ac83c32bd48358ffcb651f/href">https://medium.com/media/b0429d94e9ac83c32bd48358ffcb651f/href</a></iframe><p>Also, for Object’s data we can use <strong>Object.assign</strong>, for example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/74fba54cc4a966c79dfd933b6834830f/href">https://medium.com/media/74fba54cc4a966c79dfd933b6834830f/href</a></iframe><p><strong>So, what about nested Objects and Arrays?</strong></p><p>The nested objects inside of that object or array will still be a reference/pointer to the original, so if we make a copy and then we update the new one, it will update the original as well. For example:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/64bfe588a6e3c6310815d1865f5e1c11/href">https://medium.com/media/64bfe588a6e3c6310815d1865f5e1c11/href</a></iframe><p>So, what can we do if we have nested Arrays and Objects?</p><p>We can use our secret weapon <strong>JSON.parse() </strong>and<strong> JSON.stringify()</strong>. First, we turn an object into a string and then we parse it to an object again, doing it this way ensures that we can create a complete new nested array and/or object.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d3c5666a7a20397b47b8faaf65ce0801/href">https://medium.com/media/d3c5666a7a20397b47b8faaf65ce0801/href</a></iframe><p>We just did our deep clone successfully 🎉.</p><p>I hope this helps you, saves you lots of hours of debugging and testing, and it made for an insightful reading 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e8936c3aefe" width="1" height="1" alt=""><hr><p><a href="https://medium.com/leafgrowio-engineering/deep-cloning-objects-and-arrays-in-javascript-3e8936c3aefe">Deep Cloning Objects and Arrays in Javascript</a> was originally published in <a href="https://medium.com/leafgrowio-engineering">Engineering @ Leaf</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why are coding standards important?]]></title>
            <link>https://medium.com/leafgrowio-engineering/why-is-coding-standards-important-319fce79d1a4?source=rss-723ad347795f------2</link>
            <guid isPermaLink="false">https://medium.com/p/319fce79d1a4</guid>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[standard-code]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[eslint]]></category>
            <dc:creator><![CDATA[Kevin Mora Gamboa]]></dc:creator>
            <pubDate>Thu, 14 Feb 2019 23:22:40 GMT</pubDate>
            <atom:updated>2019-02-15T20:31:47.182Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*an6CNppIDEFEYyuWer1oBQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/photos/zeW9BQbWmJs?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Thandy Yung</a> on <a href="https://unsplash.com/search/photos/lord-of-the-ring?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Learning to code is not just about writing cool apps, knowing about every new framework out there or drinking coffee — although I would not lie that a good coffee might give you superpowers ☕️.</p><p>Any developer who is not consistent with things as simple as the naming conventions or documenting and defining functions is buying themselves a big headache, especially if they are working as part of a team (i.e. anything &gt; 1). Imagine any dev team, each developer writing code with their own style; that would look like some Orcs trying to eat the last beefsteak in the Middle-earth.</p><p>When we write code, we need to make sure that any developer can understand it easily: tomorrow or in the distant future when you might not be around.</p><p>Thankfully, we have our secret weapon — the Coding Standards.</p><blockquote>When we write code we need to make sure that any developer can understand it easily.</blockquote><p>Coding standards are agreed-with guides of the best-practices that developers have decided to follow when writing code for a project — it says how we must write code so the project is coded in a consistent style and makes it easier for everybody in the team to understand, follow and maintain. Having these kinds of rules will not just help us to grow as a team, but also lead us to write a more stable and predictable app.</p><p>If you Google for coding standards you will find many of them, and each one varies by the programming language you are looking for and the paradigm the team behind it has decided to follow. You should decide on one that fits all of your team expectations or create one that fits them all. My advice is to schedule a meeting with your team and agree on the rules you will stick to and put them to work.</p><blockquote>Get together, and choose an approach that fits the best on your team’s expectation.</blockquote><p>In the Javascript world, where I come from, the <a href="https://github.com/airbnb/javascript"><em>Airbnb style guide</em></a> is one of the most famous code standards that dev teams around the world based their guidelines on, and it bloody well exceeds our expectations as a team here at <a href="https://www.leafgrow.io/"><em>Leaf Grow</em></a>.</p><p>We had a meeting where the whole tech team decided to take the Airbnb coding style as a base, but also, which set of rules we will not follow or which we would change to fit our own way — and although we selected the Airbnb style as a base, it doesn’t mean we cannot write our own styles too, at the end of the day what is important is that the source code that your team produces is clean, consistent and easy to maintain by existing developers and those that will follow you in the future.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*7OebEqHp_1bf-igPn7tsqw.jpeg" /><figcaption>ESLint — <a href="https://eslint.org/">https://eslint.org</a></figcaption></figure><p>To make sure our team is writing code based on the coding standard that we agreed to, <a href="https://github.com/eslint/eslint"><em>Eslint</em></a><em> </em>came to our rescue. This incredible tool identifies and reports when we write code that is not consistent with our team standards so the developer can make the necessary changes.</p><p>Eslint is pretty easy to configure, as you can add the Airbnb style guide as the default standard. You can also create your own rules and/or rewrite any Airbnb predetermined rule.</p><blockquote>In the end, the most important thing is that the source code is clean, consistent and easy to maintain.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*qxn8-DDqPDcn2xdEHrimPw.png" /><figcaption>Prettier — <a href="https://prettier.io/">https://prettier.io/</a></figcaption></figure><p>We also use <a href="https://github.com/prettier/prettier"><em>Prettier</em></a><em>; </em>this tool automatically formats our code so we don’t waste time on it. It does its job pretty fast — it is almost invisible if you have it running alongside your editor.</p><p>This library + its accompanying plugin can be set to format your code every time you save your changes.</p><p>Remember, the main point here is to understand why it is important to select a coding style standard and not to define which one style is better than the other.</p><p>In short, it can be said that the benefits of coding based on a code style standard are:</p><ul><li><em>Your code is easier to read.</em></li><li><em>Your code is easier to understand.</em></li><li><em>Your code is easier to maintain.</em></li></ul><p>So please, do your homework, find or define the standard which works best for you, for your business and your team.</p><p>It doesn’t really matter which one you decide, as long as you adhere to one. Your actual team members and the new ones that will follow will be forever grateful.</p><p>Pura Vida!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=319fce79d1a4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/leafgrowio-engineering/why-is-coding-standards-important-319fce79d1a4">Why are coding standards important?</a> was originally published in <a href="https://medium.com/leafgrowio-engineering">Engineering @ Leaf</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>