<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="4.4.1">Jekyll</generator><link href="https://bearandgiraffe.com/blog/feed.xml" rel="self" type="application/atom+xml" /><link href="https://bearandgiraffe.com/" rel="alternate" type="text/html" /><updated>2026-11-21T19:39:02+00:00</updated><id>https://bearandgiraffe.com/blog/feed.xml</id><title type="html">Bear &amp;amp; Giraffe</title><subtitle>Fractional CTO and senior engineering leadership for startups. We architect scalable systems and take products from MVP to mature infrastructure.</subtitle><entry><title type="html">Building an MVP Has Never Been Easier. But Building the Right MVP Still Takes Experience.</title><link href="https://bearandgiraffe.com/blog/building-an-mvp-with-ai/" rel="alternate" type="text/html" title="Building an MVP Has Never Been Easier. But Building the Right MVP Still Takes Experience." /><published>2026-11-21T15:00:00+00:00</published><updated>2026-11-21T15:00:00+00:00</updated><id>https://bearandgiraffe.com/blog/building-an-mvp-with-ai</id><content type="html" xml:base="https://bearandgiraffe.com/blog/building-an-mvp-with-ai/"><![CDATA[<p>If you’ve ever had a software idea, you’ll probably be familiar with the frustration that comes with trying to get it off the ground.</p>

<p>You know the problem you want to solve. You understand the industry, the customers, the workflows and, quite possibly, exactly what the solution should look like.</p>

<p>But turning that idea into working software is another matter.</p>

<p>Traditionally, you had a few options. Learn to code yourself, find a technical co-founder, hire a development agency or bring in a freelance developer. All of these come with their own challenges, costs and, perhaps most importantly, time commitments.</p>

<p>For early-stage founders, this can be a significant barrier. You might spend months and a considerable amount of money getting to a point where you can finally put something in front of a customer.</p>

<p>That’s beginning to change.</p>

<p>AI coding tools have made it possible to build software at a speed that would have been difficult to imagine just a couple of years ago. Tools like Claude Code are changing the way we approach software development, creating opportunities to deliver MVPs faster and more efficiently.</p>

<p>But there’s an important distinction I’d like to make.</p>

<aside class="post-callout">
  <span class="post-callout__icon material-symbols-outlined" aria-hidden="true">lightbulb</span>
  <div class="post-callout__body">
    <p class="post-callout__label">The important distinction</p>
    <p class="post-callout__lead">AI makes building software faster. It doesn't automatically make building <strong>good</strong> software easier.</p>
    <p>And understanding that distinction is where the real opportunity lies.</p>
  </div>
</aside>

<h2 data-kicker="The Shift" id="from-idea-to-working-software-faster">From idea to working software, faster</h2>

<p>Until recently, getting an MVP built meant translating your idea into a technical specification, handing that specification to a developer and waiting for them to turn it into something tangible.</p>

<p>There was often a significant gap between what you imagined and what eventually appeared on the screen.</p>

<p>You’d have conversations about requirements, review designs, discuss technical decisions and wait for development cycles to complete. By the time you had something usable, you’d probably learned a few things about what you actually wanted to build.</p>

<p>AI is changing this feedback loop.</p>

<p>We’re now able to leverage AI coding tools to significantly accelerate the development process. Rather than manually writing every line of code, we can use tools like Claude Code to generate, modify and improve code within an established development environment.</p>

<p>This doesn’t mean handing over the entire development process to AI. It means using AI to take care of some of the more repetitive and time-consuming aspects of building software, freeing up experienced developers to focus on the decisions and functionality that really matter.</p>

<p>The result is that we can move from an idea to something tangible much more quickly.</p>

<p>For founders, that means getting a usable version of their product in front of potential customers sooner, gathering feedback earlier and making better-informed decisions about where to invest their development budget.</p>

<p>That’s a big deal.</p>

<h2 data-kicker="Tooling" id="why-claude-code-is-particularly-interesting">Why Claude Code is particularly interesting</h2>

<p>There are plenty of AI tools that can generate code. What’s particularly interesting about Claude Code is that it goes beyond simply suggesting snippets of code or helping you write individual functions.</p>

<p>Claude Code is an agentic coding tool. It can work with an entire codebase, understand how different parts of an application fit together, make changes across multiple files, run commands, execute tests and iterate on its work.</p>

<p>In practical terms, we can describe a feature, ask Claude Code to help implement it and have it work through many of the development tasks that would traditionally require manual effort.</p>

<p>For example, imagine we’re building a platform that helps independent fitness instructors manage their clients.</p>

<p>We can use AI to accelerate the implementation of common functionality such as:</p>

<div class="post-compare">
  <div class="post-compare__card">
    <div class="post-compare__header"><span class="post-compare__title"><span class="material-symbols-outlined text-primary text-[20px]" aria-hidden="true">bolt</span>Common functionality</span><span class="post-compare__badge">Accelerate with AI</span></div>

    <ul>
      <li>User registration and authentication.</li>
      <li>Landing pages and standard website layouts.</li>
      <li>User profiles and account management.</li>
      <li>Basic administrative interfaces.</li>
      <li>Common database operations and application workflows.</li>
    </ul>

  </div>
  <div class="post-compare__card post-compare__card--accent">
    <div class="post-compare__header"><span class="post-compare__title"><span class="material-symbols-outlined text-primary text-[20px]" aria-hidden="true">psychology</span>What makes it different</span><span class="post-compare__badge">Where we spend our time</span></div>

    <ul>
      <li>A unique scheduling algorithm.</li>
      <li>An innovative client engagement process.</li>
      <li>A completely different way of managing memberships.</li>
    </ul>

  </div>
</div>

<p>These are all important parts of an application, but they’re rarely the reason someone chooses one fitness management platform over another.</p>

<p>The real value is in the functionality that makes this particular product different. Perhaps it’s a unique scheduling algorithm, an innovative client engagement process or a completely different way of managing memberships.</p>

<p>That’s where we want to spend our time.</p>

<p>By using Claude Code to accelerate the implementation of common components, we can spend more development time on the features that differentiate the business and create value for its customers.</p>

<p>And because we’re working within an established technical framework, we’re not starting from scratch every time we build something.</p>

<h2 data-kicker="Our Approach" id="ai-doesnt-replace-our-technical-expertise-it-amplifies-it">AI doesn’t replace our technical expertise. It amplifies it.</h2>

<p>One thing I think is important to clarify is that we’re not experimenting with a different technology stack for every project or asking AI to decide how an application should be built.</p>

<p>At Bear &amp; Giraffe, we have a preferred, specialized technology stack built around Ruby and Ruby on Rails.</p>

<p>We’ve invested years in understanding this technology, developing our approach and establishing best practices for building reliable, maintainable applications.</p>

<p>That experience is incredibly valuable when introducing AI into the development process.</p>

<p>Rather than asking an LLM to invent an architecture or make fundamental technical decisions, we can provide it with an established framework, conventions and instructions to work within.</p>

<p>We know how we want our applications structured. We know the patterns we prefer, how we handle authentication, how we organize business logic and how we approach security, testing and performance.</p>

<p>Claude Code can then help us generate much of the code that would traditionally have to be written manually.</p>

<p>Our developers remain responsible for reviewing the output, making architectural decisions, identifying potential issues and ensuring everything meets the standards we’d expect from professionally developed software.</p>

<p>This is an important distinction.</p>

<p>AI-generated code isn’t automatically good code. It still needs to be validated, tested, reviewed and optimized.</p>

<p>But when you combine the speed of AI with the experience of developers who understand the underlying technology, you get something particularly powerful.</p>

<blockquote class="pullquote">
  <p>We’re not replacing engineering expertise with AI. We’re using AI to make that expertise go further.</p>
</blockquote>

<h2 data-kicker="Playbook" id="how-were-using-ai-to-deliver-mvps-faster">How we’re using AI to deliver MVPs faster</h2>

<p>If I were working with a non-technical founder today who wanted to get an MVP off the ground, I’d approach the development process differently than I would have a few years ago.</p>

<p>The fundamentals of good product development haven’t changed. We still need to understand the problem, define the scope, build iteratively and validate our assumptions.</p>

<p>What’s changed is how quickly we can move through those steps.</p>

<p>Here’s how I’d approach it.</p>

<div class="post-steps">
  <div class="post-step">
    <h3 id="start-with-the-problem-not-the-technology">Start with the problem, not the technology</h3>

    <p>Before opening Claude Code or writing a line of code, we need to get really clear about what we’re trying to achieve.</p>

    <ul class="question-list">
      <li>Who is the customer?</li>
      <li>What problem are we solving?</li>
      <li>How are they currently solving it?</li>
      <li>What would make them willing to pay for a better solution?</li>
    </ul>

    <p>These questions are much more important than any technical decision.</p>

    <p>It’s surprisingly easy to get caught up in building features because they’re interesting or because AI makes them easy to create.</p>

    <p>Resist that temptation.</p>

    <p>Your MVP should be the smallest version of your product that allows you to test whether your underlying business idea has merit.</p>

  </div>
  <div class="post-step">
    <h3 id="focus-development-on-what-makes-your-product-different">Focus development on what makes your product different</h3>

    <p>Once we understand the problem, we can work backwards from the outcome we want to test.</p>

    <p>Let’s say you’re building a marketplace.</p>

    <p>You might eventually want customer accounts, seller accounts, listings, search, messaging, payments, reviews, notifications and analytics.</p>

    <p>But do you need all of those things to validate the idea?</p>

    <p>Probably not.</p>

    <p>Some functionality is common across almost every application. Authentication, user profiles, landing pages and basic administrative functionality are necessary, but they’re not necessarily where your competitive advantage lies.</p>

    <p>These are areas where we can leverage Claude Code to accelerate implementation.</p>

    <p>Instead of spending significant development time manually building familiar components, we can use AI to generate much of the initial implementation, with our developers reviewing and refining it.</p>

    <p>That gives us more time to focus on the interesting parts: the unique workflows, business logic and features that solve your customers’ problems in a different way.</p>

    <p>A good technical partner can also help you identify what you don’t need to build yet.</p>

    <p>The goal isn’t to build the complete vision. It’s to build enough of it to learn whether people actually want it.</p>

  </div>
  <div class="post-step">
    <h3 id="keep-the-agile-approach-but-accelerate-the-cycles">Keep the agile approach, but accelerate the cycles</h3>

    <p>One of the biggest misconceptions about AI-assisted development is that you need to change your entire approach to building software.</p>

    <p>I don’t think that’s necessary.</p>

    <p>The principles of agile development are still incredibly relevant.</p>

    <p>We still want to break the product into manageable pieces, prioritize functionality, develop iteratively, review progress and adapt based on feedback.</p>

    <p>What’s changed is the speed at which we can move through these cycles.</p>

    <p>With Claude Code, we can accelerate many of the implementation tasks that previously consumed a significant proportion of a development sprint.</p>

    <p>We can get common components out of the way faster, generate initial implementations of features and make changes without having to manually work through every line of code.</p>

    <p>This allows us to spend more time on product decisions, technical reviews and the functionality that really matters.</p>

    <p>It also means we can potentially go through several iterations in the time it might previously have taken to complete one.</p>

    <p>We’re not abandoning good software development practices. We’re making them more efficient.</p>

  </div>
  <div class="post-step">
    <h3 id="prototype-faster-and-validate-in-the-real-world">Prototype faster and validate in the real world</h3>

    <p>This is probably one of the most exciting opportunities AI brings to early-stage product development.</p>

    <p>Historically, even producing a prototype could involve a considerable amount of time and effort.</p>

    <p>You’d need to work through designs, create screens, define interactions and eventually get something developed before you could put it in front of users.</p>

    <p>AI changes that equation.</p>

    <p>We can now produce low-fidelity prototypes and working feature concepts much faster.</p>

    <p>Want to experiment with a different customer onboarding experience? We can build a basic version and test it.</p>

    <p>Want to see whether customers understand a new workflow? We can put together a prototype and get feedback.</p>

    <p>Want to compare two different approaches to a feature? We can potentially implement both without committing to a significant development effort.</p>

    <p>The important thing is that we’re not spending weeks perfecting something before finding out whether it’s useful.</p>

    <p>We can get ideas into the real world, observe how people interact with them and use that feedback to decide what to build next.</p>

    <p>This is particularly valuable for startups because so many early product decisions are based on assumptions.</p>

    <p>The faster you can test those assumptions, the faster you can establish whether you’re building something people actually need.</p>

    <p>And because the cost of experimenting is lower, you can afford to try more things.</p>

    <blockquote class="pullquote">
      <p>The biggest advantage isn’t simply that we can build faster. It’s that we can learn faster.</p>
    </blockquote>

  </div>
  <div class="post-step">
    <h3 id="make-sure-the-technical-foundations-are-right">Make sure the technical foundations are right</h3>

    <p>This is the part I’d be particularly careful about.</p>

    <p>Even if we’re using Claude Code to generate a significant proportion of the application, someone needs to take responsibility for the technical decisions.</p>

    <ul class="question-list">
      <li>What does the application architecture look like?</li>
      <li>How is authentication handled?</li>
      <li>How are permissions managed?</li>
      <li>How is customer data protected?</li>
      <li>How are automated tests structured?</li>
      <li>What happens when the application needs to support more users?</li>
    </ul>

    <p>You don’t necessarily need to solve every scaling problem on day one. In fact, I’d actively discourage overengineering an MVP.</p>

    <p>But you do need to make sensible decisions that allow the application to grow without having to throw everything away.</p>

    <p>AI can generate code, but it doesn’t automatically understand the commercial and technical implications of every decision.</p>

    <p>That’s where experience matters.</p>

    <p>A good technical foundation should make it easier to move quickly, not slow you down.</p>

  </div>
</div>

<h2 data-kicker="Advisory" id="the-new-role-of-a-fractional-cto">The new role of a fractional CTO</h2>

<p>I think this is where the role of a fractional CTO becomes particularly interesting.</p>

<p>Historically, a fractional CTO might help a founder choose a development team, establish a technical strategy, manage delivery and make sure the product was being built properly.</p>

<p>Those responsibilities haven’t disappeared.</p>

<p>But the way we deliver against them is changing.</p>

<p>Rather than simply managing a traditional development process, we can now work much more directly with founders and AI coding tools to get products built.</p>

<p>That might mean helping define the MVP, establishing the technical architecture, setting up Claude Code with the right project context and development conventions, and guiding the development process.</p>

<p>It might also mean reviewing AI-generated code, identifying potential security issues, making sure the application is tested properly and deciding when something is ready to go live.</p>

<p>The difference is that we’re able to deliver more with less manual development effort.</p>

<p>For some early-stage businesses, that means getting to market without needing to assemble a large development team.</p>

<p>You get access to technical experience when you need it, without necessarily taking on the cost of a full-time CTO or a large development team.</p>

<p>More importantly, you have someone looking at the bigger picture rather than simply making sure the latest prompt produces the desired result.</p>

<h2 data-kicker="For Founders" id="does-this-mean-you-can-build-your-startup-without-a-technical-co-founder">Does this mean you can build your startup without a technical co-founder?</h2>

<p>Potentially, yes.</p>

<p>I think this is one of the biggest opportunities AI presents to non-technical entrepreneurs.</p>

<p>If you’ve got a strong understanding of a market, a genuine problem to solve and the ability to get in front of customers, the barriers to building an initial product are considerably lower.</p>

<p>You might not need to find a technical co-founder before you can get started.</p>

<p>You might not need to raise a significant amount of money to fund an initial development project.</p>

<p>And you might not need to hire a team of developers just to find out whether your idea has potential.</p>

<p>You can get much further with a combination of your own expertise, AI-assisted development and experienced technical guidance.</p>

<p>However, I’d distinguish between building an MVP and running a software business.</p>

<p>As your product becomes more complex, your customer base grows and the consequences of technical problems become more significant, you’ll need to continue investing in the underlying technology.</p>

<p>AI doesn’t remove that responsibility.</p>

<p>It simply gives you more options about when and how you invest in it.</p>

<h2 data-kicker="The Real Advantage" id="the-opportunity-is-to-learn-faster-not-just-build-faster">The opportunity is to learn faster, not just build faster</h2>

<p>I think it’s easy to get caught up in the excitement of AI and focus entirely on how quickly we can generate software.</p>

<p>But speed of development isn’t really the most important thing.</p>

<p>The real opportunity is being able to test assumptions, gather feedback and make improvements much faster.</p>

<p>For a startup, that’s incredibly valuable.</p>

<p>Every week spent building the wrong thing is a week you could have spent learning what customers actually need.</p>

<p>If AI allows you to get a working product into the market sooner, you’ve got more time to validate the business, refine the proposition and work out whether there’s a viable opportunity.</p>

<p>That’s where the competitive advantage comes from.</p>

<p>Not from having the biggest codebase, the most sophisticated architecture or the longest list of features.</p>

<p>It’s from learning faster than everyone else.</p>

<h2 data-kicker="The Verdict" id="so-should-you-be-using-ai-to-build-your-mvp">So, should you be using AI to build your MVP?</h2>

<p>My answer would be yes, absolutely.</p>

<p>If you’re a non-technical founder with an idea for a software product, there has never been a better time to explore it.</p>

<p>Tools like Claude Code are making it possible to develop software faster, experiment with ideas more affordably and get working products into the hands of customers much sooner.</p>

<p>But I’d argue that the biggest opportunity isn’t necessarily for founders to become developers themselves.</p>

<p>It’s for experienced development teams to use these tools to deliver better results, faster.</p>

<p>At Bear &amp; Giraffe, we’re combining our experience building applications with Ruby and Ruby on Rails with AI-assisted development to accelerate the process without compromising on the quality of the end result.</p>

<p>We can spend less time on repetitive implementation work and more time on the things that make a product successful: understanding the problem, building the right features, making good technical decisions and getting real-world feedback.</p>

<div class="post-compare">
  <div class="post-compare__card">
    <div class="post-compare__header"><span class="post-compare__title"><span class="material-symbols-outlined text-primary text-[20px]" aria-hidden="true">lightbulb</span>You bring</span></div>

    <ul>
      <li>The industry knowledge.</li>
      <li>The business idea.</li>
      <li>The understanding of the problem.</li>
    </ul>

  </div>
  <div class="post-compare__card post-compare__card--accent">
    <div class="post-compare__header"><span class="post-compare__title"><span class="material-symbols-outlined text-primary text-[20px]" aria-hidden="true">terminal</span>We bring</span></div>

    <ul>
      <li>The technical expertise.</li>
      <li>The development experience.</li>
      <li>The tools to turn those ideas into working software.</li>
    </ul>

  </div>
</div>

<blockquote class="pullquote">
  <p>The barrier to building software is coming down. The opportunity for entrepreneurs is going up.</p>
</blockquote>

<p>And I think that’s a pretty exciting place to be.</p>

<section class="post-cta">
  <div class="post-cta__label"><span class="material-symbols-outlined text-[20px]" aria-hidden="true">verified</span>Bear &amp; Giraffe</div>
  <h2 id="lets-talk">Thinking about building your MVP? Let's have a conversation.</h2>
  <p>At Bear &amp; Giraffe, we help entrepreneurs turn ideas into software products. If you've got an idea for an MVP but aren't sure where to start, we'd love to help you work out what's possible, what you should build first and how we can use AI to get you there faster.</p>
  <div class="post-cta__actions">
    <a class="post-cta__primary" href="/#contact">Let's have a conversation <span class="material-symbols-outlined text-[18px]" aria-hidden="true">arrow_forward</span></a>
    <a class="post-cta__secondary" href="/#services">Explore our services</a>
  </div>
</section>]]></content><author><name></name></author><category term="engineering" /><category term="ai" /><category term="claude-code" /><category term="mvp" /><category term="rails" /><summary type="html"><![CDATA[How AI, and particularly Claude Code, is changing the way we build software and helping founders get their ideas to market faster.]]></summary></entry><entry><title type="html">To ViewComponent or not to ViewComponent</title><link href="https://bearandgiraffe.com/blog/to-viewcomponent-or-not-to-viewcomponent/" rel="alternate" type="text/html" title="To ViewComponent or not to ViewComponent" /><published>2023-03-22T18:38:20+00:00</published><updated>2023-03-22T18:38:20+00:00</updated><id>https://bearandgiraffe.com/blog/to-viewcomponent-or-not-to-viewcomponent</id><content type="html" xml:base="https://bearandgiraffe.com/blog/to-viewcomponent-or-not-to-viewcomponent/"><![CDATA[<figure>
  <img src="/assets/images/blog/to-viewcomponent-or-not-to-viewcomponent/1.png" alt="" width="1200" height="424" loading="lazy" />
</figure>

<p>Github is one of the largest Ruby on Rails applications, with a complex infrastructure, backend, and frontend. The UI that powers Github is rich and handles complex inline interactions, so it’s natural that Github would create its own frontend framework that works with Rails. Enter the <a href="https://viewcomponent.org/">ViewComponent</a> library.</p>

<p>ViewComponent is defined as:</p>

<blockquote>
  <p>A framework for creating reusable, testable &amp; encapsulated view components, built to integrate seamlessly with Ruby on Rails.</p>
</blockquote>

<p>To a seasoned Rails dev, this might trigger some questions, like doesn’t Rails already have a way to write reusable, testable views? Wouldn’t this be achieved using partials and view helpers? What is ViewComponent trying to achieve that Rails doesn’t already have baked in?</p>

<p>Maybe the answer in this part of the docs:</p>

<blockquote>
  <p>Think of ViewComponents as an evolution of the presenter pattern, inspired by <a href="https://reactjs.org/docs/react-component.html">React</a>. A ViewComponent is a Ruby object and template</p>
</blockquote>

<p>Hmmm… do we actually want to bring “React” into Ruby and Ruby on Rails. The great thing about the Ruby community is that we already have plenty of ways to do things the right way, so is this something born out of the hype behind frontend frameworks like React? Or is there really something worth exploring?</p>

<p>If we keep reading the docs, we land on something interesting:</p>

<blockquote>
  <p>Based on several <a href="https://github.com/viewcomponent/view_component/blob/main/performance/partial_benchmark.rb">benchmarks</a>, ViewComponents are ~10x faster than partials in real-world use-cases.</p>
</blockquote>

<blockquote>
  <p>The primary optimization is pre-compiling all ViewComponent templates at application boot, instead of at runtime like traditional Rails views.</p>
</blockquote>

<p>Is this true? That might be a great value if that’s the case. Well, we can run the benchmark tests ourselves and validate that claim.</p>

<p>First, clone the repo:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git clone https://github.com/ViewComponent/view_component.git
</code></pre></div></div>

<p>then <code class="language-plaintext highlighter-rouge">cd</code> into the directory and install the dependencies:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">cd </span>view_component
bundle 
</code></pre></div></div>

<p><strong>Note:</strong> the <code class="language-plaintext highlighter-rouge">main</code> branch might have change that break the benchmark command. So you might want to use a specific branch or tag. At the time of writing this post, the most recent stable branch<code class="language-plaintext highlighter-rouge">v2.82.0</code>.</p>

<p>Then run the rake command provided with the project:</p>

<div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>rake partial_benchmark
</code></pre></div></div>

<p>To find out which <code class="language-plaintext highlighter-rouge">rake</code> commands are available you can run <code class="language-plaintext highlighter-rouge">rake -T</code> from inside the project.</p>

