Happiness is… a freshly organized codebase

Starting From the Top Imagine joining a new team at a new company and you finally get access to a codebase.  Slack iOS Xcode File Hierarchy 2017 Where do you add a source file for your team’s project? Great question. Your new team has three source directories for you to add files to, and oh,…

Erica Engle
9 min readadvanced
--
View Original

Overview

The article discusses the challenges and strategies of organizing a codebase, particularly within Slack's iOS team. It highlights the importance of a well-structured directory and file organization to enhance developer experience and efficiency.

What You'll Learn

1

How to create a coherent folder hierarchy for a codebase

2

Why maintaining a clean codebase improves developer productivity

3

How to implement tooling to enforce folder organization rules

Prerequisites & Requirements

  • Understanding of codebase structure and organization principles
  • Familiarity with Xcode and version control systems like Git(optional)

Key Questions Answered

What are the main challenges faced when organizing a codebase?
The main challenges include navigating a chaotic file hierarchy, determining where to add new files, and managing merge conflicts during refactoring. These issues often arise due to a lack of clear architecture patterns and the growth of the development team.
How did Slack's iOS team improve their codebase organization?
The iOS team improved their codebase organization by establishing a coherent folder structure, implementing tooling like Danger for enforcing rules, and creating a committee to oversee the organization process. This approach facilitated easier file management and enhanced developer experience.
What specific strategies were used to move source files into a new structure?
The team employed strategies such as moving high-level directories into a coherent order and establishing clear rules for file placement. They also utilized tooling to automate checks and ensure compliance with the new organization patterns.

Key Statistics & Figures

Number of files in the codebase
13,000
This highlights the scale of the organization challenge faced by the Slack iOS team.
Number of top-level directories
27
The complexity of managing so many directories contributed to the need for a more organized structure.
Number of iOS developers
40
The growth of the development team necessitated clearer organization to improve collaboration.

Technologies & Tools

Development Environment
Xcode
Used for managing the iOS codebase and implementing the new folder structure.
Version Control
Git
Used for tracking changes and managing the codebase during the restructuring process.
Automation Tool
Danger
Integrated into the CI system to enforce rules on file organization.

Key Actionable Insights

1
Establish a clear folder hierarchy to improve codebase navigation.
A well-defined structure allows developers to quickly locate files, reducing onboarding time for new team members and enhancing overall productivity.
2
Implement tooling like Danger to enforce organization rules.
Using automated checks can prevent developers from adding files to incorrect directories, ensuring adherence to the established structure and maintaining code quality.
3
Create a committee to oversee codebase organization efforts.
Having a dedicated group can facilitate discussions around best practices and ensure that all team members are aligned on the organization strategy.

Common Pitfalls

1
Failing to establish a clear directory structure can lead to confusion among developers.
Without a coherent organization, developers may struggle to find files, leading to frustration and decreased productivity.
2
Ignoring the importance of tooling can result in inconsistent file organization.
Without automated checks, developers may inadvertently add files to incorrect directories, undermining the efforts to maintain a clean codebase.

Related Concepts

Codebase Organization
File Hierarchy Management
Development Team Collaboration