Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Namespaces in .NET / C#

Namespaces in .NET / C#

Scheduled Pinned Locked Moved C#
csharpquestioncssdiscussion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    Philip F
    wrote on last edited by
    #1

    Hi everyone! I had a little argument with a colleague about namespaces. He is affirming, that one should use namespaces as less as possible. In my opinion, namespaces not only exist for controlling "the scope of class and method names in larger programming projects" (MSDN quote), but also for somehow organizing my classes in order to have some functional grouping. Now my question is: How do you use namespaces personally? Only one or two per project, or one for each little functional group? Is there any "best practice" you follow? Thank you, Phil

    I won’t not use no double negatives.

    W N P 3 Replies Last reply
    0
    • P Philip F

      Hi everyone! I had a little argument with a colleague about namespaces. He is affirming, that one should use namespaces as less as possible. In my opinion, namespaces not only exist for controlling "the scope of class and method names in larger programming projects" (MSDN quote), but also for somehow organizing my classes in order to have some functional grouping. Now my question is: How do you use namespaces personally? Only one or two per project, or one for each little functional group? Is there any "best practice" you follow? Thank you, Phil

      I won’t not use no double negatives.

      W Offline
      W Offline
      Wendelius
      wrote on last edited by
      #2

      Philip F. wrote:

      How do you use namespaces perso

      Typically I create a namespace for each group of classes that are related in functionality (for example for entities or UI etc..) so yes, I do use quite a lot namespaces.

      Philip F. wrote:

      one for each little functional group

      This depends on the definition of little, but I wouldn't use namespace for a very small set of classes (like two or three) unless there's a very good reason. Typically in my projects we have 10-100 classes per namespace.

      The need to optimize rises from a bad design.My articles[^]

      1 Reply Last reply
      0
      • P Philip F

        Hi everyone! I had a little argument with a colleague about namespaces. He is affirming, that one should use namespaces as less as possible. In my opinion, namespaces not only exist for controlling "the scope of class and method names in larger programming projects" (MSDN quote), but also for somehow organizing my classes in order to have some functional grouping. Now my question is: How do you use namespaces personally? Only one or two per project, or one for each little functional group? Is there any "best practice" you follow? Thank you, Phil

        I won’t not use no double negatives.

        N Offline
        N Offline
        N a v a n e e t h
        wrote on last edited by
        #3

        Philip F. wrote:

        He is affirming, that one should use namespaces as less as possible.

        That's not true. Namespaces helps to organize the code. It is very useful in practice. If there was no namespace concept, programmers will run out of names for the methods and variables.

        Philip F. wrote:

        How do you use namespaces personally?

        I use namespaces extensively. Here[^] is a discussion of namespaces and folder structure which you may be interested. :)

        Navaneeth How to use google | Ask smart questions

        1 Reply Last reply
        0
        • P Philip F

          Hi everyone! I had a little argument with a colleague about namespaces. He is affirming, that one should use namespaces as less as possible. In my opinion, namespaces not only exist for controlling "the scope of class and method names in larger programming projects" (MSDN quote), but also for somehow organizing my classes in order to have some functional grouping. Now my question is: How do you use namespaces personally? Only one or two per project, or one for each little functional group? Is there any "best practice" you follow? Thank you, Phil

          I won’t not use no double negatives.

          P Offline
          P Offline
          Philip F
          wrote on last edited by
          #4

          Thanks for your answers! Phil

          I won’t not use no double negatives.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups