Step 3 – designing the project structure
Although one can design their project structure according to their tastes, I design mine in a way that makes it easy for whoever looks at my project to understand what it does and where each moving part is located.
Following this principle, all commands will be grouped in a folder named Commands
. This folder will be created at the root of the project structure.
Since we will be refactoring the export
command, let’s create a subfolder named Export
where all the code artifacts involved in the export
command will be located.
Once we start refactoring another command, we will create a specific folder for it.
What about subcommands of a command?
Following the principle of encapsulation in object-oriented programming, and since a subcommand can only be invoked through its parent command, I recommend locating subcommands in the same folder as their parent command.
An example of that is the link add
command. The add
subcommand...