<?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 goncalvesjoao on Medium]]></title>
        <description><![CDATA[Stories by goncalvesjoao on Medium]]></description>
        <link>https://medium.com/@goncalvesjoao?source=rss-4e7293b1560a------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*zEaw1Ag2qcbOlbTH2KOfcQ.png</url>
            <title>Stories by goncalvesjoao on Medium</title>
            <link>https://medium.com/@goncalvesjoao?source=rss-4e7293b1560a------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 01:45:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@goncalvesjoao/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[CarrierWave: add/remove individual images using input file multiple]]></title>
            <link>https://medium.com/@goncalvesjoao/carrierwave-add-remove-individual-images-using-input-file-multiple-fb65f75de06a?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/fb65f75de06a</guid>
            <category><![CDATA[carrierwave]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Tue, 24 Mar 2020 22:16:11 GMT</pubDate>
            <atom:updated>2020-03-24T22:16:11.906Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/812/1*mjBd5h35vMA0d5wQWdh5aA.gif" /></figure><p>Following the CarrierWave tutorial on <a href="https://github.com/carrierwaveuploader/carrierwave/wiki/How-to%3A-Add%2C-remove-and-reorder-images-using-multiple-file-upload">How to: Add, remove and reorder images using multiple file upload</a> we get to keep our new images while the form is invalid but we still don’t get the ability to remove one file from the recently selected HTML input file ‘multiple’, like the <strong>gif</strong> above shows.</p><p>I wrote this article <a href="https://medium.com/@goncalvesjoao/break-input-file-into-individual-files-and-preview-them-29fdbab925b2?source=friends_link&amp;sk=f2c20efd0bf9ed66b64acdf087a7c45c">Break input file files into individual files and preview them</a> to allow this kind of individual file management from one single HTML input file element but we still need to ‘remember’ our new files in case the form is invalid.</p><p>So here is a combination of the two articles:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/66718939256ee231b4bce19955912be0/href">https://medium.com/media/66718939256ee231b4bce19955912be0/href</a></iframe><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fb65f75de06a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Break input file into individual files and preview them]]></title>
            <link>https://medium.com/@goncalvesjoao/break-input-file-into-individual-files-and-preview-them-29fdbab925b2?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/29fdbab925b2</guid>
            <category><![CDATA[input-file]]></category>
            <category><![CDATA[html5-development]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 20:33:12 GMT</pubDate>
            <atom:updated>2020-03-23T20:33:12.951Z</atom:updated>
            <content:encoded><![CDATA[<h3>Break input file files into individual files and preview them</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*UM3uU3pawt4FjFmWbthy2g.gif" /></figure><p>Say you want to make use of input file control ‘multiple’ but you also want to individually choose which files you want to remove and add new ones without loosing all of the previously selected ones.<br>And while we’re at it, would be nice to preview them too.</p><p>Trouble is: input.files is not an easy list to manipulate.</p><p>Here’s one way to do it:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2Fvazox0u5%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2Fvazox0u5%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/76e359a8dfd183703a54198c9f916803/href">https://medium.com/media/76e359a8dfd183703a54198c9f916803/href</a></iframe><p>Now, let’s go an extra step and preview the files:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2F13uynrbw%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2F13uynrbw%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/114a14e74a449766848d4b9722df97cc/href">https://medium.com/media/114a14e74a449766848d4b9722df97cc/href</a></iframe><p>Ok. Last detail. Validations and presenting its errors:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2F0t3j2gpz%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;display_name=jsFiddle&amp;url=https%3A%2F%2Fjsfiddle.net%2Fgoncalvesjoao%2F0t3j2gpz%2Fembedded%2Fjs%2Chtml%2Cresult%2Fdark%2F&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=jsfiddle" width="600" height="400" frameborder="0" scrolling="no"><a href="https://medium.com/media/7ad0a00dad6387a70c4cf697afd86eb6/href">https://medium.com/media/7ad0a00dad6387a70c4cf697afd86eb6/href</a></iframe><p>Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=29fdbab925b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to have a working ‘/health’ endpoint while Rails is 500ring]]></title>
            <link>https://medium.com/@goncalvesjoao/how-to-have-a-working-health-endpoint-while-rails-is-500ring-509efc1da42c?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/509efc1da42c</guid>
            <category><![CDATA[ruby-on-rails]]></category>
            <category><![CDATA[racks]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Fri, 17 May 2019 17:34:37 GMT</pubDate>
            <atom:updated>2019-05-20T09:50:14.470Z</atom:updated>
            <content:encoded><![CDATA[<p>So you wanted to help your DevOp friends and decided to created a sweet endpoint that returns the health status of your Rails App, like so:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*huizmcHxIEUXmY5_cw481Q.png" /></figure><p>But alas, your Rails App decides to throw a fit and returns 500 before that endpoint could return something.</p><p>How can you still make that endpoint behave correctly while Rails doesn’t?</p><p>How can you have an independent App from Rails but still have access to Rails objects?</p><p>Enter the Rack! (more info: <a href="https://thoughtbot.com/upcase/videos/rack">https://thoughtbot.com/upcase/videos/rack</a>)</p><p>So all we have to do is create a Rack App, map it to your path of choice (in this example <strong>/health</strong>) in the <strong>config.ru</strong> file, making sure that a request to that endpoint won’t even reach Rails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*PY5FdDWUEAeX0deuz4aRTw.png" /><figcaption>Add the highlighted lines to your <strong>config.ru</strong> file</figcaption></figure><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0eb68ac817250df59be905063e51aae/href">https://medium.com/media/c0eb68ac817250df59be905063e51aae/href</a></iframe><p>Naturally you can change this Rack App to your needs and add extra checks like, testing if you can connect to your API or other external connections you need to do inside Rails, like say, using a python module through PyCall or something.</p><p>The cool part about this is that although this <strong>Ruby Rack App</strong> is independent of Rails, because its being loaded in a <strong>config.ru</strong> that also loads your <strong>Rails App</strong> you have access to all your Rails objects 🤘</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=509efc1da42c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails, Devise, JWT and the forgotten Warden]]></title>
            <link>https://medium.com/@goncalvesjoao/rails-devise-jwt-and-the-forgotten-warden-67cfcf8a0b73?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/67cfcf8a0b73</guid>
            <category><![CDATA[jwt]]></category>
            <category><![CDATA[devise]]></category>
            <category><![CDATA[rails]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Fri, 15 Apr 2016 12:35:21 GMT</pubDate>
            <atom:updated>2016-04-15T12:35:21.261Z</atom:updated>
            <content:encoded><![CDATA[<p>Long story short: Most of the examples that we found under the <em>Rails devise jwt examples</em> google search do not make full use of <strong>devise’s</strong> capabilities.</p><p>Using a custom <strong>before_action</strong> under the <strong>ApiController</strong> to verify if the request contains a valid <strong>JWT token</strong> and ignoring the already existing <strong>before_action :authenticate_user! </strong>is not the best “devise example”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O57nm_Memt1N3ahRcuiERA.png" /><figcaption>not cool</figcaption></figure><p>It will render all of <strong>Devise</strong>’s helpers like <strong>current_user, user_signed_in?</strong> useless and is actually ignoring all the work that the authors’ had to make <strong>Devise</strong> into a:</p><blockquote>“Flexible authentication solution for Rails with Warden” <strong>devise gemspec description</strong></blockquote><h4>So, what is <strong>Warden</strong>, you ask.</h4><p><strong>Warden</strong> is a ruby gem that does the actual authentication through an array of strategies; when the first strategy fails to authenticate the user, it uses the next and so forth.</p><p><strong>Devise</strong> adds several strategies to <strong>Warden</strong>, according to your <strong>User Model</strong> configuration (if it is <strong>rememberable</strong>, <strong>database_authenticatable</strong>, etc.) and delegates the real authentication process to <strong>Warden</strong>, if one of the strategies (user cookie session, user password credentials, etc.) turns out ok, <strong>Devise</strong> will trust <strong>Warden</strong>’s judgment and behave accordingly.</p><h4>Cool, lets build our own JWT Strategy and add it to <strong>Warden</strong>’s list</h4><p>With this new strategy added to the top of the list, if you make a request with a <strong>JWT token</strong> in the <strong>HTTP Authorization Header</strong> that strategy will kick in and <strong>Warden</strong> will tell <strong>Devise</strong> that the user is logged in, just like when you make a request with a <strong>cookie session</strong>.</p><p>Adding a new way to authenticate your user should not require you to change your app, this authentication middleware (JWT strategy) will allow your app to trust <strong>Devise</strong> like it should, <strong>before_action :authenticate_user!</strong> will enforce both your <strong>JWT authentication</strong> and your <strong>User Model</strong> configuration, <strong>current_user</strong> will return the authenticated user, <strong>user_signed_in?</strong> will correctly return true or false and all of the other helpers will behave like they should.</p><p>So without further ado…</p><h3>Changes you need to make in order to make Devise use JWT Header Authentication</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/391b3ea58448807ba415481cd0f99a9a/href">https://medium.com/media/391b3ea58448807ba415481cd0f99a9a/href</a></iframe><p>Cool, hope it helps anyone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67cfcf8a0b73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rails special route for single page applications]]></title>
            <link>https://medium.com/@goncalvesjoao/rails-special-route-for-single-page-applications-de9e6bf32199?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/de9e6bf32199</guid>
            <category><![CDATA[router]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Thu, 07 Apr 2016 15:43:21 GMT</pubDate>
            <atom:updated>2016-04-07T15:43:21.599Z</atom:updated>
            <content:encoded><![CDATA[<p>OK. You got a React, Angular, Ember, etc. Single Page Application (SPA) with its own set of routes.</p><p>You also have a Rails app with its own set of routes, integrated with your SPA.</p><p>Every time a request does not match a Rails route you need it to return an <strong>index.html</strong> file that loads your SPA, so that your SPA route system can decided whether or not that request is a real 404.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*tOBjUkCIuCpe7eyD4zKBOA.png" /></figure><p>Line 18 does just that. Great, but…</p><p>Now every time your SPA makes a request, say “/api/v1/heroess.json” that should return a <strong>404</strong> with a <strong>json</strong> response, you’ll get a <strong>200</strong> with your <strong>SPA index.html</strong>.</p><p>So, in truth you just want to return your SPA index.html when you make a html non xhr request. What does that mean?</p><p>Browser native requests for html pages, only.</p><p>So, <strong>Ajax</strong> requests should not be intercepted and requests for any other type of format besides <strong>html</strong> should too.</p><p>“<a href="http://guides.rubyonrails.org/routing.html">Rails Routing from the Outside In</a>” talks about the constraints option, but must of us just remember the constrain by regex approach.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*0SlGP5QxE5uC95nUgdiJXg.png" /></figure><p>Now a <strong>GET</strong> browser request for:</p><ul><li>“/users” will return a <strong>200 OK</strong></li><li>“/userss” will return a <strong>200 OK</strong> with your <strong>SPA index.html</strong> that will decide if that’s a 404 request</li><li>“/userss.html” will also return your SPA</li><li>“/userss.json” will return a <strong>404 Not Found</strong><em> (yay!)</em></li></ul><p>and any <strong>Ajax</strong> request will ignored by the line 18 route, cool.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=de9e6bf32199" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React + ES7 decorators, how to inject props to your render method]]></title>
            <link>https://medium.com/@goncalvesjoao/react-es7-decorators-how-to-inject-props-to-your-render-method-27a0a7973106?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/27a0a7973106</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[es6]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Mon, 02 Nov 2015 22:03:40 GMT</pubDate>
            <atom:updated>2015-11-03T11:44:27.821Z</atom:updated>
            <content:encoded><![CDATA[<p>Yes, this is yet another “reducing React’s boilerplate howto” but this one comes from the future!!</p><p>ES7 decorators baby, take a look: <a href="https://github.com/wycats/javascript-decorators">https://github.com/wycats/javascript-decorators</a></p><p>You’ll need to configure babel to enable ES7 decorators (or stage 1) and it is something that when you know how it works you might be tempted to overuse it, but be careful: <strong>add too much magic to your code and you end up being the only wizard that understands it.</strong></p><pre>import React from &#39;react&#39;;<br>const Avatar = ({ url }) =&gt; &lt;img src={ url } /&gt;;</pre><pre>class Profile extends React.Component {<br>  render() {<br>    return (<br>      &lt;div&gt;<br>        &lt;Avatar url={ this.props.avatarUrl } /&gt;<br>        { `${ this.props.firstName } ${ this.props.lastName } - ${ this.props.email }` }<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default Profile;</pre><p>This simple example can illustrate how “this.props” can clutter your code, that’s why we see React developers tend to use ES6 Destructuring capabilities.</p><pre>import React from &#39;react&#39;;<br>const Avatar = ({ url }) =&gt; &lt;img src={ url } /&gt;;</pre><pre>class Profile extends React.Component {<br>  render() {<br>    const { avatarUrl, firstName, lastName, email } = this.props;</pre><pre>    return (<br>      &lt;div&gt;<br>        &lt;Avatar url={ avatarUrl } /&gt;<br>        { `${ firstName } ${ lastName } - ${ email }` }<br>      &lt;/div&gt;<br>    );<br>  }<br>}</pre><pre>export default Profile;</pre><p>Cleaner? Yes, but we can do better.</p><p>How about, injecting the props into the render method, “kinda” like a stateless component?</p><pre>import React from &#39;react&#39;;<br>const Avatar = ({ url }) =&gt; &lt;img src={ url } /&gt;;</pre><pre>class Profile extends React.Component {</pre><pre>  render({ avatarUrl, firstName, lastName, email }) {<br>    return (<br>      &lt;div&gt;<br>        &lt;Avatar url={ avatarUrl } /&gt;<br>        { `${ firstName } ${ lastName } - ${ email }` }<br>      &lt;/div&gt;<br>    );<br>  }</pre><pre>}</pre><pre>export default Profile;</pre><p>How?</p><p>Well the example above doesn’t work without doing something like this:</p><pre>import React from &#39;react&#39;;<br>const Avatar = ({ url }) =&gt; &lt;img src={ url } /&gt;;</pre><pre>class Profile extends React.Component {</pre><pre>  render({ avatarUrl, firstName, lastName, email }) {<br>    return (<br>      &lt;div&gt;<br>        &lt;Avatar url={ avatarUrl } /&gt;<br>        { `${ firstName } ${ lastName } - ${ email }` }<br>      &lt;/div&gt;<br>    );<br>  }</pre><pre>}</pre><pre>const oldRender = Profile.prototype.render;</pre><pre>Profile.prototype.render = function propsInjectorFunction() {<br>   return oldRender.bind(this)(this.props);<br>}</pre><pre>export default Profile;</pre><p>We probably want to export the “propsInjectorFunction” functionality to another file and be able to reuse it on other classes right?</p><p>Enter ES7 decorators (<a href="https://github.com/wycats/javascript-decorators">https://github.com/wycats/javascript-decorators</a>)</p><pre>function injectProps(target, name, descriptor) {<br>  const oldFunction = descriptor.value;</pre><pre>  descriptor.value = function propsInjectorFunction() {<br>    return oldFunction.bind(this)(this.props);<br>  };</pre><pre>  return descriptor;<br>}</pre><pre>export default injectProps;</pre><p>and now on the Profile class we import the decorator a use it like so.</p><pre>import React from &#39;react&#39;;<br>import injectProps from &#39;./injectProps&#39;;</pre><pre>const Avatar = ({ url }) =&gt; &lt;img src={ url } /&gt;;</pre><pre>class Profile extends React.Component {</pre><pre>  @injectProps<br>  render({ avatarUrl, firstName, lastName, email }) {<br>    return (<br>      &lt;div&gt;<br>        &lt;Avatar url={ avatarUrl } /&gt;<br>        { `${ firstName } ${ lastName } - ${ email }` }<br>      &lt;/div&gt;<br>    );<br>  }</pre><pre>}</pre><pre>export default Profile;</pre><p>This <em>injectProps</em> is part of a group of helper tools from linkedcare’s <a href="https://github.com/croudcare/relpers"><em>relpers</em> package</a>, checkout what other helpers it contains and consider contributing to it we would like to learn from you too.</p><p>I encourage you to build your own decorators but don’t overdo it, for you (the creator), it is obvious what they do but for your teammates it isn’t.</p><p>I also encourage you guys to create a repo for this kind of tools and every time you create a new tool, pull-request it to that repo and let it be known to your teammates. Don’t expect people to magically use a tool/helper you’ve created if you are the only one that knows about it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=27a0a7973106" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keep your kitchen clean]]></title>
            <link>https://medium.com/@goncalvesjoao/keep-your-kitchen-clean-e39d692f8015?source=rss-4e7293b1560a------2</link>
            <guid isPermaLink="false">https://medium.com/p/e39d692f8015</guid>
            <category><![CDATA[style-guides]]></category>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[goncalvesjoao]]></dc:creator>
            <pubDate>Thu, 15 Oct 2015 15:35:07 GMT</pubDate>
            <atom:updated>2015-10-15T18:00:25.822Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Your code base is a kitchen and you and your colleagues are chefs. You might be outputting the best and delicious dishes and your clients have nothing but kind words about your work but if you don’t clean your kitchen, at some point in time you’ll have a cluttered and filthy workplace that will stop you from releasing those delicious dishes<em> </em>— Matt Wynne</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*qlb8GYQfsJg1TvXk3dpTBA.jpeg" /></figure><p>Those might not be the exact words that Matt used when I attended one of his BDD workshops but the analogy is the same.</p><p>People don’t normally see the backstage of a web app and that may undermine some concerns that are a requirement when building something as tangible as a brand, a logo or the design of an app.</p><p>Imagine the work of a web designer without some kind of style guide and consistency when building your app. Your homepage uses blue as the main colour, your contacts uses red and sometimes on some other pages its yellow with a different logo. Not quite the work you’d be looking for right? One might say, not professional.</p><p>Well as a developer and a master chef you are also a designer. So, given your current code style and consistency throughout your code; <strong>if your client could see your kitchen would he eat a dish cooked by you?</strong></p><p>Your client probably can’t see it but your developer colleagues can and if you plan on releasing your work onto the open source world wilderness, you’ll probably have millions of chefs looking at your kitchen.</p><p>Whether or not you want to be professional or look like it is totally up to you <strong>One would do well not be constrained by what others think of him.</strong></p><p>but</p><p><strong>One would do better to be considerate of others when working with them.</strong></p><p>You might not want to clean your kitchen but other chefs are working in it too, be mindful of that. Don’t be that screw-this-I’ll-do-it-my-way-guy, you should be coding for them not for you and remember they are not the only ones that will struggle with your code, in the long run your future self will be a stranger to your code too.</p><p>Not following some kind of code style guide and not being consistent with it will lead to a messy kitchen. If you decide to quit and go work in another restaurant, chances are an old colleague of yours will have to clean your mess because he wants to continue to prepare good dishes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*RAWzhmBFyRP5miLuCAm2Sg.png" /></figure><p>Care for your readers, calling things a different name (“event” =&gt; “evt”, “ev” or “index” =&gt;“idx”, “i”) doesn’t not help at all; not to mention the lack of consistency that will occur if everyone decides to invent new cryptic and prone to conflict names.</p><p>Defining URL routes for your API that you think are way easier to understand than REST is once again not helping. Other people don’t see the world the same way you do, don’t expect them to magically understand you.</p><p>Writing convoluted and super hyper DRY code does not make you a super developer rock star.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*Q9HwYhn33jyunsDTAezSfw.png" /><figcaption>This example is from one of my ruby gems.</figcaption></figure><p>Not caring if people struggle to understand you, does not benefit you in anyway.</p><p>Choose a style guide with your team and stick with known and widely spread standards/conventions. If you or someone else are having problems with certain rules, talk about it together to achieve some kind of commitment.</p><p>Must of us do not have the capacity to look at our own code from a stranger’s perspective but ultimately our code is bound to be read/used by others, therefore it is our job and no-one else’s to help them doing so.</p><p><strong>Code for others not for you.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e39d692f8015" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>