Contributing to Open Source Phase at Encora Apprenticeship — Week 2

Ximena Sandoval
3 min readDec 27, 2021

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

Exploring the open-source community is an adventure. This week I was able to do my first contribution to this community and study algorithms and basic data structures. Come to read more about it in this week’s post!

Contributing to open-source

As I mentioned last week, I picked an issue of the Netlify-CLI repository, where the solution consisted of running a function right after running a certain command. The tricky part of this issue was understanding how mock-up APIs work in order to test the change. I also started working on another issue, this time in the Ruby community. So far I’ve been able to set up the local environment and replicate the issue! The goal of the issue is to implement the same behavior of theinstall to the fetch command to recognize gem versions.

Breakpoints and debugging

While working on the issue, I came across the necessity to use some tool to know what values do the variables have at a given point of the execution of a program. One not so effective way to do this is using the console.log method, but it can take a very long time to get anywhere with this approach. One really useful tool to do this is the debugger.

VS Code comes with a handy built-in debugger for Javascript, Typescript, and other languages. It allows you to set breakpoints to pause the execution and show all the local and global variables’ values.

Revisiting data structures and algorithms

This week I also had the opportunity to revisit some concepts about data structures and algorithms, in particular about Big O notation which is a special notation that tells us how fast an algorithm is given the size of the input, which can also be called the time complexity of the algorithm.

For example, we can define the time complexity of linear search (look for a particular value in a sorted list one by one) as O(n), since in a worst-case scenario, the value we are looking for is at the end of the list, and we would have to look at n values before finding the last one.

SOLID and dependency injection

For my weekly assignments, I got to read about dependency injections, which is a way to achieve separation of concerns. This technique consists of the separation of an object (client)and its dependencies (objects/services it depends on to function). A way to do this is to pass the dependencies via parameters instead of building them inside the object. This way, we are working with an abstraction of the dependencies and if for some reason we need to change/update those dependencies, with can easily do it without touching the client object.

While researching more about this topic, I came across a set of principles for Software Engineering called SOLID, which stands for:

  • S — Single responsibility, to ensure each class has a well-defined objective.
  • O — Open/Closed, open for extension but closed for changes in the class.
  • L — Liskov substitution, which states that we should be able to replace a class with its subclass.
  • I — Interface segregation, to implement only what we need for each class.
  • D — Dependency inversion, which tells us that we should work with abstractions.

Final thoughts

Working with open-source code is a great opportunity to not only learn how to read other people’s code but also to learn more in-depth about technologies that you use or want to use.

I also want to mention the importance of getting to know how to contribute by reading the guidelines and also keeping up with the standards and conventions used for that purpose, such as correct commit messages, coding style, etc.

--

--

Ximena Sandoval

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