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. My dirty little coding secret

My dirty little coding secret

Scheduled Pinned Locked Moved The Lounge
javascriptcomtutorialcode-review
54 Posts 43 Posters 4 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.
  • OriginalGriffO OriginalGriff

    Strange - I'm different. I generally try to "do it the right way" from scratch, even for one off throwaway jobs for me. Even when I was checking a prototype PCB (solder on the processor and enough ancillary bits of hardware to make it run and toggle a signal, then add a bit more and test that, ...) the code was "production quality" - if only because I got bitten too many times by throwing code together to see if hardware worked and eventually found it was the software not the hardware I was trying to debug! :laugh:

    "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 AntiTwitter: @DalekDave is now a follower!

    P Offline
    P Offline
    PhilipOakley
    wrote on last edited by
    #43

    There's a subtle difference between production ready, and functionally complete. It's (for me) always worth thinking through what the functionally complete (System Engineered) version could include and how it may become over complex with contradictory requirements. Sometimes there are subtle choices that lead to the death-march pit of doom while a slightly different choice would clearly signpost the sunlit uplands of future success. Then you can focus on the core element, the 'spike', where the tyres hit the road and the concepts hits the existing code, and neater approaches to the same functionality do start to emerge. Moving fast, always broken, like a bull in a china shop, is not a good look! Production ready is good, full function extendable is even better ;-)

    1 Reply Last reply
    0
    • P Pete OHanlon

      I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

      Advanced TypeScript Programming Projects

      C Offline
      C Offline
      Cpichols
      wrote on last edited by
      #44

      I wonder how many "Me too" responses there are here. Might make a decent survey question. Me too, btw.:thumbsup:

      1 Reply Last reply
      0
      • P Pete OHanlon

        I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

        Advanced TypeScript Programming Projects

        M Offline
        M Offline
        MSBassSinger
        wrote on last edited by
        #45

        That is a very wise way to approach something new. It lets you get basic functionality working ( and discovering any quirks or poor performing code). Then, especially if you use a repo so you can rollback an “experiment” easily, you can build on it. Refactor functionality as necessary to keep it somewhat atomic or genericize some of the code. Yours is a useful post to start my day.

        1 Reply Last reply
        0
        • P Pete OHanlon

          I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

          Advanced TypeScript Programming Projects

          R Offline
          R Offline
          rjmoses
          wrote on last edited by
          #46

          Several coding secrets: 1) Being consistent -- Use the same naming convention, indentation, structuring, etc., throughout all code. 2) Small modules -- Typically 40-60 lines or so. 2a) Module on a page -- Look at a complete module without having to scroll/page through it. 3) But not too small -- Avoiding 1-3 lines of actual code as a function (nothing more ineffecient than looking at 10 lines to see something like "int GetAsValue() { return A; }" 4) Nothing fancy -- Avoid complex templates, macros, etc. 5) Adding some comments for relatively complex code, but avoiding unnecessary comments. 6) And, finally, frequent trips to the coffee pot, with associated trips to the men's room, to get the body moving and the blood circulating.

          1 Reply Last reply
          0
          • P Pete OHanlon

            I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

            Advanced TypeScript Programming Projects

            H Offline
            H Offline
            honey the codewitch
            wrote on last edited by
            #47

            I do this, and I consider it part of *design*. It helps me come up with the algorithms that I need before I actually implement them for keeps.

            To err is human. Fortune favors the monsters.

            1 Reply Last reply
            0
            • P Pete OHanlon

              I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

              Advanced TypeScript Programming Projects

              S Offline
              S Offline
              Steve Naidamast
              wrote on last edited by
              #48

              I do the same thing... I have come to call it Regressive Analysis.

              Steve Naidamast Sr. Software Engineer Black Falcon Software, Inc. blackfalconsoftware@outlook.com

              1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                Strange - I'm different. I generally try to "do it the right way" from scratch, even for one off throwaway jobs for me. Even when I was checking a prototype PCB (solder on the processor and enough ancillary bits of hardware to make it run and toggle a signal, then add a bit more and test that, ...) the code was "production quality" - if only because I got bitten too many times by throwing code together to see if hardware worked and eventually found it was the software not the hardware I was trying to debug! :laugh:

                "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 AntiTwitter: @DalekDave is now a follower!

                G Offline
                G Offline
                glennPattonWork3
                wrote on last edited by
                #49

                That is the Hardware way, going full Mandoliran. If you have to hardware tasks get one step at a time is best. I must admit once Visual Studio comes out very seems to be an expert and often tells you you are taking too long you don't need 'try ... catch', test it 'you screwed up with lenght that could be entered' out comes try...catch. :omg:

                OriginalGriffO 2 Replies Last reply
                0
                • P Pete OHanlon

                  I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

                  Advanced TypeScript Programming Projects

                  B Offline
                  B Offline
                  Bruce Greene
                  wrote on last edited by
                  #50

                  Agreed. When the problem is a difficult one, my first-cut solution will be complex. A beginning programmer might review the code and conclude "this guy is Smart! I could never write code like this." Then I take some time away, come back, boil it down and refactor into something clean and elegant. The same beginner would then review it and conclude "of course this is correct, this is the way I would have coded it."

                  1 Reply Last reply
                  0
                  • G glennPattonWork3

                    That is the Hardware way, going full Mandoliran. If you have to hardware tasks get one step at a time is best. I must admit once Visual Studio comes out very seems to be an expert and often tells you you are taking too long you don't need 'try ... catch', test it 'you screwed up with lenght that could be entered' out comes try...catch. :omg:

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

                    This is the way. :-D

                    "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 AntiTwitter: @DalekDave is now a follower!

                    "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
                    • G glennPattonWork3

                      That is the Hardware way, going full Mandoliran. If you have to hardware tasks get one step at a time is best. I must admit once Visual Studio comes out very seems to be an expert and often tells you you are taking too long you don't need 'try ... catch', test it 'you screwed up with lenght that could be entered' out comes try...catch. :omg:

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

                      Out of interest, did you watch The Book of Boba Fett as well? I just finished bingeing it and am looking forward to series 2, if it ever happens.

                      "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 AntiTwitter: @DalekDave is now a follower!

                      "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
                      • P Pete OHanlon

                        I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

                        Advanced TypeScript Programming Projects

                        M Offline
                        M Offline
                        maze3
                        wrote on last edited by
                        #53

                        as a comparison to painting, many sketch a rough outline, then fill in, then maybe shift an arm, or even blank paint over the whole thing and restart knowing oh, i wanted the eye line pointing here, then refine, add detail few, very few and after many years of crafting get to drawing final lines first time. and fewer still start their carriers with being able to finial look first attempt of pure gold, might be a fluke and not saying it bad, but understanding WHY you did it that way can become more important of being able to intuit the solution but not explain.

                        1 Reply Last reply
                        0
                        • P Pete OHanlon

                          I'm not too proud to say it. I pretty much always start with naive implementations of code while I work out how I really want it to be laid out. If you see "clever" code from me, that was never my first pass at it. There's always been a lot of playing around with it beforehand as I refactor and tidy it up. We need to get better at telling new coders that this is okay. Or perhaps it's not, and I'm just setting a bad example.

                          Advanced TypeScript Programming Projects

                          M Offline
                          M Offline
                          Max Santos
                          wrote on last edited by
                          #54

                          i am a master at doing only the first part! as soon as i try to refactor... someone brings me some other fire. its rare that i get to feel happy with the code i did.

                          XWega Dev Tools

                          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