<p>The output we get is the following:</p>

<pre><code class="language-output">Warming up --------------------------------------
           component   476.000  i/100ms
              inline   565.000  i/100ms
             partial    86.000  i/100ms
Calculating -------------------------------------
           component      4.634k (± 2.9%) i/s -     46.648k in  10.074332s
              inline      5.402k (± 3.8%) i/s -     54.240k in  10.055319s
             partial    870.345  (± 2.8%) i/s -      8.772k in  10.087184s

Comparison:
              inline:     5402.4 i/s
           component:     4634.4 i/s - 1.17x  (± 0.00) slower
             partial:      870.3 i/s - 6.21x  (± 0.00) slower
</code></pre>

<p>According to this, partials are 6.2x slower that inline ViewComponents. That is not 10x! But also, you’re more likely to use regular ViewComponents as opposed to inline ones. So how do partials compare to that?</p>

<p>You can try to use the numbers provided and calculate the difference, or more easily, just update the benchmark file to remove inline components from the comparison:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c1"># performance/partial_benchmark.rb</span>

<span class="c1"># ...</span>

<span class="no">Benchmark</span><span class="p">.</span><span class="nf">ips</span> <span class="k">do</span> <span class="o">|</span><span class="n">x</span><span class="o">|</span>
  <span class="n">x</span><span class="p">.</span><span class="nf">time</span> <span class="o">=</span> <span class="mi">10</span>
  <span class="n">x</span><span class="p">.</span><span class="nf">warmup</span> <span class="o">=</span> <span class="mi">2</span>

  <span class="n">x</span><span class="p">.</span><span class="nf">report</span><span class="p">(</span><span class="s2">"component"</span><span class="p">)</span> <span class="p">{</span> <span class="n">controller_view</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="no">Performance</span><span class="o">::</span><span class="no">NameComponent</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">name: </span><span class="s2">"Fox Mulder"</span><span class="p">))</span> <span class="p">}</span>
  <span class="c1"># x.report("inline") { controller_view.render(Performance::InlineComponent.new(name: "Fox Mulder")) }</span>
  <span class="n">x</span><span class="p">.</span><span class="nf">report</span><span class="p">(</span><span class="s2">"partial"</span><span class="p">)</span> <span class="p">{</span> <span class="n">controller_view</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="s2">"partial"</span><span class="p">,</span> <span class="ss">name: </span><span class="s2">"Fox Mulder"</span><span class="p">)</span> <span class="p">}</span>

  <span class="n">x</span><span class="p">.</span><span class="nf">compare!</span>
<span class="k">end</span>
</code></pre></div></div>

<p>and then re-run the <code class="language-plaintext highlighter-rouge">rake</code> task. The numbers I got are:</p>

<pre><code class="language-output">Warming up --------------------------------------
           component   480.000  i/100ms
             partial    83.000  i/100ms
Calculating -------------------------------------
           component      4.665k (± 2.0%) i/s -     47.040k in  10.087090s
             partial    870.022  (± 3.1%) i/s -      8.715k in  10.027468s

Comparison:
           component:     4665.3 i/s
             partial:      870.0 i/s - 5.36x  (± 0.00) slower
</code></pre>

<p>So ViewComponents are actually 5x faster than partials. That’s half of 10x. But that’s still a significant speed improvement.</p>

<p>Is it possible that this improvement in speed comes at a cost? Perhaps in terms of memory, since ViewComponents are extra ruby classes and HTML templates that you wouldn’t have in a typical Rails application? That’s easy to test. We can improve the benchmarks to include memory usage.</p>

<p>Let’s add the <code class="language-plaintext highlighter-rouge">benchmark-memory</code> <a href="https://github.com/michaelherold/benchmark-memory">gem</a> as a new development dependency to the project, run <code class="language-plaintext highlighter-rouge">bundle</code> to install it, and update the performance script, by adding the following:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nb">require</span> <span class="s2">"benchmark/memory"</span>

<span class="no">Benchmark</span><span class="p">.</span><span class="nf">memory</span> <span class="k">do</span> <span class="o">|</span><span class="n">x</span><span class="o">|</span>
  <span class="n">x</span><span class="p">.</span><span class="nf">report</span><span class="p">(</span><span class="s2">"component"</span><span class="p">)</span> <span class="p">{</span> <span class="n">controller_view</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="no">Performance</span><span class="o">::</span><span class="no">NameComponent</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="ss">name: </span><span class="s2">"Fox Mulder"</span><span class="p">))</span> <span class="p">}</span>
  <span class="n">x</span><span class="p">.</span><span class="nf">report</span><span class="p">(</span><span class="s2">"partial"</span><span class="p">)</span> <span class="p">{</span> <span class="n">controller_view</span><span class="p">.</span><span class="nf">render</span><span class="p">(</span><span class="s2">"partial"</span><span class="p">,</span> <span class="ss">name: </span><span class="s2">"Fox Mulder"</span><span class="p">)</span> <span class="p">}</span>

  <span class="n">x</span><span class="p">.</span><span class="nf">compare!</span>
<span class="k">end</span>
</code></pre></div></div>

<p>We get the following results:</p>

<pre><code class="language-output">Calculating -------------------------------------
           component    42.256k memsize (   232.000  retained)
                       510.000  objects (     3.000  retained)
                         2.000  strings (     0.000  retained)
             partial   143.437k memsize (    80.000  retained)
                         1.682k objects (     2.000  retained)
                        18.000  strings (     0.000  retained)

Comparison:
           component:      42256 allocated
             partial:     143437 allocated - 3.39x more
</code></pre>

<p>So partials are 5x slower and use up at least 3x more memory? Wow. That’s definitely a good value proposition to consider.</p>

<p>I do have to say that there are a few things I do not like about ViewComponent, but it’s mostly a superficial thing. I do not like that we have a new directory to add view logic under <code class="language-plaintext highlighter-rouge">app/view_components</code> (in addition to <code class="language-plaintext highlighter-rouge">app/helpers</code> and <code class="language-plaintext highlighter-rouge">app/views</code>). I also don’t like that by default every component is going to have 2 new files, all organized at the same level under the <code class="language-plaintext highlighter-rouge">app/view_components</code> directory, like so:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>app/view_components/
  -- view_component1.html
  -- view_component1.rb
  -- view_component2.html
  -- view_component2.rb
  -- view_component3.html
  -- view_component3.rb
  -- view_component4.html
  -- view_component4.rb
...
  -- view_componentX.html
  -- view_componentX.rb
</code></pre></div></div>

<p>That just becomes tough on the eyes.</p>

<p>I’d like to see the performance and memory improvements somehow introduced to Rails proper. And it would be much nicer if there was consolidation on the view end of things, like perhaps getting rid of view helpers in favor of view components. That said, ViewComponent might be worth checking out if you have a complex UI. I’d recommend waiting to do so until it’s warranted. Your application might not need the performance or memory improvements. So weigh the pros and cons of introducing a new library to the projects with the benefits it provides. It could very well be that with some caching and a bit of optimization in some areas of your app, the performance needs are negated, and thus using ViewComponent not clearly beneficial.</p>

<p>One last thing to add: It’s still early for ViewComponent. I can see extra benefits surfacing as the project progresses. For example, <a href="https://primer.style/view-components/">Primer</a> is a very nascent project that introduces reusable components, similar to how Bootstrap or Flowbit/Tailwind CSS introduce UI components. Once it’s mature enough, it might help developers speed up their development time for complex UI components in Rails.</p>

<p>So be on the lookout for new features, new benefits, and other wonderful things from the Github team and ViewComponent.</p>

<p>Have you used ViewComponent? If so, how do you like it?</p>]]></content><author><name></name></author><category term="ruby-on-rails" /><category term="rails" /><category term="viewcomponent" /><summary type="html"><![CDATA[Github is one of the largest Ruby on Rails applications, with a complex infrastructure, backend, and frontend. The UI that powers Github is rich and…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/to-viewcomponent-or-not-to-viewcomponent/1.png" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/to-viewcomponent-or-not-to-viewcomponent/1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Rails: Join on polymorphic association</title><link href="https://bearandgiraffe.com/blog/rails-join-on-polymorphic-association/" rel="alternate" type="text/html" title="Rails: Join on polymorphic association" /><published>2022-10-21T19:43:26+00:00</published><updated>2022-10-21T19:43:26+00:00</updated><id>https://bearandgiraffe.com/blog/rails-join-on-polymorphic-association</id><content type="html" xml:base="https://bearandgiraffe.com/blog/rails-join-on-polymorphic-association/"><![CDATA[<figure>
  <img src="/assets/images/blog/rails-join-on-polymorphic-association/1.jpg" alt="" width="560" height="240" loading="lazy" />
</figure>

<p>I recently had to come up with a query that involved joining on a polymorphic association, so naturally I Googled how best to implement such a solution and happened upon the following 2 articles:</p>

<p><a class="link-card" href="https://veelenga.github.io/joining-polymorphic-associations/">
  <span class="link-card__title">Joining polymorphic associations in ActiveRecord</span>
  <span class="link-card__description">Polymorphic associations in ActiveRecord allow to belong to more than one model on a single associations. The mechanism…</span>
</a></p>

<p>and</p>

<p><a class="link-card" href="https://www.ananunesdasilva.com/posts/polymorphic-joins-in-activerecord">
  <span class="link-card__title">Polymorphic joins in Active Record</span>
  <span class="link-card__description">In Active Record, you can use polymorphic associations to allow a model to belong to more than one other model, on a…</span>
</a></p>

<p>and based on those articles, I chose to go with the scoped <code class="language-plaintext highlighter-rouge">belongs_to</code> solution.</p>

<p>Let’s take Ana’s example to illustrate what I mean. Given that we have the following models:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">Booking</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">belongs_to</span> <span class="ss">:bookable</span><span class="p">,</span> <span class="ss">polymorphic: </span><span class="kp">true</span>
<span class="k">end</span>
</code></pre></div></div>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">Accommodation</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">has_many</span> <span class="ss">:bookings</span><span class="p">,</span> <span class="ss">as: :bookable</span>
<span class="k">end</span>
</code></pre></div></div>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">Office</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">has_many</span> <span class="ss">:bookings</span><span class="p">,</span> <span class="ss">as: :bookable</span>
<span class="k">end</span>
</code></pre></div></div>

<p>we can update the <code class="language-plaintext highlighter-rouge">Booking</code> model to:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">Booking</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">belongs_to</span> <span class="ss">:bookable</span><span class="p">,</span> <span class="ss">polymorphic: </span><span class="kp">true</span>
  <span class="n">belongs_to</span> <span class="ss">:accommodation</span><span class="p">,</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="n">where</span><span class="p">(</span><span class="ss">bookings: </span><span class="p">{</span> <span class="ss">bookable_type: </span><span class="s1">'Accommodation'</span> <span class="p">})</span> <span class="p">},</span> <span class="ss">foreign_key: </span><span class="s1">'bookable_id'</span>
  <span class="n">belongs_to</span> <span class="ss">:office</span><span class="p">,</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="n">where</span><span class="p">(</span><span class="ss">bookings: </span><span class="p">{</span> <span class="ss">bookable_type: </span><span class="s1">'Office'</span> <span class="p">})</span> <span class="p">},</span> <span class="ss">foreign_key: </span><span class="s1">'bookable_id'</span>
<span class="k">end</span>
</code></pre></div></div>

<p>and now we can create a query that includes a nested join based on the association between <code class="language-plaintext highlighter-rouge">Booking</code> and one of the <code class="language-plaintext highlighter-rouge">bookable</code> models.</p>

