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 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
              • J Jeremy Falcon

                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 Offline
                N Offline
                Nelek
                wrote on last edited by
                #21

                I agree with you. Yes, yes... you read it right ;) ;P If it is something private... it is like v0, v00, v00+ until it gets to v1 in a nice form. If it is for work... I prefer to do like (I don't remember who told it but... anyways): If I have 8 hours to chop a tree, I will spend 6 hours sharpening my axe.

                M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                J J 2 Replies Last reply
                0
                • M Matthew Dennis

                  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 Offline
                  R Offline
                  raddevus
                  wrote on last edited by
                  #22

                  I agree 100% "How can I know what I mean, before I see what I say?" :laugh: It is far easier to edit something that isn't so great than it is to make something up out of thin air. So, get a little down, then edit. "Do something, even if it's wrong." "It is not enough to stare up the steps, we must step up the stairs!" "Action doesn't guarantee happiness. But, there is no happiness without action!" I got a million of 'em! :laugh: "Sometimes I sits & thinks. But other times I just sits."

                  S 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:

                    J Offline
                    J Offline
                    jschell
                    wrote on last edited by
                    #23

                    PIEBALDconsult wrote:

                    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.

                    I have learned that no one writes code that cannot be improved. Certainly some parts of code that were created by one person certainly seem ideal. But the totality of work by one author will always have places where things could have gone 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

                      G Offline
                      G Offline
                      Gary R Wheeler
                      wrote on last edited by
                      #24

                      I do that myself. Our products are large, so it's inefficient to try out something new. Many times I'll write a command line or GUI program to act as a test bed for the concept I'm working on. Most of the time I end up with source code that can be dropped into the product and hooked up with relatively little fuss.

                      Software Zen: delete this;

                      1 Reply Last reply
                      0
                      • O obermd

                        So did you take your boss up on the offer?

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

                        No, they laid me off shortly after that. Thankfully, I am finally at a company that doesn't do lay offs. It helps that it is privately held and doesn't have to kiss the backsides of investors.

                        "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?"

                        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
                          Mycroft Holmes
                          wrote on last edited by
                          #26

                          It is neither dirty, little nor is it secret, it seems most of us do this. I think the real trick is getting the newbie to refactor the code prior to production!

                          Never underestimate the power of human stupidity - RAH I'm old. I know stuff - JSOP

                          1 Reply Last reply
                          0
                          • Mike HankeyM Mike Hankey

                            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 Offline
                            J Offline
                            jmaida
                            wrote on last edited by
                            #27

                            ditto

                            "A little time, a little trouble, your better day" Badfinger

                            1 Reply Last reply
                            0
                            • N Nelek

                              I agree with you. Yes, yes... you read it right ;) ;P If it is something private... it is like v0, v00, v00+ until it gets to v1 in a nice form. If it is for work... I prefer to do like (I don't remember who told it but... anyways): If I have 8 hours to chop a tree, I will spend 6 hours sharpening my axe.

                              M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you Rating helpful answers is nice, but saying thanks can be even nicer.

                              J Offline
                              J Offline
                              jmaida
                              wrote on last edited by
                              #28

                              I agree also.

                              "A little time, a little trouble, your better day" Badfinger

                              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

                                K Offline
                                K Offline
                                kmoorevs
                                wrote on last edited by
                                #29

                                Pete O'Hanlon wrote:

                                start with naive implementations of code while I work out how I really want it to be laid out

                                I visualize it as stumbling...progress isn't usually in a straight line or graceful. :laugh:

                                "Go forth into the source" - Neal Morse "Hope is contagious"

                                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

                                  A Offline
                                  A Offline
                                  Amarnath S
                                  wrote on last edited by
                                  #30

                                  Old saying - First make it work. Then make it work 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

                                    5 Offline
                                    5 Offline
                                    5teveH
                                    wrote on last edited by
                                    #31

                                    Yeah, I'm with you - and, it seems, the majority. I spend as little time as possible on initial code/changes. Which means I haven't made a huge commitment if I've ended up on the wrong track, or down a cul-de-sac. So it's easy to throw away some, (or all) of my work and start again. It's a bit like getting lost when you're driving somewhere. [Yeah, some of us were driving before sat-nav!] The further you travel down the wrong road, the more you resist turning back. :confused:

                                    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

                                      B Offline
                                      B Offline
                                      BillWoodruff
                                      wrote on last edited by
                                      #32

                                      Hi. Pete, i was fortunate enough to have an improbable journey to a career as a programmer beginning after i was ~39 years old (1982), and another, not unsuccessful, non-technical career in social work/psychology and academia. Lucky to always be involved with prototyping, never shaped by whatever into top-down planning, flow-charts, Backus-Naur formalisms, Design Patterns, etc. ... of course, those are valuable, and often necessary (I learned much later). i can't imagine not bread-boarding code, trying to "divide and conquer," and create proof of concept from wiring together "mini-solutions." Of course, i "grew up" with no net, no CP, no Stackoverflow, often with documentation printed out in 3-ring binders :) i am sure when you do "clever" it is SOLID clever.

                                      Quote:

                                      Pete O'Hanlon wrote:

                                      We need to get better at telling new coders that this is okay.

                                      Yes, but how, in the time of cut-and paste from SO and CP ?

                                      «The mind is not a vessel to be filled but a fire to be kindled» Plutarch

                                      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

                                        D Offline
                                        D Offline
                                        Daniel Pfeffer
                                        wrote on last edited by
                                        #33

                                        I'm shocked, shocked! Do you mean to say that your code doesn't spring from your head full-grown, like Athena from the head of Zeus? :omg: Seriously, I suspect that everyone in the software field works in the manner you describe, especially those who claim otherwise. As a rule, the products we work on are simply too complex to be planned and built in a single step. Hardware may differ. Many hardware projects are simple enough for the design and planning to be combined. Naturally, one must have the experience (i.e. have endured many failures) to be able to do this.

                                        Freedom is the freedom to say that two plus two make four. If that is granted, all else follows. -- 6079 Smith W.

                                        1 Reply Last reply
                                        0
                                        • R raddevus

                                          I agree 100% "How can I know what I mean, before I see what I say?" :laugh: It is far easier to edit something that isn't so great than it is to make something up out of thin air. So, get a little down, then edit. "Do something, even if it's wrong." "It is not enough to stare up the steps, we must step up the stairs!" "Action doesn't guarantee happiness. But, there is no happiness without action!" I got a million of 'em! :laugh: "Sometimes I sits & thinks. But other times I just sits."

                                          S Offline
                                          S Offline
                                          Southmountain
                                          wrote on last edited by
                                          #34

                                          good to see you guy's trick here:thumbsup::thumbsup:

                                          diligent hands rule....

                                          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