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. The Lounge
  3. Psuedo Code

Psuedo Code

Scheduled Pinned Locked Moved The Lounge
cryptographyquestionlearning
64 Posts 38 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.
  • W Offline
    W Offline
    wizardzz
    wrote on last edited by
    #1

    How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

    OriginalGriffO L M R I 26 Replies Last reply
    0
    • W wizardzz

      How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Nope. I think the comments should reflect the state of the software, so I hash things out separately - the failed directions are as important as the solution, so I don't forget and make the same mistakes again when I review the software in six months time and think "why the heck did I do it that way?"

      Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • W wizardzz

        How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

        "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Rarely, but sometimes when there is a method that needs to do complicatd things...

        "Dark the dark side is. Very dark..." - Yoda ---
        "Shut up, Yoda, and just make yourself another toast." - Obi Wan Kenobi

        H 1 Reply Last reply
        0
        • W wizardzz

          How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

          M Offline
          M Offline
          Mehdi Gholam
          wrote on last edited by
          #4

          It's called "documentation", real programmer don't do it.

          Its the man, not the machine - Chuck Yeager If at first you don't succeed... get a better publicist

          OriginalGriffO W R 3 Replies Last reply
          0
          • M Mehdi Gholam

            It's called "documentation", real programmer don't do it.

            Its the man, not the machine - Chuck Yeager If at first you don't succeed... get a better publicist

            OriginalGriffO Offline
            OriginalGriffO Offline
            OriginalGriff
            wrote on last edited by
            #5

            The job ain't done until the paperwork is finished...

            Real men don't use instructions. They are only the manufacturers opinion on how to put the thing together. Manfred R. Bihy: "Looks as if OP is learning resistant."

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            D 1 Reply Last reply
            0
            • W wizardzz

              How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

              "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

              I Offline
              I Offline
              Ian Shlasko
              wrote on last edited by
              #6

              I used to... Nowadays, if I have to work out a complicated algorithm, I'll pop open a notepad and outline the general flow (Not even pseudo-code)... But that rarely makes it into the code comments. I do those after I get it working.

              Proud to have finally moved to the A-Ark. Which one are you in?
              Author of the Guardians Saga (Sci-Fi/Fantasy novels)

              T 1 Reply Last reply
              0
              • W wizardzz

                How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                R Offline
                R Offline
                Rob Grainger
                wrote on last edited by
                #7

                I used to do that a lot, but not any more. OOP guidelines are to favour shorter methods that do just one job, so really there's not much need for pseudocode comments of something that small. Hopefully, the higher-level methods call lower-level methods with good enough names that the intention is clear. Of course, where algorithms are important, I may still pseudocode, but that's typically on a scrap of paper by the side of the PC. The only place I comment nowadays is generally where: (i) The code does something non-obvious, such as a workaround for a bug, or... (ii) The code exposes an API callable from other modules, possibly written by other dev's - I don't expect them to root through my code to determine how to use it. Again, well chosen method and parameter names can help a lot here.

                S S 2 Replies Last reply
                0
                • M Mehdi Gholam

                  It's called "documentation", real programmer don't do it.

                  Its the man, not the machine - Chuck Yeager If at first you don't succeed... get a better publicist

                  W Offline
                  W Offline
                  wizardzz
                  wrote on last edited by
                  #8

                  There is not a single line of documentation in the thousands of lines of code in our production software. I got here 6 months ago, so it is out of my control.

                  "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                  G L 2 Replies Last reply
                  0
                  • W wizardzz

                    How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                    J Offline
                    J Offline
                    Joan M
                    wrote on last edited by
                    #9

                    I do that in paper before putting myself in front of the computer... Even there are tools like Visio and others I'm faster doing it by hand... Then at the end and depending on the complexity I make the final flowchart in visio and store that in the documentation folder or if it is easier I use that approach you are describing. Whichever is the choice it is always a must to put lots of comments in the code.

                    [www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.

                    S T J 3 Replies Last reply
                    0
                    • W wizardzz

                      How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

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

                      wizardzz wrote:

                      How many of you hash out the logic of what you are about to write in a comment, then code it?

                      I actually write the basic logic on paper and mess with it there and then I code it. I can see the events and logic flow in my mind and I know how it will behave, to a point, then code it and inevitably debug it. I once read that if you have to describe in detail what your a function or other code does in comments then you have failed your job as a coder. Your code should be clear as to what it does and how it works in a general level. Now, this was a Microsoft developer that said this so take it for what it's worth. :) I see his point though. If you have a function ProcessMemberID why do you need a comment that says: This function processes member id's. Pretty silly actually.

                      ----------------------------- Just along for the ride. -----------------------------

                      K T 2 Replies Last reply
                      0
                      • W wizardzz

                        There is not a single line of documentation in the thousands of lines of code in our production software. I got here 6 months ago, so it is out of my control.

                        "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                        G Offline
                        G Offline
                        gavindon
                        wrote on last edited by
                        #11

                        got ya beat, there are 5 comments in the thousands of lines of code in our software..... one of which I paraphrase with single quotes " 'these things must stay in this order' or bad things will happen" That's the best comment in the whole thing I've been here 3 months so it was out of my control. Going forward however its all on me, I must make sure not to be a hypocrite :laugh: :laugh:

                        Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning. A crisis on your part does not constitute one on mine.

                        S 1 Reply Last reply
                        0
                        • W wizardzz

                          How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                          "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                          R Offline
                          R Offline
                          Rage
                          wrote on last edited by
                          #12

                          I read your thread title "Cluedo Code". Wow, time to go back home. :sigh:

                          D 1 Reply Last reply
                          0
                          • R Rage

                            I read your thread title "Cluedo Code". Wow, time to go back home. :sigh:

                            D Offline
                            D Offline
                            Dalek Dave
                            wrote on last edited by
                            #13

                            To the billiard room, with a candlestick...?

                            ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

                            R 1 Reply Last reply
                            0
                            • R Rob Grainger

                              I used to do that a lot, but not any more. OOP guidelines are to favour shorter methods that do just one job, so really there's not much need for pseudocode comments of something that small. Hopefully, the higher-level methods call lower-level methods with good enough names that the intention is clear. Of course, where algorithms are important, I may still pseudocode, but that's typically on a scrap of paper by the side of the PC. The only place I comment nowadays is generally where: (i) The code does something non-obvious, such as a workaround for a bug, or... (ii) The code exposes an API callable from other modules, possibly written by other dev's - I don't expect them to root through my code to determine how to use it. Again, well chosen method and parameter names can help a lot here.

                              S Offline
                              S Offline
                              Slacker007
                              wrote on last edited by
                              #14

                              Rob Grainger wrote:

                              (i) The code does something non-obvious, such as a workaround for a bug, or...

                              Agree.

                              ----------------------------- Just along for the ride. -----------------------------

                              1 Reply Last reply
                              0
                              • D Dalek Dave

                                To the billiard room, with a candlestick...?

                                ------------------------------------ I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave CCC Link[^] Trolls[^]

                                R Offline
                                R Offline
                                Rage
                                wrote on last edited by
                                #15

                                To the Q&A forum, with a .45. And guess who it was ?

                                1 Reply Last reply
                                0
                                • J Joan M

                                  I do that in paper before putting myself in front of the computer... Even there are tools like Visio and others I'm faster doing it by hand... Then at the end and depending on the complexity I make the final flowchart in visio and store that in the documentation folder or if it is easier I use that approach you are describing. Whichever is the choice it is always a must to put lots of comments in the code.

                                  [www.tamelectromecanica.com] Robots, CNC and PLC machines for grinding and polishing.

                                  S Offline
                                  S Offline
                                  Slacker007
                                  wrote on last edited by
                                  #16

                                  Joan Murt wrote:

                                  I'm faster doing it by hand...

                                  :thumbsup:

                                  ----------------------------- Just along for the ride. -----------------------------

                                  1 Reply Last reply
                                  0
                                  • W wizardzz

                                    How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                                    "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                                    C Offline
                                    C Offline
                                    Chris Losinger
                                    wrote on last edited by
                                    #17

                                    if it's a long process, sometimes i'll comment each step first and then fill in the code. it rarely survives the first pass, though. unless i'm following an algorithm from a cookbook, just typing the code brings up issues i didn't consider when writing the comments.

                                    image processing toolkits | batch image processing

                                    1 Reply Last reply
                                    0
                                    • W wizardzz

                                      How many of you hash out the logic of what you are about to write in a comment, then code it? Realistically I haven't done this in a while, but just did so I could go over it in writing before coding it all. It is something I did when I was a beginner much more often. How many of you guys find yourself doing this still?

                                      "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                                      A Offline
                                      A Offline
                                      Albert Holguin
                                      wrote on last edited by
                                      #18

                                      I do it... it makes me think of things more generally rather than getting caught up in details off the back... it makes the actual code writing go a lot faster later on since I don't have to rethink "what's next?".

                                      W K 2 Replies Last reply
                                      0
                                      • A Albert Holguin

                                        I do it... it makes me think of things more generally rather than getting caught up in details off the back... it makes the actual code writing go a lot faster later on since I don't have to rethink "what's next?".

                                        W Offline
                                        W Offline
                                        wizardzz
                                        wrote on last edited by
                                        #19

                                        I feel the same way. It's odd that there seems to be a little bit of dissonance between grasping the logic completely in my mind, and finding the best way to code it. I do tend to code most efficiently when I'm following my own well thought out directions.

                                        "I have a theory that the truth is never told during the nine-to-five hours. " — Hunter S. Thompson

                                        1 Reply Last reply
                                        0
                                        • G gavindon

                                          got ya beat, there are 5 comments in the thousands of lines of code in our software..... one of which I paraphrase with single quotes " 'these things must stay in this order' or bad things will happen" That's the best comment in the whole thing I've been here 3 months so it was out of my control. Going forward however its all on me, I must make sure not to be a hypocrite :laugh: :laugh:

                                          Programming is a race between programmers trying to build bigger and better idiot proof programs, and the universe trying to build bigger and better idiots, so far... the universe is winning. A crisis on your part does not constitute one on mine.

                                          S Offline
                                          S Offline
                                          Sahir Shah
                                          wrote on last edited by
                                          #20

                                          gavindon wrote:

                                          " 'these things must stay in this order' or bad things will happen"

                                          I like that :thumbsup:

                                          Und wenn du lange in einen abgrund blickst, blickt der Abgrund auch in dich hinein.

                                          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