<p>Example:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">User</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">has_many</span> <span class="ss">:bookings</span>
<span class="k">end</span>
</code></pre></div></div>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="no">User</span><span class="p">.</span><span class="nf">joins</span><span class="p">(</span><span class="ss">bookings: </span><span class="p">[</span> <span class="ss">:office</span> <span class="p">])</span>
  <span class="p">.</span><span class="nf">where</span><span class="p">(</span><span class="ss">offices: </span><span class="p">{</span> <span class="ss">zip_code: </span><span class="mi">90210</span> <span class="p">})</span>
</code></pre></div></div>

<p>Cool.</p>

<p>However, when implementing this solution, I ran into an issue that was not mentioned in those articles. My tests started failing with an error that looks like this:</p>

<pre><code class="language-output">ActiveRecord::StatementInvalid:
        PG::UndefinedTable: ERROR:  missing FROM-clause entry for table "bookings"
        LINE 1: ...bookings" WHERE "office"."id" = 4484 AND ...
                                                                     ^
      # [REDACTED]
      # -e:1:in `&lt;main&gt;'
      # ------------------
      # --- Caused by: ---
      # PG::UndefinedTable:
      #   ERROR:  missing FROM-clause entry for table "bookings"
      #   LINE 1: ...bookings" WHERE "office"."id" = 4484 AND  ...
      #
</code></pre>

<p>One weird thing I noticed was that the error contains references to <code class="language-plaintext highlighter-rouge">FactoryBot</code> and wondered what the connection was. It wasn’t obvious at first why my tests were suddenly failing, when they weren’t even referencing this new association or new code.</p>

<p>After staring at the issue for a couple of hours, and trying to track down the cause, I remembered that one thing that tends to cause headaches with <code class="language-plaintext highlighter-rouge">belongs_to</code> association is their <code class="language-plaintext highlighter-rouge">required</code> nature by default since Rails 5. So, I made a simple adjustment, I added the <code class="language-plaintext highlighter-rouge">optional: true</code> option to the association:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">class</span> <span class="nc">Booking</span> <span class="o">&lt;</span> <span class="no">ApplicationRecord</span>
  <span class="n">belongs_to</span> <span class="ss">:bookable</span><span class="p">,</span> <span class="ss">polymorphic: </span><span class="kp">true</span>
  <span class="o">...</span>
  <span class="n">belongs_to</span> <span class="ss">:office</span><span class="p">,</span> <span class="o">-&gt;</span> <span class="p">{</span> <span class="n">where</span><span class="p">(</span><span class="ss">bookings: </span><span class="p">{</span> <span class="ss">bookable_type: </span><span class="s1">'Office'</span> <span class="p">})</span> <span class="p">},</span> <span class="ss">foreign_key: </span><span class="s1">'bookable_id'</span><span class="p">,</span> <span class="ss">optional: </span><span class="kp">true</span>
<span class="k">end</span>
</code></pre></div></div>

<p>and everything went back to working as usual.</p>

<p>What I figured was that the original code was still creating a <code class="language-plaintext highlighter-rouge">Booking</code> record with a <code class="language-plaintext highlighter-rouge">bookable</code> association and will never directly reference the <code class="language-plaintext highlighter-rouge">office</code> association in the creation/updating process. Which means that marking that association as optional was the right approach.</p>

<p>I hope this helps.</p>

