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 / C++ / MFC
  4. Has C++ ever considered XML style namespaces?

Has C++ ever considered XML style namespaces?

Scheduled Pinned Locked Moved C / C++ / MFC
c++xmlhelpquestion
10 Posts 5 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.
  • D Offline
    D Offline
    david3217
    wrote on last edited by
    #1

    Hello everyone,

    I'm sure it's been thought of various times before, but I'm waiting for a rebuild so this is more productive and self-entertaining than staring at the walls...

    Just thinking about it without putting any really useful brain cells at risk, it would seem like it would kill two opposing birds with one stone. Lots of people hate having long namespaces used all over the place. Other people say it's a really bad thing because it can lead to clashes down the line and such. But an XML style scheme could work for both.

    Any help will be appreciated.

    J S 2 Replies Last reply
    0
    • D david3217

      Hello everyone,

      I'm sure it's been thought of various times before, but I'm waiting for a rebuild so this is more productive and self-entertaining than staring at the walls...

      Just thinking about it without putting any really useful brain cells at risk, it would seem like it would kill two opposing birds with one stone. Lots of people hate having long namespaces used all over the place. Other people say it's a really bad thing because it can lead to clashes down the line and such. But an XML style scheme could work for both.

      Any help will be appreciated.

      J Offline
      J Offline
      Joe Woodbury
      wrote on last edited by
      #2

      Sounds completely pointless. It would be needlessly complicated to solve a non-existent problem.

      1 Reply Last reply
      0
      • D david3217

        Hello everyone,

        I'm sure it's been thought of various times before, but I'm waiting for a rebuild so this is more productive and self-entertaining than staring at the walls...

        Just thinking about it without putting any really useful brain cells at risk, it would seem like it would kill two opposing birds with one stone. Lots of people hate having long namespaces used all over the place. Other people say it's a really bad thing because it can lead to clashes down the line and such. But an XML style scheme could work for both.

        Any help will be appreciated.

        S Offline
        S Offline
        Stefan_Lang
        wrote on last edited by
        #3

        david3217 wrote:

        hate having long namespaces

        Having to type more is never a good reason to change anything. That's what you have autocompletion for. You should strive to write code that is easy to understand and manage. Writing less is not helping either. Using XML style will make your code harder to read and manage. And if you really can't stand it, C++ already offers using. E. g. if you do a lot of I/O, you can write

        using std::cout;
        using std::endl;
        using std::cin;

        to abbreviate your code in your source file (never in a header file!). Not that it's really neccessary...

        GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

        CPalliniC 1 Reply Last reply
        0
        • S Stefan_Lang

          david3217 wrote:

          hate having long namespaces

          Having to type more is never a good reason to change anything. That's what you have autocompletion for. You should strive to write code that is easy to understand and manage. Writing less is not helping either. Using XML style will make your code harder to read and manage. And if you really can't stand it, C++ already offers using. E. g. if you do a lot of I/O, you can write

          using std::cout;
          using std::endl;
          using std::cin;

          to abbreviate your code in your source file (never in a header file!). Not that it's really neccessary...

          GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

          CPalliniC Offline
          CPalliniC Offline
          CPallini
          wrote on last edited by
          #4

          Quote:

          Having to type more is never a good reason to change anything

          I disagree (I know, it is a matter of personal taste, anyway). It is not just typing, but also reading back what you have (or some other developer has) typed. Think at progresses made in mathematics with the introduction of the symbolic notation (it is a far fetched example, but it gives you the idea).

          In testa che avete, signor di Ceprano?

          S 1 Reply Last reply
          0
          • CPalliniC CPallini

            Quote:

            Having to type more is never a good reason to change anything

            I disagree (I know, it is a matter of personal taste, anyway). It is not just typing, but also reading back what you have (or some other developer has) typed. Think at progresses made in mathematics with the introduction of the symbolic notation (it is a far fetched example, but it gives you the idea).

            S Offline
            S Offline
            Stefan_Lang
            wrote on last edited by
            #5

            If you type more, the resulting text should make your code more readable, not less. If it doesn't, that is an entirely different problem. As a mathematician I do understand the advantage of short notation conventions. However, I also understand the problem of others not understanding your notation if they are not familiar with the shorthand notation you are using. So, if within your project team everyone agrees to certain shorthand notations, and actually take the time to document this (in case new members join the team), then the more power to you. Otherwise, just don't do it!

            GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

            CPalliniC 1 Reply Last reply
            0
            • S Stefan_Lang

              If you type more, the resulting text should make your code more readable, not less. If it doesn't, that is an entirely different problem. As a mathematician I do understand the advantage of short notation conventions. However, I also understand the problem of others not understanding your notation if they are not familiar with the shorthand notation you are using. So, if within your project team everyone agrees to certain shorthand notations, and actually take the time to document this (in case new members join the team), then the more power to you. Otherwise, just don't do it!

              GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

              CPalliniC Offline
              CPalliniC Offline
              CPallini
              wrote on last edited by
              #6

              Quote:

              If you type more, the resulting text should make your code more readable, not less

              Verbosity does not imply clarity. Often writing less makes your text more readable ("Je n'ai fait celle-ci plus longue que parce que je n'ai pas eu le loisir de la faire plus courte" :-D ).

              Quote:

              As a mathematician I do understand the advantage of short notation conventions. However, I also understand the problem of others not understanding your notation if they are not familiar with the shorthand notation you are using. So, if within your project team everyone agrees to certain shorthand notations, and actually take the time to document this (in case new members join the team), then the more power to you. Otherwise, just don't do it!

              I do agree with you on this (still, I believe that 'i' is a better name than 'index').

              In testa che avete, signor di Ceprano?

              V S 2 Replies Last reply
              0
              • CPalliniC CPallini

                Quote:

                If you type more, the resulting text should make your code more readable, not less

                Verbosity does not imply clarity. Often writing less makes your text more readable ("Je n'ai fait celle-ci plus longue que parce que je n'ai pas eu le loisir de la faire plus courte" :-D ).

                Quote:

                As a mathematician I do understand the advantage of short notation conventions. However, I also understand the problem of others not understanding your notation if they are not familiar with the shorthand notation you are using. So, if within your project team everyone agrees to certain shorthand notations, and actually take the time to document this (in case new members join the team), then the more power to you. Otherwise, just don't do it!

                I do agree with you on this (still, I believe that 'i' is a better name than 'index').

                V Offline
                V Offline
                Victor Nijegorodov
                wrote on last edited by
                #7

                CPallini wrote:

                still, I believe that 'i' is a better name than 'index'

                It depends... In a very short for loop I usually prefer using 'i'. However, if I fill in some listbox/listcontrol I prefer using 'index' or 'item' rather than 'i'.

                CPalliniC 1 Reply Last reply
                0
                • V Victor Nijegorodov

                  CPallini wrote:

                  still, I believe that 'i' is a better name than 'index'

                  It depends... In a very short for loop I usually prefer using 'i'. However, if I fill in some listbox/listcontrol I prefer using 'index' or 'item' rather than 'i'.

                  CPalliniC Offline
                  CPalliniC Offline
                  CPallini
                  wrote on last edited by
                  #8

                  The problem arises when you need to fill a listbox in a very short for loop. :laugh:

                  In testa che avete, signor di Ceprano?

                  V 1 Reply Last reply
                  0
                  • CPalliniC CPallini

                    The problem arises when you need to fill a listbox in a very short for loop. :laugh:

                    V Offline
                    V Offline
                    Victor Nijegorodov
                    wrote on last edited by
                    #9

                    CPallini wrote:

                    The problem arises when you need to fill a listbox in a very short for loop.

                    No, it doesn't! :) :laugh: :suss::cool:

                    1 Reply Last reply
                    0
                    • CPalliniC CPallini

                      Quote:

                      If you type more, the resulting text should make your code more readable, not less

                      Verbosity does not imply clarity. Often writing less makes your text more readable ("Je n'ai fait celle-ci plus longue que parce que je n'ai pas eu le loisir de la faire plus courte" :-D ).

                      Quote:

                      As a mathematician I do understand the advantage of short notation conventions. However, I also understand the problem of others not understanding your notation if they are not familiar with the shorthand notation you are using. So, if within your project team everyone agrees to certain shorthand notations, and actually take the time to document this (in case new members join the team), then the more power to you. Otherwise, just don't do it!

                      I do agree with you on this (still, I believe that 'i' is a better name than 'index').

                      S Offline
                      S Offline
                      Stefan_Lang
                      wrote on last edited by
                      #10

                      CPallini wrote:

                      Verbosity does not imply clarity

                      That's why I said 'should'

                      CPallini wrote:

                      (still, I believe that 'i' is a better name than 'index')

                      I agree that 'index' is no more useful a name than 'i'. If there is any implied meaning to an index other than being the i'th element in a container, I prefer a variable name that reflects this meaning. For example if I have a curve consisting of several joined edges, I prefer 'edge_index' over 'i' or 'index'. Not only does this add clarity, it also makes my code extendable: if I later find I want to process each edge as a list of points, I have no problem naming the nested loop variable as 'point_index', and i wouldn't need to rename the existing loop variable.

                      GOTOs are a bit like wire coat hangers: they tend to breed in the darkness, such that where there once were few, eventually there are many, and the program's architecture collapses beneath them. (Fran Poretto)

                      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