Skip to main content

Questions tagged [namespace]

Namespaces are a language feature of many programming languages, allowing local reuse of class and variable names.

3 votes
3 answers
1k views

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 ...
nreh's user avatar
  • 161
3 votes
3 answers
2k views

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, ...
Josiah_Maddux's user avatar
0 votes
1 answer
3k views

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" ... #...
a a's user avatar
  • 261
1 vote
1 answer
1k views

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 ...
Honza Vojtěch's user avatar
0 votes
0 answers
443 views

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....
Vencovsky's user avatar
  • 371
1 vote
1 answer
442 views

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="...
рüффп's user avatar
0 votes
3 answers
494 views

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 ...
Rounin's user avatar
  • 285
3 votes
3 answers
1k views

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 ...
h22's user avatar
  • 937
3 votes
2 answers
311 views

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 ...
errno_44's user avatar
3 votes
2 answers
511 views

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 ...
Roberto's user avatar
  • 193
4 votes
2 answers
1k views

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 ...
john01dav's user avatar
  • 889
1 vote
0 answers
178 views

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 ...
8bitjunkie's user avatar
3 votes
2 answers
1k views

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....
Heinzi's user avatar
  • 9,798
0 votes
2 answers
245 views

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 ...
Dirk Boer's user avatar
  • 444
5 votes
2 answers
2k views

Suggestions for documenting namespaces with Doxygen

Consider several C++ classes which are all defined in a particular namespace. For cleanliness, each class is located within its own file, and are each well-documented. For the purposes of completing ...
John Go-Soco's user avatar

15 30 50 per page
1
2 3 4 5
7