Questions tagged [namespace]
Namespaces are a language feature of many programming languages, allowing local reuse of class and variable names.
98 questions
-2votes
1answer
254views
What is a component in C#?
Introduction Components are an important building block of software. In terms of software architecture, there are a lot of principles regarding components that should be adhered to (high cohesion, low ...
3votes
3answers
2kviews
C++ Is it okay to use nested classes as a way to namespace derived classes?
I have many abstract classes that describe many abstract ideas and objects. These classes have many complex relationships with each other, and I realize that while writing code with some of the ...
3votes
3answers
3kviews
Why would you have a different namespace for each folder in a C# project?
I can't see how having a namespace for each folder makes sense. As near as I can tell, the point of having namespaces is to avoid name conflicts. But, Microsoft, in their namespace naming conventions, ...
0votes
1answer
3kviews
aliases for namespaces in headers?
Everytime I write a header I end up doing something like this: #ifndef D723E2D5_1943_4166_87CC_73F5C9C47544 #define D723E2D5_1943_4166_87CC_73F5C9C47544 #include "RandomIntegers.hpp" ... #...
1vote
1answer
1kviews
Namespace hierarchy in C#
I have a C# class library shared among several applications. The library is divided into a few smaller components which have dependencies shown in the picture below. Each component is placed in its ...
0votes
0answers
474views
Is it a bad practice to have a class with a namespace that goes "out" of it's project name?
I have a solution with multiple projects, lets suppose there's one project with the name Company.Name.Foo.Bar. If I declare a class inside the project Company.Name.Foo.Bar but with a namespace Company....
1vote
1answer
550views
Is it a good practice to have XML document with no-namespace elements in the middle
I have an XML looking like this: <?xml version="1.0" encoding="utf-8"?> <n0:OrderConfirmation xmlns:n0="http://company.org/interface/MVSI" xmlns:ord="...
0votes
3answers
605views
Using the symbol ⎋ to denote any "escape" in Javascript, CSS, HTML etc
I know that: Computer keyboards have an Escape Key The symbol for the Escape Key is U+238B Broken Circle with Northwest Arrow (⎋) and I also know that: HTML5 & CSS3 both have escape characters ...
3votes
3answers
1kviews
Are namespace constructs like 'using std::string' unacceptable also in .cpp files?
I understand the rationale of avoiding using namespace std - this defines too many casual names the developer may not be even aware of. I tried to work around the problem with the help of using ...
3votes
2answers
334views
Am I using namespaces wrong?
I'm obsessed with organization - it's probably the real reason why I enjoy coding. So I namespace everything. But I'm just curious if I'm doing it wrong by being redundant. Consider this, which I ...
3votes
2answers
549views
Should I use other framework's namespaces in my code?
I'm writing some tools to be used on the top a specific framework, in C#. Most of my code should use the naming convention CompanyName.TechnologyName[.Feature][.Design], but I wonder if in some cases ...
4votes
2answers
2kviews
How can I cleanly handle deeply nested namespaces in C++?
The first language that I truly learned was Java. In it, it is very syntactically easy to nest classes in an essentially arbitrarily complex package hierarchy, which keeps the code organized. It is ...
1vote
0answers
184views
Can/should multiple application contexts share a common microservice in a single namespace?
My current employer has a single namespace into which all microservices for all projects are deployed. Projects A, B and C all use microservice x in this common namespace: Rather than each design and ...
3votes
2answers
2kviews
Refactor namespaces in a library while keeping backwards-compatibility
We developed a generic .NET library for our line-of business applications. This is what our namespace/class structure looked like 5 years ago: ... AcmeCorp.Tools.ExcelWriter AcmeCorp.Tools....
0votes
2answers
283views
When no other class ever needs to touch the (nested) class - should I always make it a (private) nested class?
And what is the recommended file structure? The question is a bit similar to this one, but I'm looking for more explicit recommendations. In theory I think it's a good concept to keep files short ...