<p>Cheers!</p>]]></content><author><name></name></author><category term="ruby-on-rails" /><category term="rails" /><category term="ruby" /><summary type="html"><![CDATA[I recently had to come up with a query that involved joining on a polymorphic association, so naturally I Googled how best to implement such a solution…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/rails-join-on-polymorphic-association/1.jpg" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/rails-join-on-polymorphic-association/1.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Look Good w. B&amp;amp;G</title><link href="https://bearandgiraffe.com/blog/look-good-w-b-g/" rel="alternate" type="text/html" title="Look Good w. B&amp;amp;G" /><published>2019-05-01T16:01:00+00:00</published><updated>2019-05-01T16:01:00+00:00</updated><id>https://bearandgiraffe.com/blog/look-good-w-b-g</id><content type="html" xml:base="https://bearandgiraffe.com/blog/look-good-w-b-g/"><![CDATA[<figure>
  <img src="/assets/images/blog/look-good-w-b-g/1.png" alt="" width="1400" height="700" loading="lazy" />
</figure>

<p>Over the weekend I was asked why I am “critical” of developers. As someone who is obsessed with being better, doing better, and my own self-improvement, I am highly critical of myself. I strongly believe that each individual <em>should</em> aim to do better all of the time. What I see happen, though, is the opposite.</p>

<p>There are many anecdotes that highlight how software developers are guilty of not providing the best service they can, and underperforming on a consistent basis. I can tell you the story of a designer with no development experience, who was told by a dev that what she is asking for is too hard and would need weeks of development to accomplish, and so she went into the dev tools in her browser, made the changes, and sent them to the dev. I can tell you about being brought in to rescue a project to find that another dev had quoted a change to a WP site as “15 hours worth of work”, and how it took me about 2 hours to go through an unnecessarily massive chain of emails to figure out what the change was supposed to be, then 30 minutes to find that it was simply a matter of entering a single number in a text box on the backend. I can also tell you about the time a startup founder was quoted by a dev shop the amount of money they knew she would accept with a fine print that read, “Any items that falls outside of the scope would be charged $XXX/hr”, knowing fully well that the scope they quoted was only a fraction of the work, banking on the fact that she’d opt for the smaller proposal and then be able to take advantage of her once the contract is signed and the work started. I have a lot of stories of this kind. I do not keep a journal of them, because that would drive me mad, but sometimes I wish I could just name and shame.</p>

<p>I am critical of devs because I know the field is littered with incompetent, unprofessional people, who ruin the reputation of the many, many good folks out there doing a great job in an honest way. If you haven’t heard, Hertz is suing Accenture (<a href="https://twitter.com/ychaker/status/1121394581315182593">https://twitter.com/ychaker/status/1121394581315182593</a>) for what I believe is a symptom of exactly what I am most critical about. Not only does Accenture now become the poster child of what’s wrong in the tech service industry, sucking up large resources, while at the same time charging a lot more than those who are doing good work. I truly believe that B&amp;G would have been able to do a much better job than Accenture, while at the same time only charging a fraction of what they did.</p>

<p>I’ve had conversations with an unfortunate number of founders who have invested their life savings into a product only to get back something that does not work or match the requirements provided. These founders are then stuck because they do not have the money to pay someone like me to rescue their project, and do not have a working product good enough to gain them customers or funding.</p>

<p>I am critical of devs because I know what quality work looks like, and I’ve seen entirely too much horrendous work. I know what those who do terrible work charge for that work. And I know the trickle down effects that it has on the startup ecosystem. Most importantly, I am critical because I want to push myself to attain a higher standard. I want to set the standard of service to be so much higher than what is currently the norm.</p>

<p>On the flip side, if we work with you, we will do our best to make you look good. Ultimately that’s our goal. We want to make the folks we partner with look good to others or those they report to. Recently, on a call with a client, a bunch of folks were arguing about how hard to execute on something the CEO asked for would be. While that was happening a member of the B&amp;G team all but finished implementing the CEO’s request and then chimed in with “I’ll have it done in an hour.” We made our partner, who brought us into the project, look good in front of their client.</p>

<p>If you want to work with a team that will make you look good (to investors, shareholders, etc) and that will not nickel and dime you, B&amp;G may just be the right fit for you. Shoot us an <a href="mailto:hello@bearandgiraffe.com">email</a> and we’d love to talk to you.</p>]]></content><author><name></name></author><category term="business" /><category term="consulting" /><summary type="html"><![CDATA[Over the weekend I was asked why I am “critical” of developers. As someone who is obsessed with being better, doing better, and my own self-improvement, I…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/look-good-w-b-g/1.png" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/look-good-w-b-g/1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Rails: I18n in mailer layout</title><link href="https://bearandgiraffe.com/blog/rails-i18n-in-mailer-layout/" rel="alternate" type="text/html" title="Rails: I18n in mailer layout" /><published>2019-03-26T16:01:00+00:00</published><updated>2019-03-26T16:01:00+00:00</updated><id>https://bearandgiraffe.com/blog/rails-i18n-in-mailer-layout</id><content type="html" xml:base="https://bearandgiraffe.com/blog/rails-i18n-in-mailer-layout/"><![CDATA[<figure>
  <img src="/assets/images/blog/rails-i18n-in-mailer-layout/1.png" alt="" width="826" height="456" loading="lazy" />
</figure>

<p>Recently I had a simple task to do in a Ruby on Rails application. The style of the emails needed to show the same subject as a heading in the body of the email. Simple task, right? Sure, until you actually try it and realize that there is not a built in way to do it. It is still a quick fix, so let’s go through it.</p>

<p>The first instinct is to add a line like this to <code class="language-plaintext highlighter-rouge">views/layouts/mailer.html.erb</code> :</p>

<div class="language-erb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;h1&gt;</span><span class="cp">&lt;%=</span> <span class="no">I18n</span><span class="p">.</span><span class="nf">t</span><span class="p">(</span><span class="s1">'.subject'</span><span class="p">)</span> <span class="cp">%&gt;</span><span class="nt">&lt;/h1&gt;</span>
</code></pre></div></div>

<p>What this is supposed to do is to get the <code class="language-plaintext highlighter-rouge">subject</code> at the relative scope to where the code is being executed. Typically that would map to the <strong>file</strong> you’re calling it from and get you the correct scope. So if you had this line in <code class="language-plaintext highlighter-rouge">views/custom_mailer/notification.html.erb</code> it will look for this scope: <code class="language-plaintext highlighter-rouge">customer_mailer.noticiation.subject</code> in your <code class="language-plaintext highlighter-rouge">yml</code> file. The problem in this case is that the call to the translation is done from a layout file, and it will not pick up the scope of the final view it will be used in. So the result of our code above would be something like this: <code class="language-plaintext highlighter-rouge">Missing translation: :subject</code>.</p>

<p>So what do we do? What we will need to supply is a scope based on the mailer class and the action. Can we get those somehow? My quick instinct is to go look at the <code class="language-plaintext highlighter-rouge">ActionMailer</code> guides and see what we can come up with: <a href="https://api.rubyonrails.org/classes/ActionMailer/Base.html">https://api.rubyonrails.org/classes/ActionMailer/Base.html</a></p>

<p>After a quick glance, we see a method called <code class="language-plaintext highlighter-rouge">default_i18n_subject</code> that might be helpful. Luckily it has both things we need <code class="language-plaintext highlighter-rouge">i18n</code> and <code class="language-plaintext highlighter-rouge">subject</code>. How about them apples! This is what the code inside of that method looks like (click on “Show” to see the source):</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="k">def</span> <span class="nf">default_i18n_subject</span><span class="p">(</span><span class="n">interpolations</span> <span class="o">=</span> <span class="p">{})</span> <span class="c1"># :doc:</span>
  <span class="n">mailer_scope</span> <span class="o">=</span> <span class="nb">self</span><span class="p">.</span><span class="nf">class</span><span class="p">.</span><span class="nf">mailer_name</span><span class="p">.</span><span class="nf">tr</span><span class="p">(</span><span class="s2">"/"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">)</span>
  <span class="no">I18n</span><span class="p">.</span><span class="nf">t</span><span class="p">(</span><span class="ss">:subject</span><span class="p">,</span> <span class="n">interpolations</span><span class="p">.</span><span class="nf">merge</span><span class="p">(</span><span class="ss">scope: </span><span class="p">[</span><span class="n">mailer_scope</span><span class="p">,</span> <span class="n">action_name</span><span class="p">],</span> <span class="ss">default: </span><span class="n">action_name</span><span class="p">.</span><span class="nf">humanize</span><span class="p">))</span>
<span class="k">end</span>
</code></pre></div></div>

<p>Interesting. So that gives us a lead. The method takes in a param called <code class="language-plaintext highlighter-rouge">interpolations</code> which is probably a way to override some options to the <code class="language-plaintext highlighter-rouge">t</code> method. Let’s ignore that. What we care about is this: <code class="language-plaintext highlighter-rouge">scope: [mailer_scope, action_name]</code>. We can see that <code class="language-plaintext highlighter-rouge">mailer_scope</code> is defined right above. <code class="language-plaintext highlighter-rouge">action_name</code> however looks like a helper method that might or might not be available to us in the view. Let’s try it and see what happens.</p>

<div class="language-erb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;%</span> <span class="n">mailer_scope</span> <span class="o">=</span> <span class="nb">self</span><span class="p">.</span><span class="nf">class</span><span class="p">.</span><span class="nf">mailer_name</span><span class="p">.</span><span class="nf">tr</span><span class="p">(</span><span class="s2">"/"</span><span class="p">,</span> <span class="s2">"."</span><span class="p">)</span> <span class="cp">%&gt;</span>
<span class="nt">&lt;h1&gt;</span><span class="cp">&lt;%=</span> <span class="no">I18n</span><span class="p">.</span><span class="nf">t</span><span class="p">(</span><span class="ss">:subject</span><span class="p">,</span> <span class="ss">scope: </span><span class="p">[</span><span class="n">mailer_scope</span><span class="p">,</span> <span class="n">action_name</span><span class="p">])</span> <span class="cp">%&gt;</span><span class="nt">&lt;/h1&gt;</span>
</code></pre></div></div>

<p>Well, that doesn’t work. Why is that? hmmmm…<br />
`self.class` in the original code referred to the mailer class that inherits from <code class="language-plaintext highlighter-rouge">ActionMailer::Base</code> whereas in the view it would refer to something else, which means <code class="language-plaintext highlighter-rouge">mailer_name</code> would not be available as a method to call on it. We need another way to get the mailer name while inside of the view.</p>

<p>After a bit of googling I realized that mailers act the same way as controllers, which means that <code class="language-plaintext highlighter-rouge">action_name</code> will be available to us as a view helper BUT for some reason we do not get the <code class="language-plaintext highlighter-rouge">controller_name</code> helper 🤔. No worries, we can extract that using the following code:</p>

<div class="language-erb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="cp">&lt;%</span> <span class="n">mailer_scope</span> <span class="o">=</span> <span class="nb">self</span><span class="p">.</span><span class="nf">controller</span>
  <span class="p">.</span><span class="nf">class</span>
  <span class="p">.</span><span class="nf">name</span>
  <span class="p">.</span><span class="nf">underscore</span>
  <span class="p">.</span><span class="nf">tr</span><span class="p">(</span><span class="s1">'/'</span><span class="p">,</span> <span class="s1">'.'</span><span class="p">)</span>
<span class="cp">%&gt;</span>
</code></pre></div></div>

<div class="language-erb highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nt">&lt;h1&gt;</span>
  <span class="cp">&lt;%=</span> <span class="no">I18n</span><span class="p">.</span><span class="nf">t</span><span class="p">(</span><span class="ss">:subject</span><span class="p">,</span> <span class="ss">scope: </span><span class="p">[</span> <span class="n">mailer_scope</span><span class="p">,</span> <span class="n">action_name</span> <span class="p">])</span> <span class="cp">%&gt;</span>
<span class="nt">&lt;/h1&gt;</span>
</code></pre></div></div>

<p>There you have it, now you’re able to use scoped internationalization from inside of the mailer layout. Was that useful? What similar tricks have you used in the past? Please share in the comments.</p>]]></content><author><name></name></author><category term="ruby-on-rails" /><category term="rails" /><category term="i18n" /><category term="email" /><summary type="html"><![CDATA[Recently I had a simple task to do in a Ruby on Rails application. The style of the emails needed to show the same subject as a heading in the body of the…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/rails-i18n-in-mailer-layout/1.png" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/rails-i18n-in-mailer-layout/1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Fuck You Money</title><link href="https://bearandgiraffe.com/blog/fuck-you-money/" rel="alternate" type="text/html" title="Fuck You Money" /><published>2019-02-19T17:51:12+00:00</published><updated>2019-02-19T17:51:12+00:00</updated><id>https://bearandgiraffe.com/blog/fuck-you-money</id><content type="html" xml:base="https://bearandgiraffe.com/blog/fuck-you-money/"><![CDATA[<figure>
  <img src="/assets/images/blog/fuck-you-money/1.jpg" alt="The Position of Fuck You (John Goodman in The Gambler)" width="1280" height="720" loading="lazy" />
  <figcaption>The Position of Fuck You (John Goodman in The Gambler)</figcaption>
</figure>

<p>There are two financial concepts I keep going back to over and over and over again: “Passive Income” and “Fuck You Money”. Passive income is something I plan towards on a personal level towards a good retirement. Fuck You Money is a theme that comes up a lot on a professional level. Ironic given the term isn’t very “professional” some might say!</p>

<p>Fuck You Money is defined by the Urban Dictionary (everyone’s favorite dictionary. <strong>PS:</strong> I hadn’t gone to that site in ages so I was quite surprised with the new branding) as:</p>

<blockquote>
  <p>The exact amount of money <strong>required</strong> in order to tell an individual or <strong>organization</strong> to go fuck themselves without <strong>facing</strong> repercussions.</p>
</blockquote>

<p><em>link:</em> <a href="https://www.urbandictionary.com/define.php?term=fuck%20you%20money"><em>https://www.urbandictionary.com/define.php?term=fuck%20you%20money</em></a></p>

<p>Money.com has an extensive <a href="http://money.com/money/4187538/f-u-money-defined-how-much-calculator/">article</a> on it as well, and of course there’s a <a href="https://www.quora.com/What-is-fuck-you-money">Quora entry</a> for it. The basic premise is that you need to have enough money to get yourself out of messy situations. That could be a bad relationship with a lover, or a bad relationship with an employer, or any person you might have a financial dependency on.</p>

<p>Now why am I talking about Fuck You Money on the B&amp;G blog? No, I didn’t post this on the company blog by mistake. People typically talk about independence on the personal level, but very rarely talk about it on an organization level. Yet being in the service industry, and being a service agency beholden to the clients we serve and in some cases being at the mercy of those clients, Fuck You Money is very much a thing for a company like B&amp;G just like it is for any individual.</p>

<p>When B&amp;G was me + subcontractors, I could to some extent couple my own personal financial freedom with that of B&amp;G. If I needed to stop working with a client for whatever reason I only needed to take my own financial situation into consideration. Now that B&amp;G has 2 full time employees besides me (yup, I hired 2 full time employees in January of 2019, it’s been quite a month so far, more on that some other time), it’s no longer as simple. Now B&amp;G is responsible for the salaries of more than just me, and B&amp;G’s financial freedom is dependent on being able to pay those salaries without interruption.</p>

<p>Just like an individual, B&amp;G needs Fuck You Money to ensure its financial freedom. Being able to fire an abusive client without repercussions requires a big enough war chest to afford to halt a relationship with a paying contract, and potentially the cost of any legal ramifications that might come with it. In fact, it doesn’t even have to come down to an extreme situation of firing the client, but even just having the ability to stand up to a client that is crossing a line, which could potentially lead to a severed relationship, is difficult without said financial freedom.</p>

<p>The hope is that we screen our potential clients well enough to not have to deal with these kinds of situations, but the reality is that we won’t alway be successful in uncovering abusive behavior or how people will behave under stress and pressure.</p>

<p>It gets even more complicated once you factor in that the more you add people to the mix the more fragile a situation can become. What I mean by that is that the more people are part of a conversation the higher the chances are that anything that is said can hurt someone. Which means the more the B&amp;G team grows the higher the likelihood of an incident that needs to be dealt with. Which adds more pressure on me personally to make sure that I avoid bad situations at all costs, and to not put my team in a situation where they’d have to deal with abuse. Yet the moment we work with a client and are dependent on them paying us is the moment we’ve already put ourselves at risk. In other words, the moment I hired someone and the moment I assigned them a project with a client is the moment I put someone else at risk of being abused. That’s heavy. That’s a big responsibility.</p>

<p>The onus is on me to make sure that B&amp;G is successful enough to build a reserve of Fuck You Money for situations when a relationship with a client goes sideways. While at the same time to build a reputation that can withstand a situation where a client would want to ruin the B&amp;G name by retaliating and smearing us. What other myriad of repercussions am I even forgetting that we’d have to fortify ourselves against? I don’t know. What I do know is that we have a hill to climb, and if you’re a small business owner I hope you’re thinking about setting up some Fuck You Money of your own.</p>]]></content><author><name></name></author><category term="business" /><category term="finance" /><category term="entrepreneurship" /><summary type="html"><![CDATA[There are two financial concepts I keep going back to over and over and over again: “Passive Income” and “Fuck You Money”. Passive income is something I…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/fuck-you-money/1.jpg" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/fuck-you-money/1.jpg" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">B&amp;amp;G’s Mentorship Framework</title><link href="https://bearandgiraffe.com/blog/b-gs-mentorship-framework/" rel="alternate" type="text/html" title="B&amp;amp;G’s Mentorship Framework" /><published>2018-08-22T16:01:02+00:00</published><updated>2018-08-22T16:01:02+00:00</updated><id>https://bearandgiraffe.com/blog/b-gs-mentorship-framework</id><content type="html" xml:base="https://bearandgiraffe.com/blog/b-gs-mentorship-framework/"><![CDATA[<blockquote class="pullquote">
  <p>“I wish we could hire more junior people. small project consulting makes that hard, for us at least. if we had a product or much bigger project teams, slotting a junior person in would be so much easier.”</p>
</blockquote>

<p>That’s a message I got through chat from someone I know. And while I understand the source of it, I want to challenge everyone to flip the scenario. I’ve been delaying writing about this for a long time, for reasons I’ll tackle in a bit, but this comment pushed me to just do it. Not because the person who said it is wrong, but because I feel the need to promote a counterexample.</p>

<p>Part of why I have delayed talking about this publicly is because I wanted to do it when I have an undeniable success story that I can share. Ironically I am compelled to talk about my experience with Jr. Devs on the back of a huge loss and failure. So here it goes…</p>

<p>In previous posts (<a href="/blog/proud-bear/">here</a> and <a href="/blog/mentoring/">here</a>) I’ve written about my mentoring work through B&amp;G. Mentoring is what we do at B&amp;G. In 2018 alone, up to this point, I have been the only Sr. level engineer and mentor at B&amp;G but I have worked with and mentored 3 Jr. Devs as my direct contractors, 2 dev interns hired by a client, and 1 UX intern hired by another client. All while running and delivering on projects as a consultant in the role of either Software Architect or Fractional CTO to 4 clients. So here’s how it all happened, from the beginning:</p>

<h2 id="2015">2015</h2>

<p>In 2015 I left a job at a company where I was climbing up the ladder and could have had the “power” I wanted along with the comfort of being a salaried employee in a multi-million dollar company, because of a toxic culture. But at that job is where I had my first crack at mentoring, and being successful at it (imo).</p>

<p>The company was interviewing candidates and I got the opportunity to meet a couple of the candidates that were being considered at a hackathon. The dev manager and another manager were heavily leaning towards one candidate, and heavily opposed to another. I was of the complete opposite opinion. The person they were favoring seemed to me like a mistake waiting to happen, whereas the person they were opposed to seemed to me like the most qualified person we could land at the company. To me, it was clear this candidate had the highest potential to be one of the most productive employees at the company. This candidate was a workhorse. So I fought hard to make a case for hiring them, and eventually the company hired both.</p>

<p>I took on the responsibility for, Jad, the hire I advocated. Jad sat next to me in our open office, and at that point, I had unofficially started my own mentorship program within the company. At the time, I was not in a senior position, so taking that step was a risk. I spent 3 months molding my apprentice. I used pairing heavily. I used code reviews. I was tough, because I knew that Jad could handle tough constructive criticism and being pushed. Ultimately, Jad became one of the most productive devs in the company and earned the respect of everyone on the team and management alike. Jad is someone I could rely on and trust completely. The other dev, btw, was a complete dud.</p>

<p>When I left the company in 2015 I wanted to recreate that experience I had with Jad, but at a bigger scale. I wanted to be in a place where I could set a certain culture of collaboration and respect to everyone, and I wanted the company I work at to be a place that welcomes women, minorities, and any “outcast”, unlike the last company I worked at, which gave me bad reviews for putting on noise canceling headphones because I liked to concentrate while coding in a distracting open office setting.</p>

<p>That’s when I decided that the only way for me to achieve all of that is to start my own company. That’s when B&amp;G was born.</p>

<h2 id="2016">2016</h2>

<p>From 2011 to 2015 I was living as a digital nomad, going from one place to another. In 2015 I moved back to the US, wanting to settle down. I got married, started my own company, and moved to Austin, a part of the world I didn’t know much about and knew no one. So in 2016 I took the time to establish myself, and place some seeds to form some roots for my new life.</p>

<p>I worked for most of 2016 on one single project, as a lone dev. Trying to pay the bills and establish some sort of track record for B&amp;G. I also spent a lot of time going and participating in local groups like <a href="http://www.austinonrails.org">Austin on Rails</a> and <a href="http://austinrb.org">AustinRB</a>.</p>

<p>Towards the end of the year, I met Naghmeh. Naghmeh had just graduated from a local dev bootcamp and was having a hard time finding a job as a developer.</p>

<p>I offered to help Naghmeh. I figured I’d answer any technical questions she had, do some interview prep, etc. I didn’t have a project to staff her on, and I didn’t have the resources to support a full fledged apprenticeship program.</p>

<p>Then, I was approached by an entrepreneur who wanted to hire a consultant to build a product for his startup. As many of these stories go, the entrepreneur didn’t have the money to pay the (very low) rate I was asking for, so I figured this small consulting gig would be a great opportunity to devise something for Naghmeh. I could charge a lower rate since the work would be done by a Jr. Dev. Ultimately, the relationship is symbiotic. The work gets done, which is a win for the startup, and Naghmeh gets some form of a real world experience under her belt. The risk for me was low because the project was simple enough that if anything did go wrong I would have been able to step in and salvage it by working late nights on it. At the same time, however, it was simple enough that I could set Naghmeh up for success by providing all of the pieces and planning required to simplify the job.</p>

<p>Naghmeh did an awesome job. The product got built. She learned a few things. But eventually, work dried up for me. I didn’t have projects for myself to work on and neither for her.</p>

<h2 id="2017">2017</h2>

<p>2017 started very slow, and since Naghmeh is a mom and needed something that could provide the type of benefits her family needs, she went on the hunt for a permanent position and was able to leverage her experience with B&amp;G to find a job.</p>

<p>At this point I had a lot to consider. New companies struggle to get over the 2 year hump. Many say if you can make it past the first 2 years you should have a good chance of making it. The Small Business Association stats indicate that 30% of businesses fail in the first 2 years (<a href="https://www.sba.gov/sites/default/files/SurvivalRatesAndFirmAge_ADA_0.pdf">source</a>). That’s a lot! So while I was trying to make sure B&amp;G survives, I was considering what effects would a repeat scenario like Naghmeh’s would have on the company and on the apprentice.</p>

<p>The decision I took was based on the following answers to these questions:</p>

<p>\1. Would a potential hire/apprentice be comfortable working with me and take on a temporary gig?</p>

<p>What I could presume is that someone who graduated a bootcamp and has been searching for a job for a while, many months in some cases, would welcome this opportunity as opposed to sitting idly. Some people would have an easier time with this arrangement than others, so I might be favoring someone who is privileged enough to not need insurance or any of the benefits you would get at a full time job. On the other hand, that’s all I could offer and felt that some form of work and payment is better than none. Especially since the demographic I was targeting was females making a career change into software development, and that is an under-served group. My goals were always to grow enough to be able to then provide everything I wish I could provide, but this would be a stepping stone towards that.</p>

<p>\2. What’s the cost to B&amp;G and me for doing this?</p>

<p>There’s a lot involved in this answer.</p>

<p><strong>Time:</strong> It takes a lot of time to mentor and train and manage a Jr. Dev. Would I have time to do it? I’ll make time. Can I afford to take time away from something else I could do for this? It’s a sacrifice I would happily make.</p>

<p><strong>Financial:</strong> Would I be doing this for free and would it be costing me money? The plan was that if I would do this again I would do it with someone who could be independent and take responsibility of their own development. They would spend a couple of weeks getting up to speed using resources I would provide. Frequent pairing sessions of an hour or two would help make sure some basic concepts are familiar. Then I would assign the person a project to work on which would be a billable project where they would be making B&amp;G the money that would pay their hourly rate and also compensate me a tiny bit for the investment I’m putting into the Jr. Dev. It wasn’t going to make me rich or anything, but it would allow me to do it without going broke myself.</p>

<p><strong>Turnover:</strong> What would it mean if this apprentice left and took a job somewhere else? Win-win for everyone. If I can’t hire them permanently and they are able to leverage what they did at B&amp;G to find a new job, I consider that as a win for everyone. I would have gotten to do what I wanted to do, mentor, as well as affording me the opportunity to work with a client I might have not been able to land otherwise. The apprentice gets to use B&amp;G as a bridge between the bootcamp and the next job. The new company gets to hire someone who’s better ready for that job. Many would say that investing in a person who then leaves is a waste, I don’t subscribe to that kind of mentality.</p>

<p><strong>Scenarios:</strong> What’s the worst case scenario? I contract someone who turns up to be a bad fit, does not perform the work they’re supposed to, tarnishes B&amp;G’s name, and ruins a relationship with a client. I expect this will happen at some point, I don’t think anyone or any company/agency is **** from this. It’s also a risk I’m willing to take if that’s what it would take to give to the community in the way of mentoring Jr. Devs. What’s the best case scenario? I find a person I want to work with for a long time, I’m able to work with this person on multiple projects and B&amp;G grows so this person becomes part of the foundation for B&amp;G to be able to hire them and others and take on more works and more clients.</p>

<p>So all in all, from the perspective of the apprentice, as long as I am completely honest with them about the expectations they should be able to make an informed decision on whether this is a good fit for them or not. And from the company’s perspective, there are risks that I am willing to take for the sake of building towards achieving the company goals.</p>

<p>That said, 2017 became the year where I would put all of this to a test.</p>

<p>In July 2017 I started working with Sam. Sam picked up coding on her own while being a stay at home mom. She has a background in mechanical engineering, and took time off to give birth and take care of her baby. While doing that she had an idea and to implement it started learning coding on her own and picked up Ruby on Rails. The situation with Sam was very convenient, she did not need the bells and whistles of a full time job. Her situation allowed her to take a chance on me, she needed the kind of flexibility I was offering that other jobs weren’t because her kid was not yet in school full time so being able to work part time was convenient to her, and not many companies want to hire a Jr. Dev on a part time basis.</p>

<p>The first few months with Sam were relatively easy. I was involved in the project she was working on, and I was performing code reviews, and we would set up pairing sessions when needed, but for the most part Sam was independent enough that it felt like I was able to put the process in cruise control and we would all be fine. So much so that I started looking for other women to work with in parallel. I’ll come back to Sam in a bit, but first the next story.</p>

<p>Since things were going well with Sam, I started interviewing other candidates to grow the team. The plan I had started working on is the ability to groom someone that would take over some of the coding responsibilities I had with a client that would free me to focus on mentoring and building a team as well as some biz dev to get some more clients. So I hired Sarah to work on a mini project as a way to test out the relationship at a low cost. The project was paid for by B&amp;G and not a client, but used a real world scenario type of project so it mimicked a real project. Sarah was great, but she had student debt and other responsibilities so understandably she chose to take a job with a big company for the stability.</p>

<p>Let’s do a recount: So far B&amp;G has taken in 3 Jr. Devs, 2 of them have gone on to find full time jobs and 1 is still with B&amp;G up to this point. In fact, all 3 had received job offers at this juncture, and all 3 would tell you that the offers came because of their experience working with B&amp;G. That’s a huge win in my book. Saying that B&amp;G served as a bridge for 3 women to find jobs in tech is in fact the mission I set out to achieve.</p>

<p>Back to Sam. She did receive job offers to work for other companies, on a full time basis, with everything that comes with that. She chose to stay with B&amp;G. That was a great boost of confidence, and pushed me to keep going. Sam finished 2017 on the B&amp;G roster and contributed to a couple of projects.</p>

<p>2017 was a pilot year for B&amp;G’s mentorship program. A program still in its infancy but that is developing while pushing the limits and doing something rare in the industry.</p>

<h2 id="2018">2018</h2>

<p>2018 started with the goal of building upon the progress made in 2017 and the knowledge gained from the experiments done during that year.</p>

<h3 id="lessons-learnt">Lessons Learnt</h3>

<ol>
  <li>This is the path that I want to guide B&amp;G on, even if that requires more work and would cost more money.</li>
  <li>Many people and startup founders are still ignorant to the cost of software development and wouldn’t be able to afford most agency rates. Being able to provide the same services of a lower rate is one way to build a portfolio of clients without lowering the value of my own hourly rate.</li>
  <li>When targeting women founded or lead startups, having a female oriented mission is valuable and attractive.</li>
  <li>To support scaling I would need to scale some of the mentoring processes. For example, getting up to speed on the basic of Ruby and Ruby on Rails should not consume all of my time and should be delegated (to books in my case).</li>
  <li>I can’t target high value projects and high profile clients with an entirely Jr. level team. Which means leaving some money on the table.</li>
  <li>Scaling without another Sr. Dev on the team that can mentor will be hard, or without a dedicated Biz Dev person who can streamline the pipeline of projects coming in. Something I still have not figured out.</li>
  <li>The probability is high that anyone that comes through the program will leave within the first 3 months.</li>
  <li>The potential target for the program is someone will value the flexibility of the environment at B&amp;G over benefits (like insurance and paid time off), since they will be subcontractors and not full time hires (at least at the beginning).</li>
</ol>

<p>Keeping all of that in mind, I started 2018 hoping to stabilize some basic things, as well as completely switching the offerings of B&amp;G from selling my personal time to selling B&amp;G as a company and a team. The majority of 2017 was spent where I was working full time on one particular project, and Sam working on another. I could not successfully remove myself from the coder role on that project and replace myself with someone else while transitioning into a mentor and/or manager or CTO type of role. So I set out in 2018 to go after jobs that would not bind me in such a role again, which would free me to support mentoring multiple people on multiple projects.</p>

<p>I spent a bunch of time in early 2018 hunting for work and projects, while in parallel interviewing potential candidates to hire as contractors to start the mentorship process.</p>

<p>The first person I took onboard, we shall call them “Person A”*, was a great target. A female, parent who spent a lot of time making decisions based on their child’s needs instead of her own, who went through a bootcamp for a career change into tech, and who was struggling to get an opportunity. I did also have the perfect project that fit her skills. So, I started implementing the same process I used in previous cases. Mainly letting the Jr. Dev jump into the deep end of the pool, test their ability to float on their own, and assist when they can’t. While also making it a gradual process, can you float on your own? can you float while holding a 1lb object? how about 5lbs? How about while holding the object above your head and keeping it above water?</p>

<p>Soon enough I found out that “Person A” was not ready to be put in the situation I put her in. I needed to ease her into the needs of the job, so I pulled back and started over again by providing some educational resources to go through first, before attempting to write any production code. I also spent many long pairing sessions talking about the basics. That was the hardest challenge. Especially since while all of this was happening, I needed to staff the project “Person A” was supposed to be working on with someone else. In the meantime, I took on the responsibility of the coding, which is exactly NOT what I wanted to do.</p>

<p>Because of the experience I had gone through with “Person A”, I decided to switch up the approach a bit when hiring other people. I decided that what I would do is open up the selection to anyone who fit a small set of criteria:</p>

<ol>
  <li>Is the person a female or member of minority group?</li>
  <li>Did you get into tech through a non traditional path?</li>
  <li>Can I talk to you and have a conversation with you? (Necessary for mentoring, I can’t mentor someone I can’t talk to. D’oh!)</li>
  <li>Are you able to dedicate sufficient amount of time per week to B&amp;G (over 16 hours) and will you be able to go without pay or benefits for an extended period of time?</li>
</ol>

<p>The first 2 criteria are aligned with the B&amp;G mission of helping underserved communities get into tech. #3 is necessary for me to be able to give a lot of my time for the development of a person I don’t know very well. #4 is a criteria I hope to get rid of but is necessary at this stage of B&amp;G’s growth, I am hiring the devs as contractors so benefits would not be included, and the initial phase will focus on learning outside of the scope of a paid project, so would not be paid time. I am fully aware that #4 contradicts in some way the mission to help underprivileged folks, and is something that bothers me a lot, which is why in “Person A”’s case I paid her for multiple months even though she was not contributing to billable work. But it’s not something I would be able to do for multiple people at the same time at the current stage.</p>

<p>With the new framework I contracted two new Jr. Devs, “Person B” and Sherry. I interviewed a few more people, most of them didn’t fit criteria #4 (it bothers me a lot that this is the case), and a small percentage did not fit criteria #3.</p>

<p>“Person B” was promising, but got offered a full time job within the first 2 weeks of contracting her and she decided to take the full time job. Student debt is a mother****er. Sherry on the other hand has become an instrumental part of the team. She is doing great work and learning (I assume 🤔) a lot on the way.</p>

<p>That is not all though. Summer of 2018 was action packed. One client hired 2 dev interns who are still in their first years of college, that became my responsibility to mentor and manage. Another client hired 2 interns as well, one of them, a UX intern, became partially my responsibility as well. Which meant that while everyone was on boats in Lake Austin during the summer I was managing and mentoring 6 Jr. Devs/interns.</p>

<p>At this point I had to have the hard talk with “Person A”, telling her that B&amp;G was not a good fit for her needs as she needed a place that would give her more time and stability to be able to grow, and the ability to provide more 1 on 1 attention, which I was not able to provide given my workload. So although I was down to <em>only</em> 5 Jr. Devs/interns, it was still an eventful summer. It involved too many PRs for my liking, too many lines of code badly indented and unreadable, and too many conversation about very basic stuff, so much that I wish now there was a pill that people could swallow and they would gain all of the basic common knowledge about how the web functions. In fact, the Jr. Devs and interns weren’t the only people I had to explain some basic concepts to, there were CEOs, CMOs, COOs, CCOs, you name it, in the mix as well. And do you think all of those people were together in one room when I had to explain the same things to all of them? Of course not, it wouldn’t be my life if things were this easy!</p>

<p>Back to mentoring Jr. Devs though, after the summer experience I would add a new criteria to the list when considering who to hire:</p>

<p>\5. Possess the ability to produce some kind of code independently. If the person can write some code without my direct involvement through every second of it, then I am able to assign them some billable tasks, and that helps. Otherwise, getting them up to that level is beyond the scope of what B&amp;G and I can handle at the moment.</p>

<p>I also learned the following things through that experience:</p>

<ol>
  <li>Know what to prioritize while reviewing a PR. <strong><em>Some</em></strong> cases require to value progress over producing perfect code.</li>
  <li>Never stop being positive and encouraging while giving feedback. Even if the person receiving it has been around for a while and understand that code reviews are about the code and not the person AND even though most of the feedback is neutral or constructive, that’s not enough.</li>
  <li>Don’t lose perspective in regards to time. Someone who has done a great job and has become a person you rely on is still someone whose experience on the job is limited (2 years or less in most cases), and to project the same expectations you’d have of someone who had been doing this for 10 years is unfair.</li>
</ol>

<p>That, in a very long and excruciating detail, is the story of B&amp;G’s mentorship program. A program that started ad-hoc and has slowly transformed into a framework that will continue to develop.</p>

<p>This framework is available to others outside of the B&amp;G team, as a service I provide to companies that can hire me as a mentor for a Jr. Dev they are considering to hire but do not have the internal resources to provide the proper mentorship. There are many companies with openings looking to hire devs and cannot find someone at a Sr. level, hiring a Jr. Dev is a great alternative. The company would be providing an opportunity to someone who would appreciate it, which would build loyalty. It is a much cheaper alternative, since any new hire would need up to 6 months to get up to speed on the ways of the new company regardless experience level, and within those 6 months a Jr. Dev could reach a level of productivity that is profitable for the company considering their salary level (even including the cost of hiring an external mentor).</p>

<p>The offer of mentorship is also available to members of the community who fit all 5 criteria, but given the cost of doing something like this with no return I would be stricter on assessing and applying those criteria. So if you are in Austin, and have interacted with me a bunch, and would like me to be your mentor, do reach out, the answer could be a Yes!</p>

<p><strong>Side note:</strong> While everything was happening in 2017-2018 (including many other not directly related things), one other case did take place. Nikita is someone I met and knew would be a perfect fit for B&amp;G had B&amp;G been an established company with everything in place the way I envision it to be. A few missing pieces from B&amp;G’s side made it a bad fit at the time, and of course criteria #4 was not a fit (DAMN IT!). So I mentored Nikita in a different way than the rest. I helped her throughout the interview process as she was hunting for a job. Nikita is part of the B&amp;G family.</p>

<p><strong>*:</strong> I have kept individuals who were part of a failed story anonymous out of respect to the individuals. The failures aren’t theirs to own and that should not be part of their “online profile”, but they are B&amp;G’s failures and I will continue to be transparent about them.</p>]]></content><author><name></name></author><category term="mentorship" /><category term="mentorship" /><summary type="html"><![CDATA[That’s a message I got through chat from someone I know. And while I understand the source of it, I want to challenge everyone to flip the scenario. I’ve…]]></summary></entry><entry><title type="html">B&amp;amp;G Gets Top Marks as a Developer on Clutch!</title><link href="https://bearandgiraffe.com/blog/b-g-gets-top-marks-as-a-developer-on-clutch/" rel="alternate" type="text/html" title="B&amp;amp;G Gets Top Marks as a Developer on Clutch!" /><published>2018-06-05T15:56:42+00:00</published><updated>2018-06-05T15:56:42+00:00</updated><id>https://bearandgiraffe.com/blog/b-g-gets-top-marks-as-a-developer-on-clutch</id><content type="html" xml:base="https://bearandgiraffe.com/blog/b-g-gets-top-marks-as-a-developer-on-clutch/"><![CDATA[<figure>
  <img src="/assets/images/blog/b-g-gets-top-marks-as-a-developer-on-clutch/1.png" alt="" width="1183" height="497" loading="lazy" />
</figure>

<p>Behind every great project, idea, or platform requires the proper development. Here at B&amp;G that is what we do best, and it would seem some others would agree! We are proud to announce our recent inclusion in <a href="https://clutch.co/press-releases/top-business-services-companies-austin">Clutch’s press release</a>! Clutch is a Washington, D.C. based ratings and reviews marketplace. Clutch conducts client reviews with past and current clients to obtain an accurate understanding of the type of service provided by companies.</p>

<p>Clutch performs these client reviews primarily through the medium of interview style phone calls. Clutch then compiles all of these reviews along with their ranking system to identify top industry leaders along a number of segments and locations. We have been highlighted as one<br />
of their top <a href="https://clutch.co/web-developers/austin">web developers in Austin</a>!</p>

<p>We have also been highlighted as one of the leading <a href="https://themanifest.com/web-development/companies/austin">web developers</a> on Clutch’s sister site, The Manifest. This profile of B&amp;G features our clients and an overview of our recent projects. And while we do truly dive into web development, we aren’t the kind of company to limit ourselves. We have also been identified as a leader in Ruby on Rails development!</p>

<figure>
  <img src="/assets/images/blog/b-g-gets-top-marks-as-a-developer-on-clutch/2.png" alt="" width="1480" height="1600" loading="lazy" />
</figure>

<p>One of our clients detailed their experience with our ruby on rails development by stating, “If someone is going to build something out in Rails, you want [Bear &amp; Giraffe] to do it.”, to go along with this feedback another client stated, “They really understand what’s required to build a fast product in today’s marketplace.” This understanding of the market comes in hand<br />
with being a leader along all three of these types of development.</p>

<p>We have also been very pleased with the other feedback that we have received from our clients on Clutch! One of our clients stated, “[Youssef] has a high attention to detail. He’s one of the most professional people. He’s proactive, responsive, and has the experience under his belt of how to be a really good service provider. I give nothing but top marks.” This feedback mirrors<br />
another one of our clients who stated, “We’re not Youssef’s only client, but he makes us feel that way.”</p>

<p>We strive to make each and every one of <a href="/#services">our clients</a> feel heard and special. That is our mission at B&amp;G, and we are very pleased to see that this mission has been noticed and felt by our clients. If you want to hear even more, be sure to check out our <a href="https://clutch.co/profile/bear-giraffe">full profile</a> on Clutch’s site!</p>]]></content><author><name></name></author><category term="business" /><category term="rails" /><category term="consulting" /><category term="austin" /><summary type="html"><![CDATA[Behind every great project, idea, or platform requires the proper development. Here at B&G that is what we do best, and it would seem some others would…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/b-g-gets-top-marks-as-a-developer-on-clutch/1.png" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/b-g-gets-top-marks-as-a-developer-on-clutch/1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">Stop Pending Steps From Failing Your CI Build</title><link href="https://bearandgiraffe.com/blog/stop-pending-steps-from-failing-your-ci-build/" rel="alternate" type="text/html" title="Stop Pending Steps From Failing Your CI Build" /><published>2018-04-23T21:54:09+00:00</published><updated>2018-04-23T21:54:09+00:00</updated><id>https://bearandgiraffe.com/blog/stop-pending-steps-from-failing-your-ci-build</id><content type="html" xml:base="https://bearandgiraffe.com/blog/stop-pending-steps-from-failing-your-ci-build/"><![CDATA[<figure>
  <img src="/assets/images/blog/stop-pending-steps-from-failing-your-ci-build/1.png" alt="" width="800" height="326" loading="lazy" />
</figure>

<p>TDD is a big part of how I develop software. I use TDD to help me design the software I’m writing as well as serve as a to-do list for the things that need to be built for the app. That means that sometimes I write tests for things that I know I want to include but not at the moment. These are smaller steps of the bigger feature but possibly not the core functionality. For example, I might want to track some events and I want to keep a reminder of myself not to forget that step, but at the moment I want to focus on the main feature itself and then add the tracking part once I’ve got the basic stuff working.</p>

<p>To make that work, I write pending tests that will show that they are pending in the output. That said, I typically do not want a pending test to fail the test suite. Especially in a new app that has a bunch of core things that need to be built first, before getting to some of the fringe items like event tracking. This workflow works well in my opinion, except for one gotcha, which I will cover in this post.</p>

<p>If you are using <code class="language-plaintext highlighter-rouge">Cucumber</code> and <code class="language-plaintext highlighter-rouge">CircleCI</code> and running the suite using the typical command <code class="language-plaintext highlighter-rouge">bundler exec cucumber</code> you might see something like this at the end of the run:</p>

<div class="language-ruby highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="mi">10</span> <span class="n">scenarios</span> <span class="p">(</span><span class="mi">0</span> <span class="n">undefined</span><span class="p">,</span> <span class="mi">1</span> <span class="n">pending</span><span class="p">,</span> <span class="mi">9</span> <span class="n">passed</span><span class="p">)</span>
<span class="mi">120</span> <span class="n">steps</span> <span class="p">(</span><span class="mi">0</span> <span class="n">undefined</span><span class="p">,</span> <span class="mi">1</span> <span class="n">pending</span><span class="p">,</span> <span class="mi">119</span> <span class="n">passed</span><span class="p">)</span>
<span class="mi">0</span><span class="n">m17</span><span class="o">.</span><span class="mi">414</span><span class="n">s</span>

<span class="no">You</span> <span class="n">can</span> <span class="n">implement</span> <span class="n">step</span> <span class="n">definitions</span> <span class="k">for</span> <span class="n">undefined</span> <span class="n">steps</span> <span class="n">with</span> <span class="n">these</span> <span class="ss">snippets:

</span><span class="no">Then</span><span class="p">(</span><span class="s2">"foo"</span><span class="p">)</span> <span class="k">do</span>
  <span class="n">pending</span> <span class="c1"># Write code here that turns the phrase above into concrete actions</span>
<span class="k">end</span>

<span class="no">Coverage</span> <span class="n">report</span> <span class="n">generated</span> <span class="k">for</span> <span class="no">Cucumber</span> <span class="no">Features</span><span class="p">,</span> <span class="no">MiniTest</span> <span class="n">to</span> <span class="sr">/home/</span><span class="n">circleci</span><span class="o">/</span><span class="n">project</span><span class="o">/</span><span class="n">coverage</span><span class="o">.</span> <span class="mi">968</span> <span class="o">/</span> <span class="mi">1064</span> <span class="no">LOC</span> <span class="p">(</span><span class="mf">90.98</span><span class="o">%</span><span class="p">)</span> <span class="n">covered</span><span class="o">.</span>
<span class="no">Exited</span> <span class="n">with</span> <span class="n">code</span> <span class="mi">1</span>
</code></pre></div></div>

<p>And while you do not have any failing tests, the build is marked as failing and in red. How come?</p>

<p>The last line gives us a hint. The fact that <code class="language-plaintext highlighter-rouge">cucumber</code> returned an exit code of <code class="language-plaintext highlighter-rouge">1</code>, as pointed out in the <code class="language-plaintext highlighter-rouge">Exited with code 1</code> line of the output of the run, is the reason why <code class="language-plaintext highlighter-rouge">CircleCI</code> has marked the build as failed. So if you’d like your build to pass even though you’ve got pending steps, you need to change the output from cucumber to be a <code class="language-plaintext highlighter-rouge">0</code> instead of <code class="language-plaintext highlighter-rouge">1</code>.</p>

<p>Cucumber has the option <code class="language-plaintext highlighter-rouge">--[no-]strict</code> that you can use to make it exit with a code <code class="language-plaintext highlighter-rouge">0</code> instead of <code class="language-plaintext highlighter-rouge">1</code> for a bunch of scenarios. The flag is set to be on by default (i.e <code class="language-plaintext highlighter-rouge">--strict</code>) which means it returns a <code class="language-plaintext highlighter-rouge">1</code> and if you turn it off it would return a <code class="language-plaintext highlighter-rouge">0</code>. The scenarios that are grouped under the general <code class="language-plaintext highlighter-rouge">strict</code> flag are <code class="language-plaintext highlighter-rouge">undefined</code>, <code class="language-plaintext highlighter-rouge">pending</code>, and <code class="language-plaintext highlighter-rouge">flaky</code>. I personally only want it to skip <code class="language-plaintext highlighter-rouge">pending</code> steps because those are purposefully left unimplemented. In that case I can use <code class="language-plaintext highlighter-rouge">--no-string-pending</code> as the flag. I learned about these flags from the PR: <a href="https://github.com/cucumber/cucumber-ruby/pull/1169">https://github.com/cucumber/cucumber-ruby/pull/1169</a>.</p>

<p>Now that we are aware of the flag to use, we can just update the config for CircleCI and push the changes up and see if that works. But builds take a while to finish, and I wanted to make sure that this would work before pushing it up to CircleCI. One problem though: the terminal does not print out the exit codes of each command you run, that would be silly. So how can I make sure that the flag does what I want then? I remembered a <a href="https://www.rubytapas.com/2017/08/07/episode-491-special-variables-part-1/">RubyTapas episode</a> in which Avdi talks about system variables like $1, $?, $! and others and how to use them in Ruby. I knew one of them contains the exit code of the previous process, I just needed to find out which one and then print it out in the terminal after executing the <code class="language-plaintext highlighter-rouge">cucumber</code> command with and without the flag and see if that made any difference. Turns out <code class="language-plaintext highlighter-rouge">$?</code> is the one.</p>

<p>So I ran the following:</p>

<div class="language-console highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="gp">ychaker ~/dev/app$</span><span class="w"> </span>be cucumber
<span class="gp">ychaker ~/dev/app$</span><span class="w"> </span><span class="nb">echo</span> <span class="nv">$?</span>
<span class="go">1
</span><span class="gp">ychaker ~/dev/app$</span><span class="w"> </span>be cucumber <span class="nt">--no-strict-pending</span>
<span class="gp">ychaker ~/dev/app$</span><span class="w"> </span><span class="nb">echo</span> <span class="nv">$?</span>
<span class="go">0
</span></code></pre></div></div>

<p>which validates that adding the <code class="language-plaintext highlighter-rouge">--no-strict-pending</code> flag will help resolve the issue of marking the build as failed on CircleCI. After changing the CircleCI config to:</p>

<div class="language-yaml highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="pi">-</span> <span class="na">run</span><span class="pi">:</span>
    <span class="na">name</span><span class="pi">:</span> <span class="s">Run cucumber tests</span>
    <span class="na">command</span><span class="pi">:</span> <span class="s">bundle exec cucumber --no-strict-pending</span>
</code></pre></div></div>

<p>the build started passing.</p>

<p>There you go. That’s the trick. Some times it’s important to know that something exists, or that there’s a tool out there that you can leverage in certain scenarios, even if you’re not an expert in it. As long as you know what to look for, you can then figure it out. Half the battle is knowing what you don’t know so that you can learn it.</p>]]></content><author><name></name></author><category term="engineering" /><category term="testing" /><category term="ci-cd" /><summary type="html"><![CDATA[TDD is a big part of how I develop software. I use TDD to help me design the software I’m writing as well as serve as a to-do list for the things that…]]></summary><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://bearandgiraffe.com/assets/images/blog/stop-pending-steps-from-failing-your-ci-build/1.png" /><media:content medium="image" url="https://bearandgiraffe.com/assets/images/blog/stop-pending-steps-from-failing-your-ci-build/1.png" xmlns:media="http://search.yahoo.com/mrss/" /></entry><entry><title type="html">#DRAAAMS!</title><link href="https://bearandgiraffe.com/blog/draaams/" rel="alternate" type="text/html" title="#DRAAAMS!" /><published>2018-04-20T23:19:06+00:00</published><updated>2018-04-20T23:19:06+00:00</updated><id>https://bearandgiraffe.com/blog/draaams</id><content type="html" xml:base="https://bearandgiraffe.com/blog/draaams/"><![CDATA[<p>It is Friday evening, I just spent my entire afternoon on drama instead of being productive and working on billable stuff. Yet this time of drama is actually directly related to the work I do and why it really matters to me to be involved and help be part of a solution.</p>

