# Are we satisfied with ITK namespaces?

**URL:** https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609
**Category:** Engineering
**Tags:** namespace
**Created:** [January 21, 2018, 9:21pm UTC](https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609 "2018-01-21T21:21:08Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)
#### Post date: [January 21, 2018, 9:21pm UTC](https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609/1 "2018-01-21T21:21:09Z")

</div>

Folks,  
due to a recent issue reported to the ITK Software Guide project, I’ve investigated the use/appearance of nested namespaces in ITK.

I’ve identified the following list of namespaces:

- Accessor
- Algorithm
- Concept
- Detail
- ImageToImageFilterDetail
- fem
- fftw
- Function
- Functor
- GTest
- i18n
- LibraryA
- LibraryB
- LibraryC
- Math
- mpl
- NeighborhoodAlgorithm
- op
- Predicate
- SpatialOrientation
- Statistics
- Testing
- v3
- watershed

I’m wondering whether, taking advantage of the upcoming ITKv5 we should think about making them adhere to the Coding Style Guide in the ITK Software Guide (see [Naming Namespaces](https://github.com/jhlegarreta/ITKSoftwareGuide/blob/346a1dc1ef6450e20db6d8a5e9e4fa9e805de17f/SoftwareGuide/Latex/Appendices/CodingStyleGuide.tex#L478)).

Or else, whether other appropriate updates we may come up with can be incorporated (including dropping some if we deem it wise).

I know this is delicate due to backwards compatibility/API break, but I’m bringing it since it is a major version change.

Among others, and although this is a minor detail, I’ve found discrepancies in the namespace ending comments, e.g.:

```auto
namespace Function
{

} // end namespace functor

```

See, for example, [itkAutumnColormapFunction.h](https://github.com/InsightSoftwareConsortium/ITK/blob/master/Modules/Filtering/Colormap/include/itkAutumnColormapFunction.h).

If this needs to be changed regardless of the (potential) above changes, let me know, and I’ll submit a patch set to gerrit.

Clarifications, comments and suggestions are welcome.

---

<div class="post-metadata">

### Author: ![matt.mccormick](https://discourse.itk.org/user_avatar/discourse.itk.org/matt.mccormick/32/7_2.png) [@matt.mccormick](https://discourse.itk.org/u/matt.mccormick)
#### Post date: [January 22, 2018, 1:56am UTC](https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609/2 "2018-01-22T01:56:25Z")

</div>

A good issue to discuss, but I think changing the existing namespaces will cause much more pain than benefit by breaking backwards compatibility.

---

<div class="post-metadata">

### Author: ![blowekamp](https://discourse.itk.org/user_avatar/discourse.itk.org/blowekamp/32/79_2.png) [@blowekamp](https://discourse.itk.org/u/blowekamp)
#### Post date: [January 22, 2018, 3:18pm UTC](https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609/3 "2018-01-22T15:18:18Z")

</div>

Name spaces provide some unique flexibility [namespace alias](http://en.cppreference.com/w/cpp/language/namespace_alias) and using namespaces to import one namespace into another.

If these names are offensive enough, the ITK code itself could be updated to the conforming name conventions, and the legacy ones be made as a alias to the new ones.

But to actually update everyones code and all the examples to the the proposed namespaces would be too much work without little gain.

---

<div class="post-metadata">

### Author: ![jhlegarreta](https://discourse.itk.org/user_avatar/discourse.itk.org/jhlegarreta/32/476_2.png) [@jhlegarreta](https://discourse.itk.org/u/jhlegarreta)
#### Post date: [January 22, 2018, 6:06pm UTC](https://discourse.itk.org/t/are-we-satisfied-with-itk-namespaces/609/4 "2018-01-22T18:06:01Z")

</div>

Thanks for the replies.

IMHO, the alias option would not address the root, but it is interesting to know that it exists.

In any case, I share the idea that it would bring more problems than benefits, so `+1` to keeping what we have.

I’ll send a topic to gerrit to remove the documentation inconsistencies.
