Navigating New Codebases
March 4, 2023 ยท View on GitHub
Projected Time
About 30 mins
Prerequisites
N/A
Motivation
-
If you are an early career SE, you will most likely navigate code databases that you may not be familiar with. That is ok - it happens! This lesson is to help you quickly become familiar with new codebases.
-
Web development frameworks for programming languages are created to ease the process for simpler and faster coding. Popular programming languages examples and their major frameworks in parentheses include:
- Ruby (Ruby on Rails)
- Python (Django, Flask, Pylons)
- PHP (Larvel)
- Java (Spring)
- Scala (Play)
-
Companies such as GitHub and Airbnb uses Ruby on Rails whereas Instagram, Dropbox, and Spotify use Django. Most, if not all, of the source code, has already been written - as a web developer, you will need to quickly interpret the code and either add to the code or debug any issues associated with the code.
Objectives
Participants will be able to:
- Learn how to explore and understand the code that you do not know
- Help contribute to open source projects
- Be comfortable with trying to understand different popular web development frameworks
Specific Things to Learn
- Add a feature to an existing codebase (that you are unfamiliar with)
Materials
Lesson
- Read the article and watch the youtube video here: 5 tips to quickly understand a new code base
Common Mistakes / Misconceptions
- Do not assume that the version of the framework or language is the same that you know or have.
- Always ask other fellow SE for help. It is the best way to understand something that may be confusing or needs clarification.
Guided Practice
Generally, most web development frameworks can be used to create simple applications, such as a todo-list. Find a GitHub repo that creates a todo-list app and uses a framework that you are not familiar with. Would you be able to understand the codebase? Why or why not? Discuss with a peer.
Independent Practice
For the same project repo, look at the code and a draw a diagram of the file tree of the project (e.g., top-level directory, 1st level, 2nd level, etc). This will help you visualize the file hierarchy. After, take a look at the docstrings, or comments that were made when the code was written and see whether you can understand it. You will most likely need to improve the docstring so think about whether the information is useful for your future self and other SEs.
Challenge
Using the same repo you found, clone it, try to add an additional feature (e.g., search field/form) to their code following the tips described.
Check for Understanding
Explain to a peer how you were able to add the feature to the codebase using the framework that you were once unfamiliar with.