Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

Questions tagged [namespace]

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

Filter by
Sorted by
Tagged with
2 votes
2 answers
147 views

In PHP, trim() exists. By default the second parameter is " \n\r\t\v\x00" I wish to introduce my own version which doesn't deviate far from the core functionality: // Trim whitespace in ...
MonkeyZeus's user avatar
-2 votes
1 answer
327 views

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

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
3k views

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
4k views

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
2k views

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
498 views

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
643 views

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
675 views

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
  • 295
3 votes
3 answers
2k views

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
  • 966
3 votes
2 answers
356 views

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
591 views

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
2k views

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
192 views

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

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,868
0 votes
2 answers
306 views

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
  • 454
5 votes
2 answers
3k views

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
-2 votes
1 answer
76 views

I have many models in my project that are unrelated to each other. I wanted to group them but I wonder what's better: Folder/namespace per group Group1.Constants, Group2.Constants Group1.Models, ...
Konrad's user avatar
  • 1,569
-1 votes
1 answer
2k views

Some time ago I read from this book that namespaces inside libraries should be distributed in a way that inner namespaces have more concrete classes than their parent namespaces. We can find an ...
amedina's user avatar
  • 109
9 votes
2 answers
9k views

Is there a general coding convention in ordering namespaces? Is it always order of importance, or alphabetical? Currently I order by main important ones first. I know it does not affect program, just ...
CarSpeed87's user avatar
0 votes
1 answer
134 views

I am creating an Online Shopping Cart store. It is built through Net MVC Core. There is a Front End View website: html, css, razor. Then we have backend code design for Customers: including shopping ...
MarkAllison's user avatar
2 votes
1 answer
375 views

When working within a single project that contains multiple namespaces, should these namespaces be treated as boundaries? Or is it acceptable that any namespace can access any other namespace? For ...
Jason Tyler's user avatar
4 votes
2 answers
1k views

To learn Javascript I am building a simple Single-Page Application. It is a basic slideshow app that needs only to process some basic settings and execute some behaviors. The basic structure of my ...
sddaa's user avatar
  • 41
1 vote
1 answer
7k views

