Starting a project with Visual Studio is really easy process. There are just few steps, how many depends on the project template, to get going with new idea. You just go to File -> New -> Project…
then choose the best template that suites your needs, put desired name to it, click OK and you have got yourself a brand new project that is ready to use. You can start coding, right ? There’s always a but, isn’t it ? Yes you can, but you should bear in mind one thing, a project naming convention which determines your project directory tree and has an impact on a C# namespaces.
Examples are the best way to explain a point. I, myself, am a Web Developer so I’ll use a MVC project template as an instance. Let’s create a empty ASP.NET MVC 4 Web Application project and I’ll try to get you through my thinking.
Imagine that we are creating some kind of application for heater company. I’m a little bit cold right now so this is why heaters company, nothing in particular. Let’s say that the company name that we are doing the project for is HeatItUp. They want for themselves a nice website. We already know the first step, File -> New -> Project… and then we choose template and name, easy.
Although project is perfectly fine, in the end the Microsoft shiped the template, you should be aware of the way Visual Studio creates for you project directories. Notice the two input fields for Solution Name and Name (Project Name) in the New Project Window. After creating it like on the above screenshot you will end up with situation like that:
You can see that you’ve got Solution named HeatItUp and Web Application Project (website) named the same way. This is bad from the logic and good practices point of view. Logic, because project named like that does’t say anything to anyone besides you, the creator, about itself. Nobody knows if it is a WPF, WinForms, just a library or as it really is a Web Application unless they open it and look closely. Good practices because of the mentioned above and everything that corelates with it, generated directory tree and namespaces in your code. Little advice, always keep your namespaces clear and tidy because in large projects you can get really confused and even lost when they are poorly designed and when it comes to namespace refactoring…pure evil.
Ok, but even when I made a mistake with the Web Application project name I can easly change it in the Soultion Explorer. Yes, but don’t, because it changes nothing but the *.csproj file name, directories tree and namespaces are still the same. Obviously you can change folder names by yourslef and edit *.csproj file and change RootNamespace tag, refactor all the namespaces and it’s done. Sure, you can, but the price is really high, a lot of effort.
Solution to this issue is just to keep in mind these two input fileds on the New Project window while creating new project, Solution Name and a Name aka Project Name. Or you can do it my way, start with the Blank Soultion
and add systematically projects that you need, always thinking about others who will work, inspect and try to understand the project solution.