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.
  • P Offline
    P Offline
    Pete OHanlon
    wrote on last edited by
    #1

    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 P OriginalGriffO Mike HankeyM S 30 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

      M Offline
      M Offline
      Matthew Dennis
      wrote on last edited by
      #2

      I am the same way. Do it quick and dirty to prove or disprove the concept and/or algorithm. Make sure the code has the opportunity to Fail Fast so I don't waste time on it. Then clean it up, refactor it, add error handling and comments.

      "Time flies like an arrow. Fruit flies like a banana."

      R 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

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Me too! It must be experience. Adding error handling and such can be done after the main logic path has been worked out. And I often have local variables I can test (e.g. in debug) until I'm sure I don't need them.

        I might write:

        int c = foo() ;
        if ( c == 0 ) ...

        before changing it to:

        if ( foo() == 0 ) ...

        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

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

          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!

          "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

          P S P G 4 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

            Mike HankeyM Offline
            Mike HankeyM Offline
            Mike Hankey
            wrote on last edited by
            #5

            If I'm coding in an area that is new to me I start out with, what I call learning code or POC code. Once I learn the system to my satisfaction I straighten out and optimize the code to a working state. Or abandon it and wonder what the hell I was thinking even messing with it.

            PartsBin an Electronics Part Organizer - An updated version available! JaxCoder.com

            J 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!

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              I've learned not to kid myself that the code I just wrote, tested, and checked in can't be improved after looking at it again some time later. So often I'm driving home from the office (which is a benefit of working in an office) when the, "you idiot, you shoulda done..." monster, strikes. :sigh:

              D J 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

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

                Just and FYI - it's not really a dirty secret or something to be ashamed of (not saying you are, at all :)). its called the Explorative/Ideate phase of Design Thinking. Its a precursor to the prototype phase. Understand Explore (Ideate --> Prototype) Materialize

                1 Reply Last reply
                0
                • P PIEBALDconsult

                  I've learned not to kid myself that the code I just wrote, tested, and checked in can't be improved after looking at it again some time later. So often I'm driving home from the office (which is a benefit of working in an office) when the, "you idiot, you shoulda done..." monster, strikes. :sigh:

                  D Offline
                  D Offline
                  DerekT P
                  wrote on last edited by
                  #8

                  PIEBALDconsult wrote:

                  which is a benefit of working in an office

                  It works just the same way WFH. But in that instance, if it "hits me" 20 minutes after "leaving" work then I'm in the garden, or putting away the washing and I can just pick up the laptop and at minimum write myself a note about my new brilliant idea, if not implement it fully, decide it's complete rubbish and roll everything back. Rather than be doing 70 (or more likely 15) up the motorway only to be distracted by some idiot who thinks "mirror, signal, manoeuvre" is for wimps and forget all about it. The mind never shuts down; just goes into "energy saving" mode...

                  Telegraph marker posts ... nothing to do with IT Phasmid email discussion group ... also nothing to do with IT Beekeeping and honey site ... still nothing to do with IT

                  P R 2 Replies Last reply
                  0
                  • D DerekT P

                    PIEBALDconsult wrote:

                    which is a benefit of working in an office

                    It works just the same way WFH. But in that instance, if it "hits me" 20 minutes after "leaving" work then I'm in the garden, or putting away the washing and I can just pick up the laptop and at minimum write myself a note about my new brilliant idea, if not implement it fully, decide it's complete rubbish and roll everything back. Rather than be doing 70 (or more likely 15) up the motorway only to be distracted by some idiot who thinks "mirror, signal, manoeuvre" is for wimps and forget all about it. The mind never shuts down; just goes into "energy saving" mode...

                    Telegraph marker posts ... nothing to do with IT Phasmid email discussion group ... also nothing to do with IT Beekeeping and honey site ... still nothing to do with IT

                    P Offline
                    P Offline
                    PIEBALDconsult
                    wrote on last edited by
                    #9

                    YMMV. I have always* understood the wisdom of getting away from it (whatever it is) and having a fresh eye on it later. Yet, my experience (during lockdown) was that I just continued to sit at my desk looking at the code until it fixed itself. When the work is at home, getting away from it can be more difficult, in my experience. * Since art classes in high school anyway.

                    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

                      J Offline
                      J Offline
                      Jeremy Falcon
                      wrote on last edited by
                      #10

                      Like anything with tech, there's an art, and with that, that means there's no one size fits all approach IMO. For instance, if I'm creating a POC or just want to toss something together to see if the program can be useful before I put real effort into it, then rolling out a few iterations that aren't perfect, just to see the concept is ok. If it turns out being useful or someone else will ever see the code then it can be re-designed. Keep in mind though, on a functional/unit level, it's always strive to do things the right way. More so talking about the architecture aspect. However, if I'm being paid to develop something, then it's not really my job to see if the app is viable or not. It's my job to just make the thing. In that instance I'll put in the effort to think about design as a whole upfront. So, it really depends.

                      Jeremy Falcon

                      N 1 Reply Last reply
                      0
                      • D DerekT P

                        PIEBALDconsult wrote:

                        which is a benefit of working in an office

                        It works just the same way WFH. But in that instance, if it "hits me" 20 minutes after "leaving" work then I'm in the garden, or putting away the washing and I can just pick up the laptop and at minimum write myself a note about my new brilliant idea, if not implement it fully, decide it's complete rubbish and roll everything back. Rather than be doing 70 (or more likely 15) up the motorway only to be distracted by some idiot who thinks "mirror, signal, manoeuvre" is for wimps and forget all about it. The mind never shuts down; just goes into "energy saving" mode...

                        Telegraph marker posts ... nothing to do with IT Phasmid email discussion group ... also nothing to do with IT Beekeeping and honey site ... still nothing to do with IT

                        R Offline
                        R Offline
                        Rick York
                        wrote on last edited by
                        #11

                        I often get my best ideas in the shower. It got so frequent I had one boss tell me the company should pay my water bill.

                        "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                        P O A 3 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

                          P Offline
                          P Offline
                          peterkmx
                          wrote on last edited by
                          #12

                          I also subscribe to the idea that "simple is better", where possible ... Something like "fast prototyping" and keeping the code understandable while refining, and also, measuring the complexity ... I think that this is the mainstream of the expectations: [Why Senior Devs Write Dumb Code and How to Spot a Junior From A Mile Away | HackerNoon](https://hackernoon.com/why-senior-devs-write-dumb-code-and-how-to-spot-a-junior-from-a-mile-away-27fa263b101a)

                          1 Reply Last reply
                          0
                          • R Rick York

                            I often get my best ideas in the shower. It got so frequent I had one boss tell me the company should pay my water bill.

                            "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                            P Offline
                            P Offline
                            PIEBALDconsult
                            wrote on last edited by
                            #13

                            Well, ummm, during lockdown my personal hygiene was somewhat lacking as well. :-O

                            R 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

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

                              Yep ... I've refactored, and factored back again. Created "new" routines I had already created (and forgot about). It's called: "Flow".

                              "Before entering on an understanding, I have meditated for a long time, and have foreseen what might happen. It is not genius which reveals to me suddenly, secretly, what I have to say or to do in a circumstance unexpected by other people; it is reflection, it is meditation." - Napoleon I

                              J 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

                                0 Offline
                                0 Offline
                                0x01AA
                                wrote on last edited by
                                #15

                                I think most of us do it like that. At least I know that situation also. Now to stay calm, simply call it 'iteration' according to Scrum bla bla and you are fine then ;) The nice equvalient to describe that: Scrum-Iteration == Trial and Error ;P :laugh: [Edit] But what me bothers after that is: After all I see how to do it more perfect. But in 90% I'm too lazy to refactor :laugh:

                                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
                                  Mircea Neacsu
                                  wrote on last edited by
                                  #16

                                  My approach is similar. I call it the "diamond cutter method". I write the best code I can but, once finished, I look back and find better ways. Once this set of changes is done, I look again and see what can be improved. Like the apocryphal Michelangelo quote: "just remove everything that is not David". Disclaimer: I'm no Michelangelo and none of my code is David :-D Corollaries: 1. My oldest code is my best code because it's been through so much polishing 2. My code is never finished 3. I cannot write the same code twice: the second time I find a better way.

                                  Mircea

                                  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
                                    CPallini
                                    wrote on last edited by
                                    #17

                                    A sensible approach, I have to say. The simple implementation is the (reliable) reference for all the following clever code.

                                    "In testa che avete, Signor di Ceprano?" -- Rigoletto

                                    1 Reply Last reply
                                    0
                                    • P PIEBALDconsult

                                      Well, ummm, during lockdown my personal hygiene was somewhat lacking as well. :-O

                                      R Offline
                                      R Offline
                                      Rick York
                                      wrote on last edited by
                                      #18

                                      As well? Mine was not lacking at all and I have no idea why you would think it was. :rolleyes:

                                      "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                                      P 1 Reply Last reply
                                      0
                                      • R Rick York

                                        I often get my best ideas in the shower. It got so frequent I had one boss tell me the company should pay my water bill.

                                        "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                                        O Offline
                                        O Offline
                                        obermd
                                        wrote on last edited by
                                        #19

                                        So did you take your boss up on the offer?

                                        R 1 Reply Last reply
                                        0
                                        • R Rick York

                                          As well? Mine was not lacking at all and I have no idea why you would think it was. :rolleyes:

                                          "They have a consciousness, they have a life, they have a soul! Damn you! Let the rabbits wear glasses! Save our brothers! Can I get an amen?"

                                          P Offline
                                          P Offline
                                          PIEBALDconsult
                                          wrote on last edited by
                                          #20

                                          I meant -- as well as (perhaps) my coding hygiene.

                                          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