<h2 id="context">Context</h2>

<p><a href="https://rubytogether.org">RubyTogether</a> is an organization that was created to help make sure that Ruby and all of the infrastructure that the Ruby community depends on can be sustained for a long time. We’ve got a <a href="/blog/the-cost-of-ruby/">post</a> that was published a while back on this blog that goes deeper in detail on what that means, I suggest you check that out before continue reading this.</p>

<p>When B&amp;G joined RT, it was primarily because of the mission behind the organization, but also because it had some legitimacy solely based on the people who were part of the board, which included Aaron Patterson and スティーブ クラブ肉 (Steve Klabnik). The only reason these names mattered is because there was no other metric available to judge the legitimacy of the organization and make sure it’s not someone’s ruse to scam people out of their money to fund their own work.</p>

<h2 id="the-trigger">The Trigger</h2>

<p>Speaking of someone funding their own work, a prominent member of the Ruby community came out with this blog post with a title that was bound to stir up some drama: <a href="https://samphippen.com/why-im-declining-funding-from-ruby-together/">Why I’m declining funding from Ruby Together</a>.</p>

<p><strong>Update [2018–04–22]:</strong> Sam announced on twitter in this <a href="https://twitter.com/samphippen/status/987843354011586560">tweet</a> that he has removed his original post in favor of the communication that is happening through other means. This is a good sign that things are progressing and the issues are being addressed.</p>

