How do you understand the large code base of okteto?

Hi, this might sound like a very silly question to all the people out there who are contributing to the code base of okteto.

Background: This is my first time coming up with solving an issue that involves coding and believes this is one of the best ways for me to get started with code contributions to okteto. Here’s the issue that I’m currently working on: Show spinner while checking if the image needs to be built · Issue #3433 · okteto/okteto · GitHub

Here are the following questions that I’d like to be guided about from the community:

  1. What is the approach you follow to understand a large code base of any project, for eg. okteto?

  2. How do I use okteto CLI with my latest changes being applied?

  3. Let’s assume I’d like to modify a specific function. Do I need to understand each and every line of that function - including arguments, why are they being used? How do you go about it?

Looking forward to your response!

Hi @NitishKumar06 !

First of all thank you for your interest in okteto :heart:

I’ll try to be as explicit as possible, but follow up with more questions if needed :smiley:

What is the approach you follow to understand a large code base of any project, for eg. okteto?

  • Check for docs. In okteto we have
  • Check for issues and prs to get a sense of what’s going on
  • Be familiar with the programming language: We are using golang and we are using the cobra package in order to create a CLI. Understanding this will help you a lot to traverse the files from main.go to its imports as if they were a sort of tree directory structure. If you check main.go you’ll see that all the commands get registered there. This is a great starting point to explore.
    We are following the standard of having a cmd folder and a pkg folder.
  • Ask and cooperate: This post is exactly that, asking to the community in order to know what to do and how to get guidance
  • Get a sense of the tool: In order to understand the concepts that are described in the code, you’ll need to have some knowledge as a user

Anyways, this is my POV so complement it with other online resources like How to Contribute to Open Source Projects – A Beginner's Guide

How do I use okteto CLI with my latest changes being applied?

There are docs on this here.

The main idea is that you will compile the code with golang and that will output an executable binary file. Then, you can use that binary as if you’d use the classic okteto cli command in order to test your changes. If you are interested in what’s going on under the hood, check out the Makefile which what’s being used with make. Makefiles are one of the most common developer shortcuts to writing commands

Let’s assume I’d like to modify a specific function. Do I need to understand each and every line of that function - including arguments, why are they being used? How do you go about it?

At first I’d follow “the less you know the better” approach in order to not overload yourself. Try to be as atomic and scoped as possible in order to fulfill your particular need. This is very hard to do since often times the code is entangled with other pieces that affect your behavior, but it’s a great way to start digging into the project. I’d suggest trying to get a sense of inputs and outputs first, and then dig into the logic inside


All this being said, if you found any of this useful and think of a way to distribute this knowledge as docs in the repo, feel free to open a PR :smiley:

Happy coding!

1 Like

@AgustinRamiroDiaz Thanks for mentioning these points! I appreciate you spent time writing this:)