In some code bases (such as hydra, and thrust's tuple implementation) I see namespaces defined entirely with macros. It appears the reason for this is so that you can configure the namespace to your ...
Krupip's user avatar
  • 1,347
0 votes
3 answers
749 views

For the purpose of writing a library, I found to be nice to add types to some well known namespace. Example: I've written a couple of extension methods for BinaryWriter and naturally put them in ...
aybe's user avatar
  • 955
6 votes
2 answers
3k views

In official Microsoft docs: ✓ DO use a stable, version-independent product name at the second level of a namespace name. But in Reference Source, the following namespaces ends with Version: ...
Jawad Al Shaikh's user avatar
4 votes
2 answers
604 views

I looked trough some of my older code and found that I was using the using namespace directive. From what I read in a lot of google results, it seems that it is never a good idea to use this. Is there ...
Hakaishin's user avatar
  • 197
8 votes
2 answers
9k views

Say I am developing a Calculator application. It has one class called: Calculator. Therefore my namespace structure would look like this: MyCompany.Calculator.Core.Calculator Unfortunately, this is ...
w0051977's user avatar
  • 7,139
2 votes
3 answers
979 views

In the C++ community it is considered an extremely bad practice to type: using namespace something; in the scope of the file for any reason, even if the project size is only a few hundred lines at ...
gaazkam's user avatar
  • 4,529
4 votes
2 answers
1k views

In the title, with namespace-related elements, I refer to Enums, Delegates and other elements that do not belong to a single class, but to the whole namespace, or application. I know that I can cram ...
oneManArmin's user avatar
-1 votes
6 answers
6k views

It's been considered for a reason, that using for namespaces/names is side-effect-prone, and generally, fully qualified names should be preferred. I've come up with an approach on that, which I ...
user avatar
33 votes
4 answers
44k views

I'm building libraries with various small utility functions in C#, and trying to decide on a namespace and class naming convention. My current organization is like this: Company Company.TextUtils ...
user's user avatar
  • 555
5 votes
1 answer
2k views

Scenario: An open-source PHP project that has existed for several years has too many classes in the main namespace that we want to refactor some of them into another namespace, but we have a widely ...
SOFe's user avatar
  • 728
3 votes
0 answers
519 views

I want to know how to structure my Service Layer I have thought about something like that: Assembly called SomeNamespace.Service. Have a seperate folder for each problem domain (SomeNamespace.Service....
Christian Gollhardt's user avatar
6 votes
2 answers
13k views

The replies in this post come very strongly against including headers inside a namespace and Doxygen is confused if that is done (which suggests that its team did not consider that usage either). I ...
AlwaysLearning's user avatar
0 votes
1 answer
136 views

I'm writing a boolean that will toggle between these two forms for writing markup into my strings, but I do not know what I should name my boolean. bool setMarkupForm(bool markupForm); Is not ...
Anon's user avatar
  • 3,649
0 votes
3 answers
547 views

I am currently working in an aleady developed C++ project. The existing files are the following: -main.cpp -HydroModel.cpp -ODESys.cpp -HydroModel.hpp -ODESys.hpp -ODESysSol.hpp In the file ...
Muthahu6's user avatar
3 votes
3 answers
3k views

C++ has namespaces to prevent collisions of things with the same name. Header guards serve a different purpose. They prevent includeing the same header twice. However, they can suffer from the same ...
null's user avatar
  • 3,767
2 votes
1 answer
114 views

This might sound weird and probably is, but I am struggling to find a good place where to place what I will just call "Doers" for lack of a better name. Basically, my project currently has these ...
F.P's user avatar
  • 609
1 vote
3 answers
5k views

Is it generally considered good practise for a class name to reflect the namespace name it exists under, or should the namespace name implicitly be considered part of the class name? For example, ...
Daniel's user avatar
  • 239
4 votes
1 answer
160 views

I am developing a project in C++ that deals with converting an ASCII hexadecimal string representation into binary. The class also has utilities in it for extracting info from the string. Right now ...
Petyr Panos's user avatar
2 votes
2 answers
2k views

What would be a good system to use domain names as C++ namespaces in order to avoid name clashes between developers? The idea appears to be popular in the Java world. We cannot use namespace example....
Lasse Kliemann's user avatar
8 votes
3 answers
20k views

I have a problem how to go about naming my namespaces and classes. I already figured they shouldn't both have the same name, as it causes all kinds of problems. Most notable problem for me is that I ...
Łukasz's user avatar
  • 183
3 votes
2 answers
304 views

I know this might be a very basic question, but I'm new to XML serialization and spent hours trying to read different pages. PS: this is a programming language independent question.
AhmedWas's user avatar
  • 147
8 votes
1 answer
27k views

I generally like to organize classes I make into modules by using namespaces, and I also don't go more than 2 namespaces deep but it's still painstakingly hard to fully qualify everything. I've ...
John Mark Caguicla's user avatar
3 votes
1 answer
441 views

PHP (PSR-2, anyway) recommends using the vendor name as the root namespace for projects. At face value, this seems to mean we should use the current name of our company. But I work for an enterprise ...
kojiro's user avatar
  • 2,095
8 votes
3 answers
8k views

It is good programming style to include all necessary dependencies in a header that references them. Often this includes declarations that are placed in the STD & global namespaces (like cstdio). ...
bgulko's user avatar
  • 101
3 votes
0 answers
564 views

"Traditional" namespaces in the sense that Java, C#, and PHP use it. Spaces to organize related classes and sub-namespaces that span across multiple files. How do I rewire my brain to think without ...
budhajeewa's user avatar
13 votes
1 answer
9k views

Why did C++ make any distinction between static globals (internal linkage) and symbols in an unnamed namespace (external linkage, but no way to refer to it from outside anyway), when introducing the ...
Deduplicator's user avatar
  • 9,319
3 votes
1 answer
121 views

The project I'm working on has quite a few classes. These classes can be grouped in two different ways. I'm trying to decide which grouping is best as for namespacing. Currently I a set of user facing ...
innova's user avatar
  • 1,051