Imagine that you want to create a new algorithms library.
For instance:
namespace Com.MyCompanyName.LibraryPathfinding
{
//...
}
Another one could import this library (include namespace) and use it.
For instance:
using Com.MyCompanyName.LibraryPathfinding
namespace Com.YourCompanyName.ProjectX
{
//...
//ProjectX is a game
}
My question is:
If LibraryPathfinding use some kinds of util class which like "PriorityQueue", how to set PriorityQueue's namespace?
(1):
namespace Com.MyCompanyName.LibraryPathfinding.Collections
{
public class PriorityQueue
{
////
}
}
(2) :
namespace Com.MyCompanyName.Collections
{
public class PriorityQueue
{
////
}
}
If choose (1), it means PriorityQueue is a part of LibraryPathfinding.
The advantage of this is:
LibraryPathfinding is completely independent.
If your project need pathfinding, just import "Com.MyCompanyName.LibraryPathfinding"
The disadvantage of this is:
Whenever your project need PriorityQueue, you must import "Com.MyCompanyName.LibraryPathfinding", even though ProjectX don't need Pathfinding.
For instance: In ProjectX, AIManager need a aggro list which use priority queue. But aggro list shouldn't dependent on Pathfinding!
If choose (2), it could resolve (1)'s problem.
The disadvantage of this is:
LibraryPathfinding will be not completely independent.
If you want to use LibraryPathfinding, you must import Com.MyCompanyName.Collections and Com.MyCompanyName.LibraryPathfinding. This means: you must release two libraries (to your user)!
Any advice would be very appreciated.
Thanks.
Aucun commentaire:
Enregistrer un commentaire