Contributing to Open Source Phase at Encora Apprenticeship — Week 4

Ximena Sandoval
3 min readJan 10, 2022
Photo by Andrew Neel on Unsplash

This post is part of a weekly assignment at Encora Apprentice and in this series, I’ll share my journey as a Software Engineer Apprentice. I hope these stories help and motivate others on their tech journey.

This week at Encora

This week was filled with project issues, debugging, and working with Rails, someVueJSand of course, Ruby. Keep reading to know more about it!

Open-source projects

This week, I got to work on two open-source projects. One of them being rubygems which is the one I talked about last week, but this time I got to work with bundler, which is a submodule from the project.

The issue stated that bundle install should only retry if the error was from the network. For that, I needed to dive into debugging tools such as pry , pry-byebug, and finally debug. This last one helped me to reach the section of code that was causing the issue. The first approach was to catch and check the exception and check if it is a Gem::Fetcher::FetchError to see if we should keep retrying or jump into the final number of attempts. Then I notice I could pass a StandardError class to a Bundler::Retry object, which will tell the object to only retry the operation if the exception thrown isn’t a StandardError. So far this issue has been tricky because it was caused by a past version of Bundler and I’ve been trying to recreate it in this newest version in order to write tests for it, but so far I haven’t been able to achieve this.

For the second project, I got to work in chatwoot, which is a project for managing customer conversations. The project uses Rails, PostgreSQL, VueJS , and the setup can be done with docker-compose up --build. The issue consisted of displaying a link when a new conversation was created. My first approach was to allow a message to render HTML code, but a better approach is to pass a new parameter to tell the component it should display a link, which is what I’m currently working on!

Debug with debug

As I mentioned, I worked using debug, which is a gem that provides debugging functionality to Ruby. With this, we are able to set up breakpoints within our code

puts 'hello world!'binding.break # <--- Will stop the execution at this pointputs 'bye bye'

Once we reach that breakpoint, we can start using commands such as step to advance to the next line or continue to jump into the next breakpoint. We can also type Ruby code, call methods from the local execution context, and see what values do the variables have.

Decorator pattern

This week I started studying software design patterns with my mentor. Design patterns are a set of solutions for typical problems that can arise when designing software. The first pattern we reviewed is the Decorator.

This design pattern allows us to add functionality to an object by using wrappers (can be seen as adding layers to the object). This pattern can help us to avoid subclass explosions.

Image from Refactoring Guru

Final thoughts

As this phase is coming to an end, this week was intense but filled with many learnings. In particular, this phase taught me about the importance of debugging tools to increase productivity and be certain of some flows and information that a program can have. Lastly, I want to mention how this phase taught me to recognize when to ask for help, it is okay to try to do the task, but if there is a blocker and you have spent many days on that task, it means that it is time to ask for help/advice and there is nothing to be ashamed of since we can learn so much more from it.

--

--

Ximena Sandoval

Cloud Platform Engineer at Encora. Currently learning about CI/CD, Kubernetes and watching Studio Ghibli movies✨