<p>In the blog post, Sam Phippen explains some of the issues that have been boiling up in recent months around the whole organization. One of the issues that Sam brings up is the possible conflict of interest surrounding the director of RubyTogether, André who is the main contributor to Bundler, and hence the main recipient of funds from RT.</p>

<p>Typical to how society functions today, a Twitter drama ensued. Many people chimed in with their own perspective. You can follow some of that in this Twitter Moment: <a href="https://twitter.com/i/moments/987413824931278852">https://twitter.com/i/moments/987413824931278852</a>, make sure to click on the tweets and read the threads, and not just what’s on the surface.</p>

<h2 id="next-steps">Next Steps</h2>

<p>I believe people like Sam and Aaron have valid concerns. I also believe André when he says he has tried to address those concerns. I understand why the initial step that was taken was done in secret, but I do also think that it’s time this gets dealt with in a transparent way.</p>

<p>The reason why we need transparency is in the nature of the organization itself. It’s a non-profit organization that is funded by membership dues. The board is elected by the members and it’s their right to know who they are putting in charge of the organization. In addition to that, the organization is meant to serve an open source community and takes actions that affect the entire community and not just the paying members.</p>

<p>Most importantly though, the key to success moving forward is having a willingness to communicate with one another in a respectful and open minded way. Something I believe both parties have failed at in this situation. Letters that look and feel like something a lawyer would send are bound to have an adverse reaction to them. On the other hand, blocking people on Twitter is not conducive to keeping a communication channel open. But that’s in the past, the question is can we hit a reset button and start again a conversation that is amicable and positive? Can both sides agree that we’re all working for the same goals, we all believe in the same mission and want RT to succeed, therefore should try to prioritize that over any personal feelings?</p>

<p><strong>My 2 cents:</strong> for RT to succeed we need to find people who are not as invested in the personal aspect of this conversation to lead and mediate the conversation. Maybe even lead RT altogether. It might sound weird. How can someone who isn’t invested care enough about the success of RT? Easily. I, as an example and I’m sure there are many like me out there, have no flesh in the game because I choose NOT to contribute to any of the open source projects that RT would fund, BUT I have a very deep interest to make sure those projects succeed because I depend on them for my work, therefore I have as much interest as anyone in making sure RT is successful without the conflict of being the recipient of the money that RT contributes to the open source community. So is there someone who isn’t DHH, Aaron, André, Sam, or any one of the major contributors but that still has the same interest in seeing RT succeed, that can (and wants to) lead the organization? I believe that will be the key moving forward.</p>

<p>What’s your sense of all of this? How would you resolve this situation?</p>]]></content><author><name></name></author><category term="community" /><category term="open-source" /><category term="ruby" /><summary type="html"><![CDATA[It is Friday evening, I just spent my entire afternoon on drama instead of being productive and working on billable stuff. Yet this time of drama is…]]></summary></entry></feed>