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. In defense of spaghetti code. *ducks*

In defense of spaghetti code. *ducks*

Scheduled Pinned Locked Moved The Lounge
designhardwarehelpquestion
150 Posts 34 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.
  • H honey the codewitch

    While I hear you, I do have one niggling nit to pick with your suggestion that comments *do* have zero impact if you mean they have zero negative impact on your codebase. They do. Comments are extra maintenance, and often get stale. They should be used as sparsely as possible and no sparser. For the most part, code should be self documenting. This is not as true in embedded where you often can't afford the necessary abstractions to express intent, such as using the STL algorithms everyone is familiar with. In the case of embedded comments tend to be more necessary.

    To err is human. Fortune favors the monsters.

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

    Also, and I repeat, code _should_ be self-documenting as much as possible for the most part. But, the context of this entire chat is about crap code. This is completely contradictory to the subject at hand for the conversation you started.

    Jeremy Falcon

    H 1 Reply Last reply
    0
    • J Jeremy Falcon

      Also, and I repeat, code _should_ be self-documenting as much as possible for the most part. But, the context of this entire chat is about crap code. This is completely contradictory to the subject at hand for the conversation you started.

      Jeremy Falcon

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

      Jeremy Falcon wrote:

      Also, and I repeat, code should be self-documenting as much as possible for the most part

      I said the same thing in my post. In fact it was a fundamental part of my position.

      To err is human. Fortune favors the monsters.

      1 Reply Last reply
      0
      • H honey the codewitch

        My point in making the statement about comments going stale is not about assigning blame. I thought that was a given, considering assigning blame doesn't do anything. My point was that it is extra maintenance.

        To err is human. Fortune favors the monsters.

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

        I fully understand the maintenance aspect, but that's nothing to do with blame. Unless you consider telling a coder to not be lazy with code blame then sure. But, I'll repeat again the context of what said and me referring to specific scenarios. This does not disqualify me from understanding what maintenance is.

        Jeremy Falcon

        H 1 Reply Last reply
        0
        • H honey the codewitch

          I've been programming since 1986, and professionally since 1996.

          To err is human. Fortune favors the monsters.

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

          Then you should know better.

          Jeremy Falcon

          H 1 Reply Last reply
          0
          • J Jeremy Falcon

            I fully understand the maintenance aspect, but that's nothing to do with blame. Unless you consider telling a coder to not be lazy with code blame then sure. But, I'll repeat again the context of what said and me referring to specific scenarios. This does not disqualify me from understanding what maintenance is.

            Jeremy Falcon

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

            If comments get stale, that's not the fault of comments but the developer.

            To be clear, this is what I was talking about when I brought up blame. When you're assigning a fault to someone that's blame. And again, I don't think it's productive. People make mistakes. Code gets stale. It happens to everyone. My comment was about maintenance.

            To err is human. Fortune favors the monsters.

            J 1 Reply Last reply
            0
            • J Jeremy Falcon

              Then you should know better.

              Jeremy Falcon

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

              I do know better. Much better. When I was a less experienced developer, I used to refuse to write expedient code like this, and my projects would suffer in cases where it was called for, particularly given that a lot of abstracted tends code to not survive contact with real world changes. Again, we have a disagreement. Not only that, a lot more programmers here seem to agree with me than with you, so maybe this doesn't have so much to do with what I don't know or lack of experience, and again, a lot more to do with us simply disagreeing.

              To err is human. Fortune favors the monsters.

              1 Reply Last reply
              0
              • H honey the codewitch

                Jeremy Falcon wrote:

                Knowing why this is a bad idea separates the seniors from those who think they are seniors but are not. Even on the off chance you can make sense of spaghetti, in a year or two it'll be harder if you come back to it. If it's handed off to another dev, it'll be harder.

                Perhaps I wasn't clear in my original comment, but I tried to be explicit about the low cost of a rewrite. There is no justification for spending $1000 to possibly save $1000 down the road. It makes no sense. There's little justification for even spending $500 to again, possibly save $1000 down the road when the downside is that you go dark in terms of client visibility as you're developing the framework in the alternative. Edit: What we have is a fundamental disagreement, which you're trying to paint as hubris, and that's insulting. I think my contributions here speak for themselves, as well as my extensive history of successful development projects. I wish you'd be a little bit more circumspect about what you write here. It would be nice to keep it civil. :)

                To err is human. Fortune favors the monsters.

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

                honey the codewitch wrote:

                There is no justification for spending $1000 to possibly save $1000 down the road. It makes no sense.

                Despite needing a diagram? Something isn't adding up. Not sure how many people you've employed before but $500-$1K is a joke. Seems that the diagram would take longer than the code according to you. Which makes no sense. People don't diagram something that takes 1-2 days to develop.

                honey the codewitch wrote:

                I wish you'd be a little bit more circumspect about what you write here. It would be nice to keep it civil.

                I'm not being uncivil. I'm just challenging you. If saying a senior programmer knows why this is a bad idea is being uncivil in your book, then that's just oversensitivity. I could also say that always arguing with people (this is where you say you're not) is also being uncivil. But, this is the Internet. Arguing is a way of life here. This is where you say you're just defending your position. And so am I. But, don't make it seem like I'm a bad guy here because I speak of what a senior should know. But don't worry, this is easily solvable. I'll just stop replying to your click baits. :)

                Jeremy Falcon

                H E 2 Replies Last reply
                0
                • H honey the codewitch

                  If comments get stale, that's not the fault of comments but the developer.

                  To be clear, this is what I was talking about when I brought up blame. When you're assigning a fault to someone that's blame. And again, I don't think it's productive. People make mistakes. Code gets stale. It happens to everyone. My comment was about maintenance.

                  To err is human. Fortune favors the monsters.

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

                  This is going nowhere. You have more time to argue than I have a desire to be here. Tootles.

                  Jeremy Falcon

                  H 1 Reply Last reply
                  0
                  • J Jeremy Falcon

                    honey the codewitch wrote:

                    There is no justification for spending $1000 to possibly save $1000 down the road. It makes no sense.

                    Despite needing a diagram? Something isn't adding up. Not sure how many people you've employed before but $500-$1K is a joke. Seems that the diagram would take longer than the code according to you. Which makes no sense. People don't diagram something that takes 1-2 days to develop.

                    honey the codewitch wrote:

                    I wish you'd be a little bit more circumspect about what you write here. It would be nice to keep it civil.

                    I'm not being uncivil. I'm just challenging you. If saying a senior programmer knows why this is a bad idea is being uncivil in your book, then that's just oversensitivity. I could also say that always arguing with people (this is where you say you're not) is also being uncivil. But, this is the Internet. Arguing is a way of life here. This is where you say you're just defending your position. And so am I. But, don't make it seem like I'm a bad guy here because I speak of what a senior should know. But don't worry, this is easily solvable. I'll just stop replying to your click baits. :)

                    Jeremy Falcon

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

                    Jeremy Falcon wrote:

                    Despite needing a diagram?

                    I already have a diagram, which I made the code closely follow.

                    Jeremy Falcon wrote:

                    Not sure how many people you've employed before but $500-$1K is a joke.

                    You've maybe never done embedded? Projects don't sprawl when you have kilobytes of RAM and less than 1MB to store your code.

                    Jeremy Falcon wrote:

                    I'm just challenging you.

                    I'm sorry but that's false. If you were just challenging me you wouldn't be insinuating things like I think I'm a senior developer when I'm not - that's insulting, and it's nonsense. You should know better.

                    Jeremy Falcon wrote:

                    I could also say that always arguing with people (this is where you say you're not) is also being uncivil.

                    There's nothing uncivil about a debate. This is about the statements you made that specifically did not further it. I stand by what I wrote.

                    To err is human. Fortune favors the monsters.

                    J 1 Reply Last reply
                    0
                    • H honey the codewitch

                      Jeremy Falcon wrote:

                      Despite needing a diagram?

                      I already have a diagram, which I made the code closely follow.

                      Jeremy Falcon wrote:

                      Not sure how many people you've employed before but $500-$1K is a joke.

                      You've maybe never done embedded? Projects don't sprawl when you have kilobytes of RAM and less than 1MB to store your code.

                      Jeremy Falcon wrote:

                      I'm just challenging you.

                      I'm sorry but that's false. If you were just challenging me you wouldn't be insinuating things like I think I'm a senior developer when I'm not - that's insulting, and it's nonsense. You should know better.

                      Jeremy Falcon wrote:

                      I could also say that always arguing with people (this is where you say you're not) is also being uncivil.

                      There's nothing uncivil about a debate. This is about the statements you made that specifically did not further it. I stand by what I wrote.

                      To err is human. Fortune favors the monsters.

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

                      You're missing the point. Thus, this is going nowhere nor will it. It's just another pointless argument. I'm gonna go live my life now.

                      Jeremy Falcon

                      H 1 Reply Last reply
                      0
                      • J Jeremy Falcon

                        You're missing the point. Thus, this is going nowhere nor will it. It's just another pointless argument. I'm gonna go live my life now.

                        Jeremy Falcon

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

                        Solid plan.

                        To err is human. Fortune favors the monsters.

                        J 1 Reply Last reply
                        0
                        • J Jeremy Falcon

                          This is going nowhere. You have more time to argue than I have a desire to be here. Tootles.

                          Jeremy Falcon

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

                          Hello? You're the one that started arguing with *me*. I'm simply defending my position. Not only that, you couldn't keep it to debate, and had to insult my professional abilities and experience.

                          To err is human. Fortune favors the monsters.

                          J 1 Reply Last reply
                          0
                          • H honey the codewitch

                            Hello? You're the one that started arguing with *me*. I'm simply defending my position. Not only that, you couldn't keep it to debate, and had to insult my professional abilities and experience.

                            To err is human. Fortune favors the monsters.

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

                            Nope. Wrong. And a senior should know better.

                            Jeremy Falcon

                            H 1 Reply Last reply
                            0
                            • J Jeremy Falcon

                              Nope. Wrong. And a senior should know better.

                              Jeremy Falcon

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

                              That doesn't even make any sense. You're seriously arguing that I'm the one that started arguing with you? :laugh: Okay man. Get on with your life.

                              To err is human. Fortune favors the monsters.

                              J 1 Reply Last reply
                              0
                              • G Gary R Wheeler

                                I can make the argument that spaghetti code is the better solution in this case. Creating a general-purpose framework tends to hide the logic. At least when you came back at some future time you only have to understand the spaghetti, and not a framework as well. I think YAGNI and KISS both apply here. Obviously the answer is different if you're tailoring the spaghetti for multiple solutions.

                                Software Zen: delete this;

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

                                To me spaghetti code is basically like a messy room you don't clean up. Doesn't mean you need to make a framework, but ya know... at least make the bed.

                                Jeremy Falcon

                                G 1 Reply Last reply
                                0
                                • H honey the codewitch

                                  That doesn't even make any sense. You're seriously arguing that I'm the one that started arguing with you? :laugh: Okay man. Get on with your life.

                                  To err is human. Fortune favors the monsters.

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

                                  You're not stopping with the replies... you can have the last word if arguing online is that important to you.

                                  Jeremy Falcon

                                  H 1 Reply Last reply
                                  0
                                  • J Jeremy Falcon

                                    You're not stopping with the replies... you can have the last word if arguing online is that important to you.

                                    Jeremy Falcon

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

                                    At this point I think you're here to troll. :~

                                    To err is human. Fortune favors the monsters.

                                    1 Reply Last reply
                                    0
                                    • H honey the codewitch

                                      I ran into an issue recently on a professional embedded project, and that was this: In translating the flow diagrams to code, there were so many conditions around state changes and such that my options were to either abstract the flow with some sort of generalized framework, or cook some spaghetti code. I chose the latter. Why? Simple. The actual effort if anything would be about equal, or favor the spaghetti approach. More importantly, progress remains visible with the spaghetti approach rather than the abstract flow framework which requires a lot of up front design and work without progress visible to the client. Finally, this is embedded code, where a rewrite is maybe a grand or two $USD, on the outside, assuming not a lot of reuse. It would cost at least half that to develop a simple framework, which might make things more maintainable, but questionable in terms of how effortlessly one can make changes (whereas maintainability is more about stepping away for a month and being able to pick it up again, mostly - or someone else picking up your code). It's all a matter of robbing peter to pay paul. The bottom line here is that while we may chase perfect code, and "best practices" that's not always the most effective technique for keeping the lights on. Flame away.

                                      To err is human. Fortune favors the monsters.

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

                                      To even admit that I would write spaghetti code knowingly is counter to every fibre in my being. I was the first in my company, way back when, to be asked what I thought of "structured programming"; i.e. no "go to's". I wrote the first "structured program" and never looked back.

                                      "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

                                      H 1 Reply Last reply
                                      0
                                      • L Lost User

                                        To even admit that I would write spaghetti code knowingly is counter to every fibre in my being. I was the first in my company, way back when, to be asked what I thought of "structured programming"; i.e. no "go to's". I wrote the first "structured program" and never looked back.

                                        "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

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

                                        The spec was spaghetti, so my choice was to design directly to spec, or try to abstract it. I chose the former, and I'm pretty happy with the result. Including coming in under budget.

                                        To err is human. Fortune favors the monsters.

                                        L 1 Reply Last reply
                                        0
                                        • H honey the codewitch

                                          I ran into an issue recently on a professional embedded project, and that was this: In translating the flow diagrams to code, there were so many conditions around state changes and such that my options were to either abstract the flow with some sort of generalized framework, or cook some spaghetti code. I chose the latter. Why? Simple. The actual effort if anything would be about equal, or favor the spaghetti approach. More importantly, progress remains visible with the spaghetti approach rather than the abstract flow framework which requires a lot of up front design and work without progress visible to the client. Finally, this is embedded code, where a rewrite is maybe a grand or two $USD, on the outside, assuming not a lot of reuse. It would cost at least half that to develop a simple framework, which might make things more maintainable, but questionable in terms of how effortlessly one can make changes (whereas maintainability is more about stepping away for a month and being able to pick it up again, mostly - or someone else picking up your code). It's all a matter of robbing peter to pay paul. The bottom line here is that while we may chase perfect code, and "best practices" that's not always the most effective technique for keeping the lights on. Flame away.

                                          To err is human. Fortune favors the monsters.

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

                                          honey the codewitch wrote:

                                          More importantly, progress remains visible with the spaghetti approach

                                          Of course. Ideals should not be applied blindly. They should be followed when they provide benefit.

                                          honey the codewitch wrote:

                                          but questionable in terms of how effortlessly one can make changes (whereas maintainability is more about stepping away for a month and being able to pick it up again, mostly

                                          I really, really dislike the claim that abstractions make anything better when no one can provide any evidence at all that future needs of any sort will be needed. If requirements exist, or a roadmap is known or even if someone expressed a desire for a future feature then maybe consider it. But don't do it 'just in case'. Doing so it no better than gambling on the big wheel in a casino (one of the worst odds games in play.) It does not insure any economic future advantage but it does guarantee complexity which future programmers must then maintain (and so must be paid for.)

                                          H E 2 Replies 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