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. Is this spaghetti?

Is this spaghetti?

Scheduled Pinned Locked Moved The Lounge
csharpdesignregexarchitecturequestion
31 Posts 19 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Amarnath S

    I am working on an existing C# application, and find that there is a set of class definitions like this:

    public class Class1 { }

    public abstract class Class2 { }

    public class Concrete2 : Class2 { }

    public class Report { }

    public class Class3 : Concrete2
    {
    public Class1 report = new ();
    }

    Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

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

    Looks like the natural progression of a first time C# project.

    It was only in wine that he laid down no limit for himself, but he did not allow himself to be confused by it. ― Confucian Analects: Rules of Confucius about his food

    1 Reply Last reply
    0
    • L Lost User

      Hmmm, Kinda looks like a abstract factory pattern.

      B Offline
      B Offline
      BernardIE5317
      wrote on last edited by
      #13

      Greetings Kind Regards May I please inquire as to why your name is red colored Thank You - Cheerio

      L 1 Reply Last reply
      0
      • B BernardIE5317

        Greetings Kind Regards May I please inquire as to why your name is red colored Thank You - Cheerio

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

        Hmmm, Let's make a deal. If you tell me why you don't use any punctuation in your writings then I will tell you why my name is Red. Deal?

        B 1 Reply Last reply
        0
        • L Lost User

          Hmmm, Let's make a deal. If you tell me why you don't use any punctuation in your writings then I will tell you why my name is Red. Deal?

          B Offline
          B Offline
          BernardIE5317
          wrote on last edited by
          #15

          Okee-Dokee I know a fellow much smarter than myself He suggested it He annoys me greatly if I don't take his advice This one I more or less am inclined to as he convinced me that punctuation marks seem as maculation on the page though I have a certain fondness for a well placed comma but periods I can live without His stated argument was when people speak they do not speak "comma" or "period" as would otherwise be placed in text Of course pauses and intonation do the job as he well knows but so far so good more or less Though I may return to my previous usual usage of ,'s, .'s and ?'s etc. - Cheerio

          M L M M 4 Replies Last reply
          0
          • A Amarnath S

            I am working on an existing C# application, and find that there is a set of class definitions like this:

            public class Class1 { }

            public abstract class Class2 { }

            public class Concrete2 : Class2 { }

            public class Report { }

            public class Class3 : Concrete2
            {
            public Class1 report = new ();
            }

            Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

            W Offline
            W Offline
            Wizard of Sleeves
            wrote on last edited by
            #16

            No. Spaghetti tastes good.

            Nothing succeeds like a budgie without teeth.

            1 Reply Last reply
            0
            • A Amarnath S

              I am working on an existing C# application, and find that there is a set of class definitions like this:

              public class Class1 { }

              public abstract class Class2 { }

              public class Concrete2 : Class2 { }

              public class Report { }

              public class Class3 : Concrete2
              {
              public Class1 report = new ();
              }

              Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

              D Offline
              D Offline
              Delphi 7 Solutions
              wrote on last edited by
              #17

              I don't know what this is, but it's not spaghetti code. Spaghetti code is when you break the sequential flow of your code by jumping to somewhere else, without the possibility to come back. One would think it is not used anymore these days, but that is not really true. Every time you write a return in the middle of a method you actually break the sequential flow, which is technically speaking spaghetti code. Granted this has not the disastrous consequences as the old goto, but still...

              1 Reply Last reply
              0
              • A Amarnath S

                I am working on an existing C# application, and find that there is a set of class definitions like this:

                public class Class1 { }

                public abstract class Class2 { }

                public class Concrete2 : Class2 { }

                public class Report { }

                public class Class3 : Concrete2
                {
                public Class1 report = new ();
                }

                Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                P Offline
                P Offline
                Paul Sanders the other one
                wrote on last edited by
                #18

                No comments in the code?

                Paul Sanders http://www.alpinesoft.co.uk

                1 Reply Last reply
                0
                • B BernardIE5317

                  Okee-Dokee I know a fellow much smarter than myself He suggested it He annoys me greatly if I don't take his advice This one I more or less am inclined to as he convinced me that punctuation marks seem as maculation on the page though I have a certain fondness for a well placed comma but periods I can live without His stated argument was when people speak they do not speak "comma" or "period" as would otherwise be placed in text Of course pauses and intonation do the job as he well knows but so far so good more or less Though I may return to my previous usual usage of ,'s, .'s and ?'s etc. - Cheerio

                  M Offline
                  M Offline
                  Member 10652083
                  wrote on last edited by
                  #19

                  What makes you think this fellow is much smarter than yourself?

                  B 1 Reply Last reply
                  0
                  • B BernardIE5317

                    Okee-Dokee I know a fellow much smarter than myself He suggested it He annoys me greatly if I don't take his advice This one I more or less am inclined to as he convinced me that punctuation marks seem as maculation on the page though I have a certain fondness for a well placed comma but periods I can live without His stated argument was when people speak they do not speak "comma" or "period" as would otherwise be placed in text Of course pauses and intonation do the job as he well knows but so far so good more or less Though I may return to my previous usual usage of ,'s, .'s and ?'s etc. - Cheerio

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

                    PaltryProgrammer wrote:

                    when people speak they do not speak "comma" or "period" as would otherwise be placed in text

                    It just occurred to me that you may have a disability that requires speech-to-text. I apologize for asking, I should have thought about this. I've been here on codeproject for nearly 20 years. Many years ago Chris added support for colorized usernames, around 15 years ago the forums were full of users with colored names, it seems I am one of the last users left that use this feature. The color has no meaning. Best Wishes, -David Delaune

                    B 1 Reply Last reply
                    0
                    • M Member 10652083

                      What makes you think this fellow is much smarter than yourself?

                      B Offline
                      B Offline
                      BernardIE5317
                      wrote on last edited by
                      #21

                      As for your inquiry for one thing he explained to me what a fractional root means and why Something I wondered about prior For another he explained how my childhood theory of gravity which by the way I knew was incorrect at the time should have led me to the idea of virtual particles Also from time to time he suggests solutions to minor occasional every-day problems which do not occur to me I hate his guts - Cheerio

                      1 Reply Last reply
                      0
                      • L Lost User

                        PaltryProgrammer wrote:

                        when people speak they do not speak "comma" or "period" as would otherwise be placed in text

                        It just occurred to me that you may have a disability that requires speech-to-text. I apologize for asking, I should have thought about this. I've been here on codeproject for nearly 20 years. Many years ago Chris added support for colorized usernames, around 15 years ago the forums were full of users with colored names, it seems I am one of the last users left that use this feature. The color has no meaning. Best Wishes, -David Delaune

                        B Offline
                        B Offline
                        BernardIE5317
                        wrote on last edited by
                        #22

                        Rest assured no need to be concerned I have no such disability My only disability is the love of pizza fresh vegetables in exotic hot sauces McDonald's Egg McMuffins freshly baked bread whole wheat of course and popcorn to name but a few Somehow I manage to stay slim and trim I probably would have chosen green to wit British Racing Green or perhaps red i.e. Alpha Romeo Red - Cheerio

                        L 1 Reply Last reply
                        0
                        • A Amarnath S

                          I am working on an existing C# application, and find that there is a set of class definitions like this:

                          public class Class1 { }

                          public abstract class Class2 { }

                          public class Concrete2 : Class2 { }

                          public class Report { }

                          public class Class3 : Concrete2
                          {
                          public Class1 report = new ();
                          }

                          Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                          J Offline
                          J Offline
                          john morrison leon
                          wrote on last edited by
                          #23

                          People go to C# to escape scary old C++ and this is where they end up.

                          1 Reply Last reply
                          0
                          • B BernardIE5317

                            Rest assured no need to be concerned I have no such disability My only disability is the love of pizza fresh vegetables in exotic hot sauces McDonald's Egg McMuffins freshly baked bread whole wheat of course and popcorn to name but a few Somehow I manage to stay slim and trim I probably would have chosen green to wit British Racing Green or perhaps red i.e. Alpha Romeo Red - Cheerio

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

                            Hi Bernard, All this time I thought you were just trolling the site, but using the tools at my disposal I was able to find your identity. Your prose is natural, you weren't lying. :) Welcome to codeproject, don't worry, I won't DOX you. :-\

                            1 Reply Last reply
                            0
                            • A Amarnath S

                              I am working on an existing C# application, and find that there is a set of class definitions like this:

                              public class Class1 { }

                              public abstract class Class2 { }

                              public class Concrete2 : Class2 { }

                              public class Report { }

                              public class Class3 : Concrete2
                              {
                              public Class1 report = new ();
                              }

                              Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                              M Offline
                              M Offline
                              MikeCO10
                              wrote on last edited by
                              #25

                              Without a good view of the whole dish along with remarks and dev notes, I'd call it ziti. Might be baked or half-baked. Depending on the entire code base, it might even be baked raviolis. I can't call it spaghetti just on a declaration snippet, but I'm not a purist when I'm looking at existing code. In practical terms, it really depends on why you are there also. If you have an issue, trace it through. If it's just theoretical or just jumps out at you, it may fall under the 'if it ain't broke' theory, again depending on what your specific task is and allotted time. Now, What's for dinner?

                              G 1 Reply Last reply
                              0
                              • M MikeCO10

                                Without a good view of the whole dish along with remarks and dev notes, I'd call it ziti. Might be baked or half-baked. Depending on the entire code base, it might even be baked raviolis. I can't call it spaghetti just on a declaration snippet, but I'm not a purist when I'm looking at existing code. In practical terms, it really depends on why you are there also. If you have an issue, trace it through. If it's just theoretical or just jumps out at you, it may fall under the 'if it ain't broke' theory, again depending on what your specific task is and allotted time. Now, What's for dinner?

                                G Offline
                                G Offline
                                Gary Wheeler
                                wrote on last edited by
                                #26

                                MikeCO10 wrote:

                                What's for dinner?

                                Fish.

                                Software Zen: delete this;

                                1 Reply Last reply
                                0
                                • A Amarnath S

                                  I am working on an existing C# application, and find that there is a set of class definitions like this:

                                  public class Class1 { }

                                  public abstract class Class2 { }

                                  public class Concrete2 : Class2 { }

                                  public class Report { }

                                  public class Class3 : Concrete2
                                  {
                                  public Class1 report = new ();
                                  }

                                  Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                                  O Offline
                                  O Offline
                                  Owen Lawrence
                                  wrote on last edited by
                                  #27

                                  Not spaghetti code, but it is an antipattern. Remove it, and if nothing breaks, leave it gone. Otherwise, if you figure out what it's for, add comments. As it sits now it's expensive trash. - Owen -

                                  1 Reply Last reply
                                  0
                                  • A Amarnath S

                                    I am working on an existing C# application, and find that there is a set of class definitions like this:

                                    public class Class1 { }

                                    public abstract class Class2 { }

                                    public class Concrete2 : Class2 { }

                                    public class Report { }

                                    public class Class3 : Concrete2
                                    {
                                    public Class1 report = new ();
                                    }

                                    Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                                    J Offline
                                    J Offline
                                    JP Reyes
                                    wrote on last edited by
                                    #28

                                    oh my. These look like prime candidates for deletion. if the rest of the code depends on it, you might be dealing with a prime application for abortion. :laugh:

                                    1 Reply Last reply
                                    0
                                    • B BernardIE5317

                                      Okee-Dokee I know a fellow much smarter than myself He suggested it He annoys me greatly if I don't take his advice This one I more or less am inclined to as he convinced me that punctuation marks seem as maculation on the page though I have a certain fondness for a well placed comma but periods I can live without His stated argument was when people speak they do not speak "comma" or "period" as would otherwise be placed in text Of course pauses and intonation do the job as he well knows but so far so good more or less Though I may return to my previous usual usage of ,'s, .'s and ?'s etc. - Cheerio

                                      M Offline
                                      M Offline
                                      Member_14192382
                                      wrote on last edited by
                                      #29

                                      Let's eat Grandma

                                      1 Reply Last reply
                                      0
                                      • A Amarnath S

                                        I am working on an existing C# application, and find that there is a set of class definitions like this:

                                        public class Class1 { }

                                        public abstract class Class2 { }

                                        public class Concrete2 : Class2 { }

                                        public class Report { }

                                        public class Class3 : Concrete2
                                        {
                                        public Class1 report = new ();
                                        }

                                        Would you call this spaghetti code? Or, is this a standard Design Pattern? Currently, it is causing my mind to whirl.

                                        M Offline
                                        M Offline
                                        Matt McGuire
                                        wrote on last edited by
                                        #30

                                        short: yes Long: abstraction for the sake of patterns is a waste when it's not needed. I knew someone who abstracted everything and basically made a soup of interfaces for a very simple implementation, the abstraction was not used in a beneficial way, and caused way more headaches just trying to troubleshoot. the KISS ideology is good, but I like the "Keep it as simple as possible"; if you know multiple things will inherit or implement code, build for that. if not, keep the code as direct and simple as possible, you can always refactor later.

                                        1 Reply Last reply
                                        0
                                        • B BernardIE5317

                                          Okee-Dokee I know a fellow much smarter than myself He suggested it He annoys me greatly if I don't take his advice This one I more or less am inclined to as he convinced me that punctuation marks seem as maculation on the page though I have a certain fondness for a well placed comma but periods I can live without His stated argument was when people speak they do not speak "comma" or "period" as would otherwise be placed in text Of course pauses and intonation do the job as he well knows but so far so good more or less Though I may return to my previous usual usage of ,'s, .'s and ?'s etc. - Cheerio

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

                                          People do, in fact, speak with commas, periods, hyphens, etc. They are implemented in the length of time between words and voice inflections. Punctuation reflects how the words should be spoken as an intelligible phrase. Not using punctuation (when one can, of course) is just poor writing or laziness. As for the OP question "Is this spaghetti?", it depends on the context of the project as a whole. I lean towards the old saying, "The more they overtake the plumbing, the easier it is to stop up the drain." Or a similar old saying, "Make it as simple as possible, but no simpler." The context of the project as a whole may dictate the inheritance complexity you see, or it could just be some developer who understands how to implement some arcane design pattern, but not why or when it is apporpriate.

                                          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