Last call to make your voice heard! Our 2022 Developer Survey closes in less than a week. Take survey.

Questions tagged [namespaces]

For many programming languages, namespace is a context for their identifiers. Use this tag to indicate concerns about appropriate usage of namespaces.

Filter by
Sorted by
Tagged with
-1 votes
1 answer
81 views

Compute pairwise Pearson's R in parallel with tasks separated by pairs of columns of an array [closed]

This code was an answer to my own question on SO, however I am looking at the line global X and wondering if there is a better way to do this. I try to minimize the ...
user avatar
  • 157
5 votes
3 answers
806 views

Stack Interview Code methods made from class Node and Smart Pointers

Mainly looking for feedback on my use of smart pointers to implement a standard stack. For interview level production code I have also include a namespace and asserts to test my class, let me know if ...
user avatar
  • 1,007
2 votes
0 answers
185 views

C++ matrix operations

Not much formal education in programming. One year in school. We did C++ classes for most user defined objects. I've written a few different class variations for matrices but wonder about how useful ...
user avatar
  • 227
2 votes
0 answers
45 views

Find target in sorted array pivoted at some unknown point in O(log n)

You are given an array sorted in ascending order which is rotated at some pivot unknown to you beforehand. Find your target in \$O(log n)\$ which means it should be a binary search. If the value ...
user avatar
  • 596
1 vote
0 answers
140 views

Clojure macro to gather functions in a namespace into a map

I'm learning Clojure via a pet project. The project would consist of several workers that would be called from other functions. Each worker is defined in their own namespace as a set of functions (...
user avatar
5 votes
1 answer
276 views

Frame hack to get variable names as strings

I don't claim this is useful nor that it adheres to best practices. There's also no good reason the hack is a context manager, and it won't work on the interactive shell. ...
user avatar
9 votes
2 answers
2k views

Python Export Decorator

In Python, we use __all__ to explicitly denote the public API of a module or package. That looks like this: ...
user avatar
  • 1,538
3 votes
2 answers
186 views

C++ Data-Oriented Modules using namespaces and extern

I have been coding in a certain style for some time now, where I try to avoid classes and stick to pure data structures whenever possible. Basically every module of my program has its own namespace in ...
user avatar
  • 195
3 votes
2 answers
200 views

Computing dates and counts

I have a big SQL request where I compute dates or counts (from other tables), and I have to compute new dates based on conditions on those pre-computed dates and counts. In the following example, I ...
user avatar
3 votes
6 answers
3k views

Reading strings into a vector, without using namespace std

I have been told that using namespace std is a bad practice (especially in header files). But wouldn't this make the program less readable? ...
user avatar
8 votes
2 answers
2k views

C++ Linked list with smart pointers

This seems to work fine, but I'm very new to C++ and would like any suggestions for improvements. Areas I have the most trouble with are: Namespacing (honestly, it's still half looking stuff up and ...
user avatar
10 votes
2 answers
299 views

mini-(Docker)-shell

I was given an assignment to write a mini-shell: To write your own shell, you will need to start with a C program that will prompt the user for input and accept in a number of arguments from a ...
user avatar
  • 21.6k
1 vote
2 answers
29 views

JS namespacing code

I have written a wrapper for my code that allows basic namespacing and I'd like some feedback on how it can be improved. It is designed so that a module can define it's namespace and get access to ...
user avatar
  • 1,631
1 vote
0 answers
854 views

PHP autoload class design for a framework

I'm developing a php framework called Stack. I just created the autoload.php as follows. ...
user avatar
3 votes
2 answers
226 views

C++-safe way to use using inside headers

I have this C++ 14 code in a project of mine. Enhedron/Util/Enum.h: ...
user avatar
2 votes
0 answers
85 views

Configuration class

This is my first serious programming effort, so I'd like some comments about what I did so far. Project structure: ...
user avatar
4 votes
1 answer
759 views

Socket namespace for a chat module

I finally managed to work with socket.io namespace stuff which I'm using for building a chat module. Here, employees of multiple organizations can join and vhat with other employees of the respective ...
user avatar
  • 143
2 votes
0 answers
169 views

Namespace handling and inheritance managing with Node.js

The following code should solve these issues: Handle namespaces; Be a class factory from Pojos Be a object factory Create a class with inheritance capabilities from a POJO using john resig ...
user avatar
4 votes
1 answer
17k views

Extracting the text of a specific XML node

I have to extract friendlyName from the XML document. Here's my current solution: ...
user avatar
  • 359
9 votes
1 answer
2k views

User defined string literals and namespace use

I have a need to process URIs in one of my applications, sometimes from const char[] literals. My API: ...
user avatar
  • 3,577
11 votes
2 answers
278 views

Namespacing jQuery/jQueryUi into markup that I don't control

I have a project that I've been trying to get just right for the past three months and it's still not quite there yet. I'm injecting some jQuery and jQueryUI code into pages that I have no control ...
user avatar
10 votes
4 answers
251 views

JavaScript Good Patterns - Is this a good example?

I have been trying various formats of namespaces and modules patterns, however I have not come across a solution that I would use for all my projects. I've been developing the following, that would ...
user avatar
6 votes
1 answer
696 views

My first project using namespaces

I have to create some APIs for a online game and I decided to learn to use namespaces correctly. I used the factory pattern, then the loadModule method checks if ...
user avatar
3 votes
1 answer
164 views

jQuery accordion list

I'd like some tips on optimizing the following code. I'm a bit concerned that I'm 'polluting the global namespace' by not wrapping it in a function. The commented out ...
user avatar
26 votes
6 answers
105k views

Conversion between enum and string in C++ class header

I have the following redundant-feeling design to convert between enums and strings regarding a class that stores enums. The ...
user avatar
  • 431
3 votes
1 answer
677 views

Eliminating unwanted namespaces

I am trying to eliminate unwanted namespaces, and I know there's a better way to do this. This code works, but it's remedial and redundant. ...
user avatar
  • 251
9 votes
3 answers
4k views

Use of nested namespaces in 3D graphics engine library

I know that nested namespaces are used in C++ very rarely. But I think it's a nice solution to exclude types from global scope and sometimes it helps to write programs faster when we use things like "...
user avatar