What's a proper way to organize the packages?

  • Thread starter Thread starter K Viltersten
  • Start date Start date
K

K Viltersten

I have a solution called Solution and in it,
two projects named Project1 and Project2.

I've organized the packages in a common
namespace ComNamSpc. I.e., i have this,
in each of my source code files.

namespace ComNamSpc{ class Project1{ ... } }
namespace ComNamSpc{ class Project2{ ... } }

Now, Resharper tool claims that i should
call each project by its name as follows.

namespace Project1{ class Project1{ ... } }
namespace Project2{ class Project2{ ... } }

Is it really recommended? Can i/should i put
the namespaces in a common super namespace?
 
Now, Resharper tool claims that i should
call each project by its name as follows.

namespace Project1{ class Project1{ ... } }
namespace Project2{ class Project2{ ... } }

Is it really recommended? Can i/should i put
the namespaces in a common super namespace?

It depends on your project, and what works best for you. For the root
namespace of a project, I usually use something along the lines of:

Company.Solution.Project

.... and of course, break it down into any additional namespaces
necessary, which depends entirely on the project. It's probably best
to not have more than four levels of namespaces in your application, so
Company.Solution.Project as a root namespace gives you enough wiggle
room to divide your project up into one level of namespaces, reasonably
speaking. I suggest four levels just because it tends to be easier to
remember them that way, at least for me.

--- Mike
 
K said:
I have a solution called Solution and in it,
two projects named Project1 and Project2.

I've organized the packages in a common
namespace ComNamSpc. I.e., i have this,
in each of my source code files.

namespace ComNamSpc{ class Project1{ ... } }
namespace ComNamSpc{ class Project2{ ... } }

Now, Resharper tool claims that i should
call each project by its name as follows.

namespace Project1{ class Project1{ ... } }
namespace Project2{ class Project2{ ... } }

Is it really recommended? Can i/should i put
the namespaces in a common super namespace?

I think it is a good practice if project:namespace:dll
is 1:1:1.

That makes it a lot easier to find things.

If you want some commonality between the two then
use Sol.Proj1 and Sol.Proj2.

Arne
 
I have a solution called Solution and in it,
I think it is a good practice if project:namespace:dll
is 1:1:1.

That makes it a lot easier to find things.

If you want some commonality between the two then
use Sol.Proj1 and Sol.Proj2.

Thanks!
 
Back
Top