Namespaces are a language feature of many programming languages, allowing local reuse of class and variable names.
0
votes
0answers
39 views
Code architecture for separate apps facilitating the same process
So I am at a cross roads with deciding on my integration strategy for a few of our business apps that play a role in a larger process. Being the only developer and never having to do this before leads ...
2
votes
2answers
111 views
Why do we need namespaces when making XML serialization?
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.
5
votes
1answer
152 views
Importing namespaces inside another namespace
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 ...
2
votes
1answer
101 views
“Vendor” name changes when the vendor name changes
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 ...
3
votes
3answers
302 views
C++ Extensible namespaces - how to force declarations back into global namespace
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). ...
2
votes
0answers
179 views
Why aren't there traditional namespaces in TypeScript? How do I group classes without them?
"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 ...
7
votes
1answer
871 views
static globals and anonymous namespaces in C++
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 ...
3
votes
1answer
75 views
Namespace by topic or by purpose? [closed]
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 ...
15
votes
4answers
583 views
Semantically more appropriate package name than `util` for the following things?
As a strawman consider the package java.util it is a dumping ground for various classes that in most cases do not share anything in common other than the person that put them there was lazy or ...
5
votes
1answer
407 views
Nested classes via a getter (to emulate namespacing)
So, we all know that ES6's introduced syntax is definitely sugar over what we've been doing, previously. That being said, we still don't have namespaces (which would be nice...)
The problem that I'm ...
1
vote
1answer
107 views
Clojure NameSpace Design
I am new to Clojure and trying to get a handle on organizing a project's namespaces. I am working on a solver for the knapsack problem. Currently, I have broken the modules into files, but everything ...
0
votes
1answer
392 views
Python, namespace vs module with underscores
I'm developing a project that uses several independent modules, but all related to the same project.
However, I face this choice: module names with underscore vs. namespaces.
For example there is ...
3
votes
2answers
246 views
Free Standing Functions in Global Namespace
When writing non-member, free functions, can they be placed in the global namespace so long as the signature specifies a namespace-scoped object? For example, in the code below, is "Example 2" ...
3
votes
1answer
193 views
When to use nested classes and when to use namespaces?
I have really never made use of namespaces, and am considering them at the moment.
My situation. I have a class Reverb. It contains as members instances of other classes, declared in the same header ...
0
votes
1answer
599 views
Best practice for using namespaces in my PHP libraries
I've been using a tiny and neat caching library on my projects, but I realize that "Cache" is a very generic name and it's easy to get a collision when using it in large projects.
Also, I would like ...
12
votes
1answer
689 views
Naming convention for iOS/OSX open-source projects
Not always but most of the time, you will find iOS or Mac OS X open-source projects with names starting with the initial letters of the author first and last names. If a project were to be authored by ...
3
votes
1answer
153 views
How to tell that a Javascript code already needs AMD (RequireJS, …)?
At some point code is complicated less if you introduce a new abstract than if you continue as it was.
Some trigger should fire in a head of a programmer. Like, I was coding fine, but now I've added ...
4
votes
2answers
193 views
Why do XML namespace URIs use the http scheme?
A XML namespace should be a URI, but it can use any URI scheme, including those that are not URLs.
Then why do all widely used XML namespaces use the http scheme (e.g. ...
2
votes
2answers
596 views
With AMD style modules in JavaScript is there any benefit to namespaces?
Coming from C++ originally and seeing lots of Java programmers doing the same we brought namespaces to JavaScript. See Google's closure library as an example where they have a main namespace, goog and ...
2
votes
1answer
399 views
How can I identify a namespace without using a string literal?
My team has a lot of IOC conventions that look something like...
if (type.Namespace == "My.Fun.Namespace")
{
// do stuff
}
Of course, maintaining this kind of thing becomes brutal after awhile, ...
0
votes
1answer
1k views
How to use namespaces to separate interface from implementation, in c++?
As far as I can tell, you can make your interface known to others by providing your .h file. Your .cpp is the implementation. Then they can see the function names, the parameter types, the return ...
2
votes
1answer
809 views
Separate namespace just for exceptions?
I was doing a code review and came across something odd which I've never seen before. The developer decided to create a sub-namespace just to contain all the assembly's exceptions.
I thought I had ...
0
votes
0answers
893 views
Ruby module namespacing advice
in my current project have:
module Stats
class Site
...
end
class Product
def initialize(product_id)
@product_id = product_id
end
end
class Profile
...
end
end
...
3
votes
6answers
2k views
Nested Classes or Namespace
Why do need namespaces when we have nested classes. What can be done through namespaces, can also achieved through nested classes.
so I don't understand the reasoning of having namespaces ?
15
votes
1answer
8k views
Pros and cons of namespaces vs include/require in PHP?
I recently started using namespaces in PHP. When I first saw them, I thought that their syntax was ugly and I'd never use them. However, I created an autoloader (spl_autoload_register) that makes it ...
3
votes
2answers
125 views
Should package structure closely resemble class hierarchy?
Pretty simple question. Should package structure closely resemble class hierarchy? If so, how closely? Why or why not?
For instance, let's say you've got class A and class B, plus class AFactory ...
1
vote
1answer
298 views
Organization standards for large programs [closed]
I'm the only software developer at the company where I work. I was hired straight out of college, and I've been working here for several years. When I started, eveeryone was managing their own data as ...
34
votes
6answers
3k views
Why is “tight coupling between functions and data” bad?
I found this quote in "The Joy of Clojure" on p. 32, but someone said the same thing to me over dinner last week and I've heard it other places as well:
[A] downside to object-oriented programming ...
0
votes
3answers
2k views
What are the good practices for including namespaces in C++ that avoid more typing?
I am starting out with C++ and almost everywhere I see there is these 2 sentences at the top.
#include <iostream>
using namespace std;
As I understand namespaces are something to keep names ...
5
votes
3answers
285 views
How should modules access data outside their scope? [closed]
I run into this same problem quite often. First, I create a namespace and then add modules to this namespace. Then issue I always run into is how best to initialize the application? Naturally, each ...
7
votes
2answers
1k views
Why use typedefs for structs?
in C (ANSI, C99, etc.), structs live in their own namespace. A struct for a linked list might look something like this:
struct my_buffer_type {
struct my_buffer_type * next;
struct ...
1
vote
1answer
788 views
Nested classes vs namespaces
Is it good to use nested classes or should I use namespaces instead?
In context:
I have a templated codec loader and a codec have In objects and Out objects
template<class TypeOfData>
class ...
0
votes
1answer
767 views
Is C# namespace should be Project-Name? [closed]
I am working with multiple websites (freelancer) and a good amount of them I write using C# MVC4.
I created a very good boilerplace project that I plan to use on every next starting mvc4 application ...
8
votes
4answers
1k views
When to import names into the global namespace? (using x::y, from x import y etc.)
I've been programming in various languages for about 10 years now. And I still haven't figured out when it is a good idea to import something into the global namespace (using x::y in C++, from x ...
1
vote
1answer
339 views
Handling table name collisions in Django
Django creates a table name by joining the app label with the model name. A project can have many apps. If two have the same label, how can both be used in the same database?
I'm currently using very ...
3
votes
1answer
188 views
Advices on structure and names for namespaces and classes [closed]
I'm resistant to calling the "main" class the same as the namespace, but I sometimes find myself needing it. Considering I'm using the Vendor.Namespace.[Subnamespace].Class formula, imagine this ...
41
votes
4answers
3k views
Why do so many namespaces start with com
I've noticed that a lot of companies use "reverse domain name" namespaces and I'm curious where that practice originated and why it continues. Does it merely continue because of rote practice, or is ...
3
votes
1answer
247 views
What is meant by namespaced content and what advantages does it have?
I was reading this blog by James Bennett regarding HTML vs XHTML . He writes :
I don’t have any need for namespaced content; I’m not displaying any
complex mathematical notation here and don’t ...
7
votes
1answer
3k views
What should be done with class names that conflict (common) framework names
What should be done exactly when the most obvious class name for a component is taken by a framework? In my case, I need to make a class that describes an HTTP request. Of course, the most common name ...
1
vote
1answer
384 views
Does putting types/functions inside namespace make compiler's parsing work easy?
Retaining the names inside namespace will make compiler work less stressful!?
For example:
// test.cpp
#include</*iostream,vector,string,map*/>
class vec { /* ... */ };
Take 2 scenarios of ...
5
votes
3answers
154 views
Where do I place my example implementations in my framework?
I've created a pretty simple templating framework and have default implementations for some of my interfaces used for passing around information. I store these in MyFramework.Default namespace
...
6
votes
1answer
275 views
Should classes from the same namespace be kept in the same assembly?
For example, ISerializable and the Serializable Attribute are both in the System.Runtime.Serialization namespace, but not the assembly of the same name. On the other hand, DataContract attributes are ...
3
votes
2answers
2k views
Derived Classes and namespaces
I am deriving a class, for use in my application, from a class provided by another group. Should the derived class be in the namespace for my application or the namespace of the parent class?
While ...
14
votes
4answers
13k views
Why do we need URIs for XML namespaces?
I am trying to figure out why we need URIs for XML namespaces and I cannot find a purpose for that. Can anyone brighten me a little showing their use on a concrete example?
EDIT:
Ok so for ...
3
votes
1answer
3k views
How to choose a good namespace name? (Linguistically)
English in not my native language, therefore it is a little more difficult to pick a good name for a namespace. One example to make you see my problem a bit better:
We have a set of classes that have ...
1
vote
1answer
2k views
Dynamic Class Inheritance For PHP
I have a situation where I think I might need dynamic class inheritance in PHP 5.3, but the idea doesn't sit well and I'm looking for a different design pattern to solve my problem if it's possible.
...
18
votes
5answers
8k views
Using static classes as namespaces
I have seen other developers using static classes as namespaces
public static class CategoryA
{
public class Item1
{
public void DoSomething() { }
}
public class Item2
{
...
10
votes
1answer
678 views
Evaluating PHP namespaces
I'm at the pre-release stage of an open-source PHP project, one which I hope will be used by other developers in their own projects. The project doesn't currently support namespaces and I'm trying to ...
9
votes
2answers
2k views
How do I partially add PHP namespacing to a library without breaking existing code?
My company has created a modular PHP framework over the years, beginning long before PHP 5.3 added namespaces. Recently, we decided to start using namespaces in our library's new code, and we intend ...
2
votes
3answers
490 views
Company namespace in web applications
Most (good) namespace conventions require a company name scoped namespace.
eg
CompanyName.ComponentName.x.y.z
How well does this translate over to web applications? In many websites, the company is ...