<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Alex Evanczuk on Medium]]></title>
        <description><![CDATA[Stories by Alex Evanczuk on Medium]]></description>
        <link>https://medium.com/@alexevanczuk?source=rss-bffa4a615a1b------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*iDMdxQjItByQ4O2R4sqoYQ.jpeg</url>
            <title>Stories by Alex Evanczuk on Medium</title>
            <link>https://medium.com/@alexevanczuk?source=rss-bffa4a615a1b------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 05:59:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@alexevanczuk/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Resolving “NameError: uninitialized constant Foo” in Ruby]]></title>
            <link>https://medium.com/@alexevanczuk/resolving-nameerror-uninitialized-constant-foo-in-ruby-381ee4dcf4d3?source=rss-bffa4a615a1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/381ee4dcf4d3</guid>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[namespaces]]></category>
            <category><![CDATA[ruby-namespacin]]></category>
            <category><![CDATA[ruby]]></category>
            <dc:creator><![CDATA[Alex Evanczuk]]></dc:creator>
            <pubDate>Mon, 07 Aug 2023 19:17:27 GMT</pubDate>
            <atom:updated>2023-08-07T19:17:27.507Z</atom:updated>
            <content:encoded><![CDATA[<p>So you’re working on your Ruby app, and when you run your code, you get:</p><pre>NameError: uninitialized constant Foo</pre><p>How do you resolve this?</p><p>This blog post will attempt to give you all of the tools you need to:</p><ul><li>Understand why Ruby is giving you this error</li><li>Debug this issue to remove the error</li><li>Think about how different namespacing patterns make this problem more or less common in your codebase</li><li>Implement patterns in your codebase to make this issue less common</li></ul><h3><strong>Ruby Constant Lookup</strong></h3><p>Quick disclaimer: I’m not on the Ruby core team, and a lot of the information here is approximate and intended to provide some high-level background. If any of this info is incorrect, let me know!</p><p>With that out of the way…</p><p>The first thing to get on the same page about is how constants are <strong>defined</strong>.</p><pre>module Bar<br>  class Foo<br>  end<br>end</pre><p>This defines Bar::Foo .</p><p>While there are lots of little differences between module and class in Ruby, both define a namespace. Every time a namespace is declared, you can think of that namespace being pushed to a stack that qualifies whatever is defined within.</p><p>Whenever you reference a constant, such as Foo , within your application code, the first thing Ruby will do is attempt to find a defined constant with that name. However, in Ruby, references to a constant my be <strong>relative to</strong> the module they’re in. Let’s take a look at an example:</p><pre>module Bar<br>  class Baz<br>    Foo<br>  end<br>end</pre><p>In this example code, the reference to Foo could refer to Bar::Baz::Foo , Bar::Foo , or just ::Foo (which is a shorthand for Object::Foo ).</p><p>Generally speaking, Ruby will <strong>assume</strong> you’re always referring to a <strong>more specific, more relative </strong>constant.</p><p>So if we also defined:</p><pre>class Foo<br>end</pre><p>Then this reference:</p><pre>module Bar<br>  class Baz<br>    Foo<br>  end<br>end</pre><p>Would still refer to Bar::Foo , since the reference is within the Bar namespace.</p><p>Let’s be really specific here.</p><p>Whenever a constant is referenced, Ruby will more or less iterate over the result of Module.nesting at that location.</p><pre>module Bar<br>  class Baz<br>    puts Module.nesting.inspect # evaluates to [Bar::Baz, Bar]<br>    Foo<br>  end<br>end</pre><p>If no constant can be found assuming the reference is relative to Module.nesting , it assumes it is a reference to a constant in the global namespace (or to be precise, namespaced under Object , the implicit namespace for all constants).</p><p>So to figure out what constants Ruby thinks your reference refers to, just add this next to your constant reference:</p><pre>puts Module.nesting.map{|namespace| &quot;#{namespace}::Foo&quot; }.inspect</pre><p>Note that using the “compact style” to define your namespaces has subtly different results:</p><pre>class Bar::Baz<br>  puts Module.nesting.inspect # evaluates to [Bar::Baz]<br>  puts Module.nesting.map{|namespace| &quot;#{namespace}::Foo&quot; }.inspect # evaluates to [&quot;Bar::Baz::Foo&quot;]<br>  Foo # refers to ::Foo<br>  Bar::Foo # refers to Bar::Foo<br>end</pre><p>As a result of this, the Foo reference <strong>now refers to ::Foo, not Bar::Foo.</strong></p><p>If we hadn’t defined a ::Foo in the global namespace, we’d get another NameError .</p><p><strong>This is the biggest disadvantage to this style – any compacted namespaces are not part of </strong><strong>Module.nesting , and therefore you cannot refer to constants relative to those namespaces, forcing you to add extra namespaces when referring to constants.</strong></p><p>This is a tradeoff with no definitively right pattern – it depends on your preferences. For simplicity for myself and other new engineers, I tend to stick to the <strong>non-compact</strong> style of declaration.</p><p>Note though that the non-compact style has its own downsides.</p><ol><li>Larger diffs when renamespacing files</li><li>Lots more indenting</li><li>More opportunities for NameError since partially-qualified constant references may break when moving code around.</li></ol><p>For (3), say I have a bunch of code that looks like this:</p><pre>module Workers<br>  module Helpers<br>  end<br><br>  module MyBusinessDomain<br>    def my_function<br>      Helpers.do_a_thing<br>    end<br>  end<br>end</pre><p>Rather than all jobs sitting in the global namespace Workers , let’s say we want to namespace everything under MyBusinessDomain to keep code organized by domain rather than something technical:</p><pre>module MyBusinessDomain<br>  module Workers<br>    def my_function<br>      # evaluates to [&quot;MyBusinessDomain::Workers::Helpers&quot;, &quot;MyBusinessDomain::Helpers&quot;]<br>      puts Module.nesting.map{|namespace| &quot;#{namespace}::Helpers&quot; }.inspect<br>      Helpers.do_a_thing<br>    end<br>  end<br>end</pre><p>This now creates a NameError , because ::Workers::Helpers is not in Module.nesting . To fix this, either:</p><ol><li>Fully qualify this reference as Workers::Helpers</li><li>Renamespace the referenced constant too: MyBusinessDomain::Workers::Helpers</li></ol><p>This is a basic overview of constant lookup, but does not cover more advanced situations. <a href="https://cirw.in/blog/constant-lookup.html">This blog post</a> provides a more deeply technical overview. The main pieces of additional detail you need to know is that Ruby constant lookup will also traverse up the ancestory chain to find defined constants, so more like this:</p><pre>modules = Module.nesting + (Module.nesting.first || Object).ancestors<br>modules += Object.ancestors if Module.nesting.first.class == Module<br>puts modules.inspect</pre><p>What if you’ve done all of this and you’re still getting a NameError . The next step is to think about how code is loaded.</p><h3><strong>Ruby Code Loading</strong></h3><p>By default, Ruby does not load your application code! So if a constant cannot be found in the memory of your Ruby process, there’s not much more Ruby can do for you.</p><p><strong>Something somewhere</strong> must call require on the file that defines your constant.</p><p>If I want to debug if a file is loaded, I add a <a href="https://github.com/pry/pry">binding.pry</a> to the file that I believe defines it, run my code, and see if my pry is hit.</p><p>If you’re in a gem or other Ruby context, you may need to simply require path/to/constant/definition.rb to load the constant.</p><p>If you’re using a modern version of Rails, however, then <a href="https://github.com/fxn/zeitwerk">zeitwerk</a> is used to load code. You can check out the zeitwerk docs for detailed info, but the basic idea is that file paths match constant paths. foo/bar/baz.rb defines Foo::Bar::Baz . Simple enough right?</p><p>This gets a lot more complex, though, because zeitwerk allows you to configure directories where constants live, but do not match file paths.</p><p>For example at Gusto, we have a lot of paths/files that looks like this:</p><pre># packs/my_pack/app/services/my_pack/foo.rb<br>module MyPack<br>  class Foo<br>  end<br>end</pre><p>Only my_pack/foo.rb matches the constant path. The stuff before is just where constants live.</p><p>Zeitwerk provides APIs for flexible configuration. For example, we can say everything in a folder, such as packs/my_pack , lives under a “default namespace” of MyPack . If you’re using packs , the <a href="https://github.com/gap777/automatic_namespaces">automatic_namespaces</a> gem makes this easy.</p><p>All in all, this can be hard to verify by hand. Luckily, zeitwerk makes this easy. Simply run bin/rails zeitwerk:check , and zeitwerk will tell you if your app is following the rules of zeitwerk. There’s a lot more to autoloading, but this should be enough detail for now.</p><h3>private_constant :Foo</h3><p>private_constant is one of my favorite features of Ruby, and makes intentional namespacing so powerful. It lets you mark a constant as private to a module. Let’s tie this knowledge to what we learned above:</p><pre>module Bar<br>  module Baz<br>    class Foo<br>    end<br><br>    puts Module.nesting.first # Bar::Baz<br>    private_constant :Foo # Can only be accessed from places where Module.nesting.include?(Bar::Baz)<br>  end<br><br>  puts Module.nesting.first # Bar<br>  private_constant :Baz # Can only be accessed from places where Module.nesting.include?(Bar)<br>end</pre><p>private_constant can be used restrict access to a constant the same way private can be used to restrict access to a method.</p><p>Accessing Baz outside of Bar will result in a different NameError , with the message private constant Bar::Baz referenced .</p><p>If you’re using private_constant , you might find that renamespacing files could trigger a private constant ... referenced error. Keep in mind the rules above when debugging this!</p><h3>Systematically Reducing this Pain</h3><p>The single best thing you can to reduce this pain is by being systematic, intentional, predictable, and consistent about how you namespace your code.</p><p>Here are some opinionated tips about how code should be namespaced:</p><p>✅ Organize your code by business domain rather than architectural concern. At Gusto, we use <a href="https://github.com/rubyatscale/packs-rails/tree/main">packs-rails</a> to organize code into packs, where each pack looks like a mini-Rails app.</p><p>❌ Don’t sit in global namespaces that do not pertain to your domain, such as Workers::Foo . Instead try Foo::Workers . This ensures that everything within Foo can access other constants namespaced under Foo in a predictable way. (Note if the domain IS actually Workers , such as a domain-agnostic background jobs system, then this namespace could be more appropriate.)</p><p>✅ Namespace your code with top-level modules pertaining to the primary business domain. For example, rather than ::BlogPostSubmitter , try ::Blogs::PostSubmitter . At Gusto, we use rubocop-packs (specifically the cop <a href="https://github.com/rubyatscale/rubocop-packs/blob/main/manual/cops_packs.md#packsrootnamespaceispackname">Packs/RootNamespaceIsPackName</a>) to push pack’s to have predictable and consistent global namespacing.</p><p>❌ Don’t share root namespaces across your main areas of code, such as packs. That is, try not to have separate packs define constants that are defined under the same root namespace, such as Blogs (such constants might better live in one place).</p><p>✅ Keep the amount of nesting for public APIs minimal. Instead of Blogs::Api::Saving::Saver.save!(...) , try just Blogs.save!(...) . Ensure complex organizational nesting is hidden from folks calling your API. I like to keep public APIs no more than 2 levels deep. Remember you can “re-export” constants: Blogs::Saver = Blogs::Api::Saving::Saver , for example. This is a contrived example, but sometimes useful to organize private implementation details while presenting a simple facade for users.</p><p>❌ Don’t repeat information already in the global namespace. Instead of Blogs::BlogSaver , try just Blogs::Saver . It’s okay to call that class simply Saver , because it’s namespaced, isolating it from any other concept of a Saver . There’s one caveat to this rule, which is occasionally</p><p>❌ Did I mention not to pollute the global namespace?</p><p>All in all, these patterns make things simpler. It’s also nothing new — this is the de-facto standard for namespacing code in ruby gems.</p><p>But maybe you look at this and say… who cares? This sounds like a lot of extra work — why don’t I not use namespaces and just put everything in the global namespace?</p><p>You <strong>could</strong> do this, but it will result in a lot more pain down the road. Furthermore, your code will end up looking like it wants to be namespaced:</p><pre>class BlogSubmitter; end<br>class BlogDeleter; end<br>class BlogApprover; end<br># or...<br>module Blogs<br>  class Submitter; end<br>  class Deleter; end<br>  class Approver; end<br>end</pre><p>Thoughtful namespacing will create a “<a href="https://martinfowler.com/bliki/BoundedContext.html">bounded context</a>,” which is a term that basically means that everything within the bounds is in the context of whatever is creating the bounds. That is, Submitter is in the context of Blogs , a context created by the global namespace.</p><p>Taking the time to thoughtfully namespace (or renamespace) your code will help create bounded contexts that not only make code more terse to read and write, but allow you to name things in isolation of the rest of the world.</p><h3>What have Sorbet, Packwerk and Rubocop got to do with this?</h3><p>I just want to make a note about how these other tools interact with all of this.</p><p>First and foremost, I highly recommend using <a href="https://sorbet.org/">sorbet</a> to make this problem easier. When integrated into your editor, sorbet will tell you if ruby constant lookup is causing a problem <strong>before</strong> you run your code. sorbet <strong>cannot</strong> tell you if you did not properly load your code (including using zeitwerk correctly), since today this can only be evaluated at runtime.</p><p>When sorbet cannot find a constant, the error looks like this:</p><pre>Unable to resolve constant `Foo` (fix available) (<a href="https://sorbet.org/docs/error-reference#5002">5002</a>)</pre><p>Generally speaking, sorbet will correctly emulate the Ruby constant lookup rules described above. I’d encourage you to check out the short error reference (<a href="https://sorbet.org/docs/error-reference#5002">5002</a>) to learn more reasons why Sorbet might be giving you this error.</p><p>Like Sorbet, packwerk and rubocop are static analysis tools. If you are ever getting a NameError at <strong>runtime</strong> (when your code is executing), keep in mind that all three of sorbet,packwerk and rubocop are static analysis tools that are unknown to the Ruby runtime and cannot themselves be causing issues. Inversely, a NameError could cause unexpected results in those tools. While signal from “downstream” tools (or to put it another way, tools not depended on by the source of the issue, which is Ruby in this case) can provide signal about upstream problems, remember to always focus on solving upstream issues first wherever possible. That will simplify the debugging process and can help avoid wasting cycles on solving downstream symptoms of upstream causes.</p><h3>Questions? Feedback?</h3><p>Please let me know if any aspect of this article is incorrect, unclear, incomplete, needing examples, or any other feedback you have! I’d love to improve this post over time.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=381ee4dcf4d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A How-to Guide to Ruby Packs, Gusto’s Gem Ecosystem for Modularizing Ruby Applications]]></title>
            <link>https://engineering.gusto.com/a-how-to-guide-to-ruby-packs-gustos-gem-ecosystem-for-modularizing-ruby-applications-e236126b8c2c?source=rss-bffa4a615a1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/e236126b8c2c</guid>
            <dc:creator><![CDATA[Alex Evanczuk]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 15:17:25 GMT</pubDate>
            <atom:updated>2023-03-02T17:35:52.222Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g1RXZ3hCDMbXkx1Lgv-LDA.jpeg" /></figure><p>This past summer, I published a blog post called “<a href="https://medium.com/gusto-engineering/laying-the-cultural-and-technical-foundation-for-big-rails-6b5ab78349ed">Laying the Cultural and Technical Foundation for Big Rails</a>” and <a href="https://www.youtube.com/watch?v=J9S0qiGkAQY">spoke about it at RailsConf</a>.</p><p>Since then, we’ve made a ton of development and improvements, and in this blog post I want to share about the latest public iteration of the <a href="http://github.com/rubyatscale">RubyAtScale Modularization Toolchain</a> that we use at Gusto to modularize our large Ruby on Rails application and is currently under active development and improvement.</p><p>This post is mostly meant as a how-to guide to effectively use these solutions, but in a future post I’ll dive more into the problem of large, entangled codebases and how modularization principles can be used to address that problem.</p><h3><strong>Packs and their Extensions</strong></h3><p>The toolchain starts with <a href="https://github.com/rubyatscale/packs">packs</a>, a pretty simple specification for a ruby package, or “pack” as we call it. By itself, packs doesn’t do much. Instead, it’s extended by a modular suite of tools that can be adopted gradually.</p><p>For example…</p><ul><li><a href="https://github.com/rubyatscale/packs-rails">packs-rails</a> can be dropped into your Rails application to ensure <a href="https://guides.rubyonrails.org/autoloading_and_reloading_constants.html#config-autoload-paths">Rails Autoload Paths</a> are set up correctly. This also includes helpers to make rspec and factory_bot integrate with your packs.</li><li><a href="https://github.com/rubyatscale/rubocop-packs">rubocop-packs</a> contain cops that are intended to help improve boundaries between your packs.</li><li><a href="https://github.com/Shopify/packwerk">packwerk</a>, from Shopify, can be used to define architectural rules about pack boundaries. More on packwerk below.</li><li><a href="https://github.com/rubyatscale/packwerk-extensions">packwerk-extensions</a>, which use packwerk’s extensible API to provide other types of pack boundaries.</li><li><a href="https://github.com/rubyatscale/danger-packwerk">danger-packwerk</a>, which provides automated inline pull request comments related to architecture boundary violations.</li><li><a href="https://github.com/rubyatscale/code_ownership">code_ownership</a> can be used to specify ownership of packs and integrate it into various developer tools.</li><li><a href="https://github.com/rubyatscale/use_packs">use_packs</a> exposes a CLI, bin/packs, that makes it easy to create new packs, move files between packs, and more.</li><li><a href="https://github.com/rubyatscale/pack_stats">pack_stats</a> makes it easy to send metrics about pack adoption and modularization to your favorite metrics provider, such as DataDog (which has built-in support).</li></ul><h3>How Is a Pack Different From a Gem?</h3><p>A ruby <a href="https://guides.rubygems.org/what-is-a-gem/">gem</a> is the Ruby community solution for packaging and distributing Ruby code. A gem is a great place to start new projects, and a great end state for code that’s been extracted from an existing codebase. packs are intended to help gradually modularize an application that has some conceptual boundaries, but is not yet ready to be factored into gems.</p><h3>How Packwerk Works</h3><p>Packwerk does the following three things in order:</p><ul><li>Parses a graph of “pack” nodes, creating edges based on references to Ruby Constants.</li><li>Provides a simple and extensible, YML based declarative language for constraining that graph in various ways (e.g. dependencies and public API usage), called package.yml</li><li>Outputs the “diff” between the declared graph and the constrained graph as another YML file called package_todo.yml</li></ul><p>Packwerk analyzes each reference to a ruby constant with something called a “<a href="https://github.com/Shopify/packwerk/blob/main/lib/packwerk/checker.rb"><strong>checker</strong></a>.” A checker takes in a reference to a constant, which includes information about what pack is referencing the constant as well as what pack defines that constant. Each checker can define arbitrary rules for whether the constant is a “violation” or not. For example, the “dependency” checker considers a reference a violation if one pack references another without listing it as an explicit dependency.</p><h3>How to Get Started</h3><p>The toolchain here has developed alongside Gusto’s journey to modularize its Rails application. Along the way, because we believe in gradual and incremental improvement, we wanted to make sure we always left a path for new applications to adopt this framework in a way that adds value incrementally. Here’s how I’d go about advising an organization to use these tools to modularize their app.</p><p><strong>Step 1: Break up your code into domain-based packs</strong></p><p>Before getting into the process of using packwerk or rubocop-packs to improve system boundaries, the simplest way to start is to move code files into packs. Check out the blog post linked in the introduction for a before and after of what this means. use_packs exposes a helpful CLI – bin/packs — which developers at Gusto use to create new packs and move files into them.</p><p>There is no silver bullet for how your application should be broken up. The best way I’ve found is to sit down with subject matter experts (including product) and make a best first attempt at breaking up your application into smaller domains. Feel free to allow imperfection. Your first attempt at domain boundaries will never be perfect, and that’s okay!</p><p>The important thing to remember is that this is <strong>easy to change</strong> if you get it wrong, since you can always merge your packs back into a mega-pack or move files around again. In Rails, moving a file between packs only changes “autoload paths,” meaning how the constant the file defines is referenced remains unchanged. At Gusto, this means developers can experiment with boundaries inexpensively and with low risk, and they regularly move files around as their understanding of boundaries improves.</p><p><strong>Step 2: Find owners for packs</strong></p><p>The next step would be to use code_ownership to create code teams within your application and assign them to packs. Having packs be assigned to owners creates accountability, which is useful for everything from creating appropriate context in automated developer feedback and observability tools to just making sure folks know who they can talk to about changing code they are unfamiliar with.</p><p><strong>Step 3: Begin enforcing your pack dependency structure</strong></p><p>One thing packwerk can do is enforce the dependencies between your packs. By having each pack specify what it depends on, you can use packwerk to create a package_todo.yml file, which represents “violations” between packs, such as the use of a pack without a stated dependency. This tool makes it easy to start creating a technically enforced architecture diagram.</p><p>Begin using this by setting enforce_dependencies to true on a couple of packs you feel the <strong>most</strong> confident about. For example, you might feel very confident that your feature flags or authorization framework should not depend on your domain, but packwerk may reveal through “dependency violations” that they do. Fix these by aligning the code with the design. Once all dependency violations are complete, you can set enforce_dependencies to strict . This locks in your progress and prevents architecture regressions.</p><p>Fixing dependency violations first helps ensure code is in the right place. Once we feel confident code is in the right place, we can move onto improving the API to that code.</p><p>Quick note: Make sure to pin to packwerk 3 to use the capabilities described in this blog post:</p><pre>gem &#39;packwerk&#39;, &#39;~&gt; 3.0&#39;</pre><p><strong>Step 4: Begin enforcing public API boundaries</strong></p><p>Next, packwerk-extensions supports the idea of a “privacy” checker. To use this, find packs where you believe should have a clear, well-abstracted API. Set enforce_privacy to true in those packs. Run bin/packwerk update-todo and try to fix most or all of the violations before shipping. This is important so consumers have public API to reach for when they get a privacy violation.</p><p><strong>Step 5: Harden the good boundaries</strong></p><p>Lastly, once your dependency structure is clean and the APIs between packs make the application simpler to understand, you can harden those boundaries with rubocop-packs . Cops such as Packs/RootNamespaceIsPackName ensure that every pack establishes exactly one top-level namespace equal to the pack’s name. Packs/DocumentedPublicApi ensures your public API is documented!</p><p><strong>What’s next?</strong></p><p>There’s a lot of detail missing in this post about the problems we are trying to solve, the symptoms of an entangled, monolithic codebase, how to go about determining domain boundaries, technical strategies for refactoring towards better boundaries, management and cultural techniques and changes that need to be made to support this work, and more.</p><p>There’s also so much more potential for the packs ecosystem and for Ruby Packages as a concept in general. At Gusto, our vision is to allow the packs ecosystem to support gradual modularization to permit packs to be built, tested, and even deployed independently, as determined automatically based on boundary improvement progress. For example at Gusto, we use a feature we call “conditional builds” to run a subset of tests that could possibly fail based on the system package graph.</p><p><strong>Join us!</strong></p><p>We’d love for you to try out this ecosystem and provide us feedback or contribute! I’d also love to hear you and your organizations’ approaches to modularization – I’m very supportive of all efforts to improve packaging and modularization capabilities in the Ruby language and Rails framework.</p><p>If you’d like to chat more, please reach out to me here or in the <a href="https://join.slack.com/t/rubymod/shared_invite/zt-1dgyrxji9-sihGNX43mVh5T6tw18hFaQ">Ruby/Rails Modularity Slack Server</a>. I’d be happy to chat more!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e236126b8c2c" width="1" height="1" alt=""><hr><p><a href="https://engineering.gusto.com/a-how-to-guide-to-ruby-packs-gustos-gem-ecosystem-for-modularizing-ruby-applications-e236126b8c2c">A How-to Guide to Ruby Packs, Gusto’s Gem Ecosystem for Modularizing Ruby Applications</a> was originally published in <a href="https://engineering.gusto.com/">Gusto Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A start-to-finish walkthrough on creating a Ruby gem with CI and CD]]></title>
            <link>https://engineering.gusto.com/a-start-to-finish-walkthrough-on-creating-a-ruby-gem-with-ci-and-cd-a2b705047087?source=rss-bffa4a615a1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/a2b705047087</guid>
            <category><![CDATA[gradual]]></category>
            <category><![CDATA[ruby]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[gradualmodularization]]></category>
            <category><![CDATA[gem]]></category>
            <dc:creator><![CDATA[Alex Evanczuk]]></dc:creator>
            <pubDate>Mon, 17 Oct 2022 14:11:36 GMT</pubDate>
            <atom:updated>2022-11-08T17:22:09.087Z</atom:updated>
            <content:encoded><![CDATA[<p>Creating an open source Ruby gem is easier than you might think! In this post, we will be walking through the process of creating and publishing a Ruby gem from start to finish.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1pPWKntJnE8ZxbduiaDkEw.jpeg" /></figure><h3>Terminology</h3><p>First off, let’s define some terms and describe their relevance:</p><ul><li><strong>Ruby gem</strong>: A Ruby gem is a distributable library of Ruby code. Gems are how we share Ruby code. <a href="https://guides.rubygems.org/what-is-a-gem/">Learn more</a>.</li><li><strong>rubygems.org: </strong>The Ruby community’s gem hosting service. <a href="https://guides.rubygems.org/contributing">Contribute</a>. <a href="https://rubygems.org/pages/about">Learn more</a>.</li><li><strong>bundler</strong>: The Ruby community’s gem manager. <a href="https://bundler.io/">Learn more</a>.</li><li><strong>CI:</strong> Continuous Integration is, in the context of this blog post, the process of automatically running a test suite on every commit and ensuring those tests remain passing by preventing merges to main without a passing test suite (or as we like to call it where I work at Gusto, a “green build”). <a href="https://martinfowler.com/articles/continuousIntegration.html">Learn more</a>.</li><li><strong>CD: </strong>Continuous Deployment is, also in the context this blog post, the process of automatically pushing new versions of a Ruby Gem to rubygems.org every time three things are true: (1) A commit is merged to main (2) that commit has a green build (3) The gem version has been updated.</li><li><strong>GitHub Actions: </strong>A build system provided by GitHub that we will be using as the “compute” for our CI and CD pipelines. <a href="https://github.com/features/actions">Learn more</a>.</li></ul><p>Whew! Now we can get onto the fun stuff…</p><h3>Let’s Get Started</h3><p>To keep things tidy, I’ll be referencing commits and pull requests. If you have a question about any part of the code, please drop an inline GitHub comment and tag my GitHub username (also @alexevanczuk). I’ve done my best to leave some inline comments, and I’d also highly encourage checking out the world-class documentation on <a href="https://guides.rubygems.org/">https://guides.rubygems.org/</a> and <a href="https://docs.github.com/en">https://docs.github.com/en</a>. I’ve done my best not to repeat too much that is already discoverable in those docs.</p><p><strong>Create the Repository</strong></p><p>To start off, I’d highly recommend using the <a href="https://cli.github.com/">GitHub CLI</a>. You can install it with brew install gh . Of course, any git and GitHub client will work just fine.</p><p>I’ll use gh repo create to create a new repository to host my gem. I use the name my_example_gem as the name of my repo and gem. Try to find a name that is meaningful to you and your stakeholders.</p><pre>~/workspace - $ gh repo create<br>? What would you like to do? Create a new repository on GitHub from scratch<br>? Repository name my_example_gem<br>? Description An example gem set up with CI and CD.<br>? Visibility Public<br>? Would you like to add a README file? No<br>? Would you like to add a .gitignore? No<br>? Would you like to add a license? No<br>? This will create &quot;my_example_gem&quot; as a public repository on GitHub. Continue? Yes<br>✓ Created repository alexevanczuk/my_example_gem on GitHub<br>? Clone the new repository locally? Yes<br>Initialized empty Git repository in /Users/alex.evanczuk/workspace/my_example_gem/.git/</pre><p>When I navigate to <a href="https://github.com/alexevanczuk/my_example_gem">https://github.com/alexevanczuk/my_example_gem</a>, I see this screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fWBFwy0NLfuFSqkz8CqAyg.png" /></figure><p>I navigate into the newly created gem folder with cd my_example_gem and follow the set of instructions labeled “create a new repository on the command line,” which created this commit:</p><p><a href="https://github.com/alexevanczuk/my_example_gem/commit/5ce5c1b777ac389c12ce5819e549ac036c894da5">first commit · alexevanczuk/my_example_gem@5ce5c1b</a></p><p><strong>Create the Gem</strong></p><p>bundler makes this easy. I first cd .. to go up to the parent directory, then run:</p><pre>bundle gem my_example_gem --coc --test=rspec --linter=rubocop --mit</pre><p>Some notes about this:</p><ul><li>I press enter when it asks me if I want to overwrite the existing README.md</li><li>bundler has a flag --ci=github , but we’ll be building this ourselves.</li><li>I use the MIT License, which is very common license used for open source software projects. If you’re affiliated with an organization or a company, you’ll want to make sure you’re familiar with its licensing requirements (i.e. talk to your legal team).</li></ul><p>If all went to plan, you should be ready to create a PR, with these steps:</p><ul><li>cd into your repo (cd my_example_gem for me)</li><li>Checkout a branch: git checkout -b create-gem</li><li>Stage all changes: git add .</li><li>Commit staged changes with git commit -m &quot;bundle gem my_example_gem --coc --test=rspec --linter=rubocop --mit”</li><li>Create a PR: gh pr create</li><li>Merge the PR: gh pr merge</li></ul><blockquote>I like to use “Squash and merge” when merging, which can also be set as the only option in settings =&gt; general in your repository. I also recommend setting a branch protection rule for main in settings =&gt; branches =&gt; Add rule</blockquote><p>Great! We have one merged PR:</p><p><a href="https://github.com/alexevanczuk/my_example_gem/pull/1">Create gem using bundler by alexevanczuk · Pull Request #1 · alexevanczuk/my_example_gem</a></p><p><strong>More Boiler Plate</strong></p><p>If you run bundle install at this point in your repo, you may see this:</p><pre>The gemspec at /Users/alex.evanczuk/workspace/my_example_gem/my_example_gem is not valid. Please fix this gemspec.<br>The validation error was &#39;metadata[&#39;homepage_uri&#39;] has invalid link: &quot;TODO: Put your gem&#39;s website or public repo URL here.&quot;&#39;</pre><p>I make some changes until I can bundle install. I’ve also changed some of the defaults, such as specifying spec.files more plainly rather than using git .</p><p>Follow the same process above to create and merge a PR. You can see the merged PR here:</p><p><a href="https://github.com/alexevanczuk/my_example_gem/pull/2">Fix up gemspec so we can bundle install by alexevanczuk · Pull Request #2 · alexevanczuk/my_example_gem</a></p><p><strong>Get an API Key</strong></p><p>We need a <strong>rubygems.org</strong> API key to push. Get one from <a href="https://rubygems.org/profile/api_keys">https://rubygems.org/profile/api_keys</a>! You’ll need to create an account and login if you haven’t, and your gem needs the “Push rubygem” API scope.</p><p>Then, add that gem as a secret to your repo. You can find that under settings =&gt; secrets =&gt; actions . Create a new secret with the name RUBYGEMS_API_KEY and set the secret value. Make sure not to put this secret anywhere that others can find it — it’s a secret after all. I like to put mine in my 1Password as a note in my <strong>rubygems.org</strong> login. If you’re doing this for a company, make sure you follow your organization’s policies for login and secrets management.</p><p><strong>Add CI and CD</strong></p><p>Checkout a new branch with git checkout -b add-ci-and-cd</p><p>For this, we’ll be using GitHub Actions. GitHub Actions use a <a href="https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions">special syntax</a> to define their logic. To learn more about how these actions work, check out the PR that add them and the inline comments.</p><p>I had to do three more things to finish this:</p><ol><li>I removed a trivially failing test</li><li>I ran bundle exec rubocop -a to auto fix rubocop</li><li>I ran bundle lock --add-platform x86_64-linux , which lets bundle work in GitHub Actions, which uses a linux machine.</li></ol><p>Here’s the PR:</p><p><a href="https://github.com/alexevanczuk/my_example_gem/pull/3">Create CI and CD workflows by alexevanczuk · Pull Request #3 · alexevanczuk/my_example_gem</a></p><p>With that, everything passes!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9-gk7vVh1UNhKyPpowUcYg.png" /></figure><p>Once I merged with gh pr merge -d , tests were automatically kicked off on main . Once those completed, a CD action was kicked off. Note to see kicked off CD actions, you need to navigate to the “Actions” tab of your repository, which for me is here: <a href="https://github.com/alexevanczuk/my_example_gem/actions">https://github.com/alexevanczuk/my_example_gem/actions</a></p><p>You can also follow along with workflows locally with gh run watch</p><p>Here is the CD action:</p><p><a href="https://github.com/alexevanczuk/my_example_gem/actions/runs/3259482118">CD · alexevanczuk/my_example_gem@0667457</a></p><p>And here is the listing in rubygems.org for my new gem!</p><p><a href="https://rubygems.org/gems/my_example_gem">my_example_gem | RubyGems.org | your community gem host</a></p><p>Lastly, check out this lovely autogenerated release page!</p><p><a href="https://github.com/alexevanczuk/my_example_gem/releases/tag/v0.1.0">Release v0.1.0 · alexevanczuk/my_example_gem</a></p><blockquote>Did you know you can link to specific lines in a GitHub Action log? For example, here’s the link to the command that was used to generate the release: <a href="https://github.com/alexevanczuk/my_example_gem/actions/runs/3259482118/jobs/5352349524#step:5:1">https://github.com/alexevanczuk/my_example_gem/actions/runs/3259482118/jobs/5352349524#step:5:1</a></blockquote><blockquote>This is a great feature if you want to share failures with others!</blockquote><p>With this, not only do I never have to manually deploy, but other contributors can also deploy for themselves without needing to share access to API keys! Other contributors also have visibility into failed builds and deploys.</p><blockquote><strong><em>Important note:</em></strong> If you’re using 2FA/MFA for RubyGems, you’ll need to set it (<a href="https://rubygems.org/settings/edit">here</a>) to the UI and gem signing level, and not UI and API . Another option if you do not want to change this is to change CD to use the <a href="https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch">workflow_dispatch</a> event instead of workflow_run , which will let you and other contributors publish from the command line with the gh run command. You can then set the otp_code to be a user input, which can then be passed to the action, <a href="https://guides.rubygems.org/using-mfa-in-command-line/">which can then be passed to the gem push command</a>.</blockquote><p><strong>Wrap Up</strong></p><p>I think this is a good place to stop!</p><p>From here, there’s so much we can do! Besides, of course, adding behavior to your gem so its valuable for you and others to use, there are countless ways to continue to improve the development process. For example…</p><ul><li>We could add <a href="https://sorbet.org/">Sorbet</a> for static type checking</li><li>We could add <a href="https://github.com/fxn/zeitwerk#for_gem">Zeitwerk</a> for autoloading (no more require statements)</li><li>We could make a standard CLI (command-line interface) with <a href="https://github.com/rails/thor">thor</a></li><li>We could make an interactive CLI with <a href="https://github.com/piotrmurach/tty-prompt">tty-prompt</a></li><li>…and so much more!</li></ul><p>Share your thoughts, questions, feedback, and what you’d like to see next as a comment here, within any of the above linked pull requests, or on the <a href="https://join.slack.com/t/rubymod/shared_invite/zt-1dgyrxji9-sihGNX43mVh5T6tw18hFaQ">Ruby/Rails Modularity Slack Server</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a2b705047087" width="1" height="1" alt=""><hr><p><a href="https://engineering.gusto.com/a-start-to-finish-walkthrough-on-creating-a-ruby-gem-with-ci-and-cd-a2b705047087">A start-to-finish walkthrough on creating a Ruby gem with CI and CD</a> was originally published in <a href="https://engineering.gusto.com/">Gusto Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laying the Cultural and Technical Foundation for Big Rails]]></title>
            <link>https://engineering.gusto.com/laying-the-cultural-and-technical-foundation-for-big-rails-6b5ab78349ed?source=rss-bffa4a615a1b------2</link>
            <guid isPermaLink="false">https://medium.com/p/6b5ab78349ed</guid>
            <category><![CDATA[gusto]]></category>
            <category><![CDATA[modularization]]></category>
            <category><![CDATA[bigrails]]></category>
            <category><![CDATA[gradual-modularity]]></category>
            <category><![CDATA[packwerk]]></category>
            <dc:creator><![CDATA[Alex Evanczuk]]></dc:creator>
            <pubDate>Thu, 19 May 2022 00:34:00 GMT</pubDate>
            <atom:updated>2022-06-16T12:31:58.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YnTZAih3REXa_jgk.png" /></figure><p>This was Gusto’s system graph. Each of the black rectangles you see here is a subsystem within Gusto’s biggest Rails monolith, and the red arrows are where one subsystem talks to another.</p><p>As our business grew, folks started having a hard time making large changes in our codebase. Initially, we tried solving some of these problems with gems, Rails engines, and microservices — with mixed results.</p><p>If this story is familiar to you, you may be working in a big Rails application. Gusto has attempted to solve some of these problems through Big Rails.</p><blockquote>Big Rails is a system of sociotechnical tools, practices, and conventions that scale Rails development in terms of lifespan, number of contributors, and complexity.</blockquote><p>In this post, I’ll talk a little bit about how we tried to solve these problems and share some tools we’ve open-sourced.</p><p>To solve the problems of a Big Rails application, there are 5 key principles that drive our approach.</p><ul><li>Accountability and Ownership</li><li>Clear Boundaries</li><li>Thoughtful Dependency Management</li><li>Gradual Adoption</li><li>Intentionally Curated and Sustainable Feedback Loops</li></ul><h3>Accountability and Ownership</h3><pre>module PayrollSyncer<br>  def self.sync_deductions!<br>    raise &quot;I am an error&quot;<br>  end<br>end</pre><p>Imagine this code exists in your codebase. When PayrollSyncer.sync_deductions! is called, who receives the error? How is it routed to the right team? Who do you ask about this code when git blame shows dozens of folks who have changed teams or left the company?</p><p>Accountability and ownership is all about striving to clearly define which teams own which domains. It should be dead simple for both automated tooling and engineers working within the codebase to identify areas of ownership.</p><p>To accomplish this within our own Big Rails application, we created and open-sourced two gems: one to manage code ownership and the other to manage teams.</p><ul><li><a href="https://github.com/rubyatscale/code_ownership">github.com/rubyatscale/code_ownership</a> (and <a href="https://github.com/rubyatscale/code-ownership-vscode">github.com/rubyatscale/code-ownership-vscode</a>)</li><li><a href="https://github.com/rubyatscale/code_teams">github.com/rubyatscale/code_teams</a></li></ul><p>Here is a simple team declaration…</p><pre># config/teams/payroll.yml<br>name: Payroll<br>github:<br>  team: &#39;<a href="http://twitter.com/Gusto/payroll">@Gusto/payroll</a>&#39;<br>owned_globs:<br> - app/services/payroll/**/**<br> - app/services/payroll_syncer.rb</pre><p>… and how we tie that team to that code in the snippet above.</p><pre>team = CodeTeams.find(&#39;Payroll&#39;)</pre><pre>CodeOwnership.for_file(&#39;app/services/payroll_syncer.rb&#39;) == team</pre><pre>CodeOwnership.for_class(PayrollSyncer) == team</pre><pre>begin<br>  PayrollSyncer.sync_deductions!<br>rescue =&gt; ex<br>  CodeOwnership.for_backtrace(ex.backtrace) == team<br>end</pre><p>With this, we could suddenly tie that original piece of code back to the team. As an added bonus, this functionality started conversations about code ownership (or lack thereof) throughout our codebase.</p><h3>Clear Boundaries and Dependency Management</h3><p>Having clear boundaries is about working towards easily understandable conceptual and mechanical separation between domains. Each system should only talk to other systems via intentionally maintained public APIs. Thoughtful dependency management means minimizing dependencies. This helps engineers reduce cognitive load and understand how systems work together. When we must take on a dependency, we should do so explicitly. We should avoid creating cycles in our dependency graph, as they reduce our ability to understand a subsystem in isolation.</p><p>To move towards this goal, we started with one simple change to a standard Rails convention.</p><pre>app/<br>  models/<br>    benefits/<br>    payroll/<br>    hr/<br>  views/<br>    benefits/<br>    payroll/<br>    hr/<br>  controllers/<br>    benefits/<br>    payroll/<br>    hr/<br>  services/<br>    benefits/<br>    payroll/<br>    hr/</pre><p>Here is a contrived example of a standard Rails app. It has an app directory containing secondary directories for “architectural concerns” which point to the various domains.</p><p>Imagine you are an engineer on the benefits team at Gusto. You have to jump around the codebase to make a change within one domain. This violates an important principle of coupling and cohesion — things that change together should live together.</p><p>So we made that change:</p><pre>packs/<br>  benefits/<br>    models/<br>    views/<br>    controllers/<br>    services/<br>  payroll/<br>    models/<br>    views/<br>    controllers/<br>    services/<br>  hr/<br>    models/<br>    views/<br>    controllers/<br>    services/</pre><p>We decided to organize things on the basis of their business domain first, followed by the basis of architectural concern. This hid the technologies underlying a domain while co-locating test files. Although this is possible with vanilla Rails, we open-sourced a tool called <a href="https://github.com/rubyatscale/stimpack">stimpack</a> to make this sort of configuration easy.</p><p>Now that our app was organized by domain, we leveraged <a href="https://github.com/Shopify/packwerk">packwerk</a> to systematically manage the relationships between these domains. Kudos to Shopify for this great tool! With packwerk we kept the same structure as above, but added a package.yml and a public folder (where the public API lives) in each domain folder. Each pack is owned by one team, which is implemented by the code_ownership gem.</p><h3>Packwerk tl;dr</h3><p>Packwerk creates a directed graph of the statically analyzable references from one package to another. If one pack calls code defined in another pack it forms a reference, or an edge, in that graph. Packwerk then analyzes these references and declares a reference as a “privacy violation” if one pack is referencing something in the private API of the other pack and a “dependency violation” if it’s referencing another pack without a declared dependency in the package.yml file. Packwerk outputs these violations in a YML list which is indispensable to improving system boundaries gradually over time. This is only a brief explanation of how packwerk works. Checkout the Packwerk docs for more details.Packwerk does all of this without being loaded into the runtime. This means packwerk is not a production dependency. Packwerk runs as a separate process on CI or locally. Note that packwerk only parses explicit references to classes, constants, and modules. We find that pairing packwerk with <a href="https://github.com/sorbet/sorbet">sorbet</a> and typing our methods helps packwerk provide even more meaningful output.</p><h3>But what about gems and engines?</h3><p>I mentioned earlier that we tried using inline gems and engines to modularize our application. Packwerk has some key differences from gems and engines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PyPMYDKe_oXI8KDfVyrefw.png" /></figure><p>Here’s a bit more explanation:</p><ul><li>Packwerk, unlike gems and engines, supports <strong>gradual modularity</strong>. Gems and engines sometimes force you to solve modularization problems in areas of potentially low business value, where packwerk allows you to state the idealized system diagram (by creating packages, moving files into them, creating public API, and stating relationships between packages), and then it gives you the TODO list to get you there. Packwerk decouples statements about system structure and boundaries and the implementation of those boundaries.</li><li>Packwerk packages are <strong>inexpensive to create and change</strong>. There is very little boilerplate, and changing the relationships between packages is as simple as changing YML files.</li><li>Packwerk does not support <strong>distribution or versioning</strong>. If that’s what you need, you’ll definitely need to leverage gems for that.</li><li>Packwerk supports <strong>fast tests</strong> like gems if you’re using <a href="https://github.com/rails/spring">spring</a> and <a href="https://github.com/Shopify/bootsnap">bootsnap</a>.</li><li>Gems support <strong>strict boundaries</strong>. Since a package with no violations can easily be a gem, we released a tool called <a href="https://github.com/rubyatscale/package_protections">package_protections</a> to ensure that a package can remain as clean as a gem or engine.</li><li>Packwerk packages can have engine features, such as being able to have an isolated routes.rb file, when paired with stimpack.</li></ul><p>At Gusto we strongly believe gems and engines are and will continue to be a critical component of the modularization toolchain. We have also found domains with gem potential that we are perfectly happy to maintain as a package.</p><h3>Gradual Adoption</h3><p>A system never starts off as a Big Rails application — it grows into one organically. This means that the Big Rails tools must be able to be adopted gradually, since a small app might not need them.</p><blockquote>As we begin to adopt these tools, we have to remember that the technology transformation <strong>must</strong> be accompanied by a corresponding cultural change in the way teams use these tools day to day.</blockquote><p>We cannot simply drop in these new technologies and expect a transformational change to occur.</p><p>This became obvious when we first introduced packwerk. I noticed folks consistently updating the “TODO lists” packwerk provides and maintains, rather than fixing the underlying system design issues. To understand more about why this was happening, I needed to dig in.</p><p>To do this, I set up a slack notification to alert me every time a packwerk TODO list was changed. I took each alert as an opportunity to ask folks more about how they were interacting with this tool. After looking at about a thousand pull requests, we were able to identify a short list of all of the valid and not-so-valid reasons for updating the TODO lists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*J1cbxucK-jNq257H" /></figure><p>More importantly, I frequently met with engineers over zoom to chat more about what we were trying to do and how we were trying to scale our system. Over time, a cultural shift took place. Engineers understood what we were doing and why. They began to add proactive context about their interactions with the tool or fix the system design issues in response to its output.</p><p>Over time, based onrf user feedback, we built up some tooling. We open-sourced a <a href="https://github.com/rubyatscale/packwerk-vscode">VSCode Extension</a> to interact with packwerk. We released a tool called <a href="https://github.com/rubyatscale/danger-packwerk">danger-packwerk</a> to leave inline, automated feedback on pull requests related to packwerk errors. Lastly, we released a tool called <a href="https://github.com/rubyatscale/modularization_statistics">modularization_statistics</a> to be able to track our progress over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dULm0gZrY5J47ras.png" /></figure><p>We’re making progress. As for that dependency graph?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wWm4vZx3HaCeYf8s.png" /></figure><p>Well… we still have a lot of work to do!</p><h3>What’s Next?</h3><p>Just as Rails is the product of an engaged and passionate community, I hope we can take the same approach with Big Rails applications. At Gusto, we’re so grateful for the contributions of the individuals and companies who have helped be part of the solution. I’d love to engage more with the community on questions like:</p><ul><li>In what ways can Ruby and Rails continue to offer great tools and cultural norms that help users create well-modularized systems?</li><li>What can the different conventions of packwerk packages, gemspecs, and other packaging systems learn from each other?</li></ul><p>All of these open source gems we’ve released, along with the tools that the broader community have released, are, like us, imperfect. If you’re interested in this problem space, you can:</p><ul><li>Leave a comment on this blog post.</li><li>Create issues, start discussions, or open PRs in any repository within <a href="https://github.com/rubyatscale">https://github.com/rubyatscale</a></li><li>Join us in the Ruby/Rails Modularity Slack Server: <a href="https://join.slack.com/t/rubymod/shared_invite/zt-190i7obqq-OAS2nEmP7w3NR30kadteBw">https://rubymod.slack.com</a></li><li><a href="https://gusto.com/about/careers">Come work at Gusto</a> — we’re hiring for passionate folks to work on problems just like this and more.</li></ul><h3>Other Resources</h3><ul><li><a href="https://leanpub.com/package-based-rails-applications">“<em>Gradual Modularization for Ruby and Rails</em>” by Stephan Hagemann</a></li><li><a href="https://www.destroyallsoftware.com/talks/boundaries">“<em>Boundaries</em>” by Gary Bernhardt</a></li><li>“<em>Thinking in Systems</em>” by Donella Meadows</li><li><a href="https://drive.google.com/file/d/11uhLDCN6OxdHq8eIlgAsj8FjmfZ0keTO/view?usp=sharing">Gusto Modularization Toolchain (PDF)</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6b5ab78349ed" width="1" height="1" alt=""><hr><p><a href="https://engineering.gusto.com/laying-the-cultural-and-technical-foundation-for-big-rails-6b5ab78349ed">Laying the Cultural and Technical Foundation for Big Rails</a> was originally published in <a href="https://engineering.gusto.com/">Gusto Engineering</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>