📓 3.0.0.21 The Shape Tracker Project Structure
Now that we know the basics of compiling and executing C# programs, we're ready to start building the C# Shape Tracker console app. In this lesson, we'll start creating our project's structure and discuss how we'll organize our code into namespaces and classes.
You are welcome to code along with this pre-work, or just read through it. GitHub repository references for the Shape Tracker console app will be provided periodically throughout this walkthrough.
Shape Tracker Project Structure​
We're going to walk through the setup process step by step and explain all of the decisions we're making along the way. As we'll see, much of the setup we did for the "Hello World" application will be the same in our new Shape Tracker console app, with some notable differences. You can follow the setup process outlined in this lesson for all of the projects you create in this course section. There will also be a project structure configuration reference at the very end of this pre-work section.
By the end of the lesson, we'll have the following file/folder structure:
ShapeTracker.Solution/
├── ShapeTracker/
│ ├── Models/
│ │ └ ── Triangle.cs
│ ├── ShapeTracker.csproj
│ └── Program.cs
├── .gitignore
└── README.md
Notice that we use Pascal case, or "UpperCamelCase", for all .NET files and folders (excluding README.md and .gitignore).
The "Parent" or "Root" Directory​
We'll start by creating the parent directory called ShapeTraker.Solution. We can also call this the root directory, because it is the directory that will contain all of our project's subfiles and subfolders. This will include source code for the console app, as well as another folder that we'll add later that will contain all of the unit tests we write for our source code.
In the example projects at Epicodus, you'll see that we regularly include the word 'solution' in the name of our parent directory. When we Include 'solution' this indicates that this directory is a complete solution to the given project prompt. In this case ShapeTracker.Solution contains all of the code relevant to the Shape Tracker project. Note that it is not required to follow the naming convention of including "solution" in the parent directory's name.
.gitignore and Initializing Git​
Within the parent directory ShapeTracker.Solution, add a .gitignore file. Within our .gitignore we'll add our obj and bin folders because both of these are auto-generated in the process of compiling our console app:
- The
objdirectory contains the resources our code needs. - The
bindirectory contains our compiled output code.
obj
bin
Next, we'll want to initialize Git in our parent directory with the command git init. The very first thing we'll want to do is track our .gitignore file so that Git knows to ignore the obj and bin directories.
Our file/folder structure should now look like this:
ShapeTracker.Solution/
└── .gitignore
The "Project" or "Production" Directory​
Next, we'll create a subdirectory within ShapeTracker.Solution called ShapeTracker. The ShapeTracker folder will contain the source code for our project, and because of that, this directory is commonly called the project directory or production directory.
Our file/folder structure should now look like this:
ShapeTracker.Solution/
├── ShapeTracker/
└── .gitignore