<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Pablo Martí</title>
    <description>The latest articles on DEV Community by Pablo Martí (@pablomarti).</description>
    <link>https://dev.to/pablomarti</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F52426%2F20c4b038-cf6c-43aa-be93-057f4b1b8f62.jpg</url>
      <title>DEV Community: Pablo Martí</title>
      <link>https://dev.to/pablomarti</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/pablomarti"/>
    <language>en</language>
    <item>
      <title>Find out about companies</title>
      <dc:creator>Pablo Martí</dc:creator>
      <pubDate>Fri, 15 Feb 2019 20:26:41 +0000</pubDate>
      <link>https://dev.to/pablomarti/find-out-about-companies-2749</link>
      <guid>https://dev.to/pablomarti/find-out-about-companies-2749</guid>
      <description>&lt;p&gt;A company is trying to recruit you, what do you do in order to find if that's a good option without getting into the interview process that may cost you time?&lt;/p&gt;

&lt;p&gt;Options:&lt;/p&gt;

&lt;p&gt;1 - Search the web and make questions. Does the company have a good reputation? How long? How much? If it is a startup, what is the past of the founders?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.glassdoor.com"&gt;https://www.glassdoor.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.crunchbase.com"&gt;https://www.crunchbase.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://angel.co"&gt;https://angel.co&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;LinkedIn, Facebook and Twitter.&lt;/p&gt;

&lt;p&gt;2 - Talk with friends, what do they know about it?&lt;/p&gt;

&lt;p&gt;3 - Do not make too many questions about the startup (if thats the case) until the interview.&lt;/p&gt;

&lt;p&gt;What other things do you do?&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Monkey Patch Rails validators</title>
      <dc:creator>Pablo Martí</dc:creator>
      <pubDate>Wed, 13 Feb 2019 01:41:33 +0000</pubDate>
      <link>https://dev.to/pablomarti/monkey-patch-ruby-onrails-validators-gge</link>
      <guid>https://dev.to/pablomarti/monkey-patch-ruby-onrails-validators-gge</guid>
      <description>&lt;p&gt;&lt;a href="https://github.com/plataformatec/devise"&gt;Devise&lt;/a&gt;, an authentication solution for Rails, gives some modules that add some cool functionalities to the models, one of them is &lt;a href="https://github.com/plataformatec/devise/blob/master/lib/devise/models/validatable.rb"&gt;Validatable&lt;/a&gt; which adds the validations needed for emails and passwords. One of those validations is &lt;em&gt;validates_uniqueness_of&lt;/em&gt; which is in charge of checking that the email address is unique.&lt;/p&gt;

&lt;p&gt;I have been working on a Rails API since 2016 and it uses Devise; users are required to give unique emails. But something change: now the API supports a Chatbox which will be added on many websites, we want to get those visitors and we have to support duplicate emails.&lt;/p&gt;

&lt;p&gt;The best approach is to make a new model for those users, but because of the impact to the application (which is a chat application) we don’t have the time to make it happen.&lt;/p&gt;

&lt;p&gt;Another alternative may be this &lt;a href="https://github.com/plataformatec/devise/issues/4767"&gt;Validatable should allow email uniqueness to be scoped#4767&lt;/a&gt; but the discussion is still open. Maybe removing the &lt;em&gt;Validatable&lt;/em&gt; module and implement everything but it will generate extra work and will increase the probability of failures (remember always TDD). Instead of that I followed a different approach.&lt;/p&gt;

&lt;p&gt;Taking advantage from Ruby, I get the model validators for the &lt;em&gt;email&lt;/em&gt; attribute and I find the &lt;em&gt;UniquenessValidator&lt;/em&gt;. Then I redefine the &lt;em&gt;validate&lt;/em&gt; method of the validator.&lt;/p&gt;

&lt;p&gt;At a Rails model:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;This is called &lt;a href="https://en.wikipedia.org/wiki/Monkey_patch"&gt;Monkey Patch&lt;/a&gt;. It is a vague term, the best definition is &lt;strong&gt;dynamic modification of a class on runtime&lt;/strong&gt; , and in this case specifically it is redefining an instance method on runtime. Here are some good explanations at &lt;a href="https://stackoverflow.com/questions/394144/what-does-monkey-patching-exactly-mean-in-ruby"&gt;this StackOverflow thread&lt;/a&gt;, and citing Patrick Ewing:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Well, I was just totally sold by Adam, the idea being that if it walks like a duck and talks like a duck, it’s a duck, right? So if this duck is not giving you the noise that you want, you’ve got to just punch that duck until it returns what you expect.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Kind of cool but something you want to avoid. Personally I believe that a good design will avoid these kind of things. But for those hard moments or for well designed solutions keep this in mind.&lt;/p&gt;

&lt;p&gt;Good material for reading:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://ndlib.github.io/practices/redefining-instance-methods-at-runtime/"&gt;Redefining Instance Methods at Runtime&lt;/a&gt; by Jeremy Friesen&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.devalot.com/articles/2008/09/ruby-singleton"&gt;Understanding Ruby Singleton Classes&lt;/a&gt; by Peter J. Jones&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.justinweiss.com/articles/3-ways-to-monkey-patch-without-making-a-mess/"&gt;3 Ways to Monkey-Patch Without Making a Mess&lt;/a&gt; by Justin Weiss&lt;/p&gt;

&lt;p&gt;&lt;a href="https://ruby-doc.org/core-2.5.3/doc/syntax/refinements_rdoc.html"&gt;Refinements&lt;/a&gt; at Ruby Docs&lt;/p&gt;

</description>
      <category>monkeypatching</category>
      <category>rails</category>
      <category>ruby</category>
    </item>
    <item>
      <title>"How" do you study?</title>
      <dc:creator>Pablo Martí</dc:creator>
      <pubDate>Tue, 08 Jan 2019 20:23:37 +0000</pubDate>
      <link>https://dev.to/pablomarti/how-do-you-study-4lpe</link>
      <guid>https://dev.to/pablomarti/how-do-you-study-4lpe</guid>
      <description>&lt;p&gt;We all have to study. Everything changes constantly. We have works, responsibilities, families, we all have to seek a healthy life so we have to sleep well, and all of that takes time, and when you are decided to study you will have 2 options:&lt;br&gt;
1 - Smile with an opportunity to grow up not just as a professional but as a human being&lt;br&gt;
2 - Get angry and make dumb decisions&lt;/p&gt;

&lt;p&gt;So, because you want the 1st option, how do you study? This question leads to other questions:&lt;br&gt;
1 - How do you decide what to study?&lt;br&gt;
2 - How do you prepare your schedule for studying? (because you will have to move things, cancel others)&lt;br&gt;
3 - How do you prepare your environment to protect you to not get distracted?&lt;br&gt;
4 - What tools do you use for studying?&lt;br&gt;
5 - Whats your methodology for studying?&lt;/p&gt;

</description>
      <category>discuss</category>
    </item>
    <item>
      <title>Looking for courses and books about Software Architecture</title>
      <dc:creator>Pablo Martí</dc:creator>
      <pubDate>Thu, 22 Nov 2018 23:24:59 +0000</pubDate>
      <link>https://dev.to/pablomarti/looking-for-courses-and-books-about-software-architecture-1mhp</link>
      <guid>https://dev.to/pablomarti/looking-for-courses-and-books-about-software-architecture-1mhp</guid>
      <description>&lt;p&gt;Today I was studying about Monolithic Applications and Microservices Architecture (specially at Martin Fowler blog) and I know something about it but I really want to go into this. What courses, specializations, books do you recommend?&lt;/p&gt;

&lt;p&gt;I was reading some posts like &lt;a href="https://dev.to/mikkpr/what-are-good-ways-to-learn-software-architecture-and-systems-design-38b9"&gt;https://dev.to/mikkpr/what-are-good-ways-to-learn-software-architecture-and-systems-design-38b9&lt;/a&gt; that has a lot of good information but I want to find something straight-forward to follow for the next months.&lt;/p&gt;

&lt;p&gt;This is very open but was done intentionally so you can guide me because I don't know if have some wrong concepts :D lol thank you!&lt;/p&gt;

</description>
      <category>question</category>
      <category>architecture</category>
      <category>career</category>
      <category>discuss</category>
    </item>
  </channel>
</rss>
