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.
  • B BillWoodruff

    Namaskara, I'd call it "sloppy pasta" without mnemonic flavors of some strange twisty type, but, definitely not idiyappam :) imho, the best way to evaluate/study it is to ... if you are convinced it is safe, and, it does something interesting ... set break-points and single-step through some code that instantiates the classes. cheers, Bill

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

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

    Namaskara, That's what I am doing, putting breakpoints, and going through it step by step. Thanks

    1 Reply Last reply
    0
    • L Lost User

      Hmmm, Kinda looks like a abstract factory pattern.

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

      Thanks. Will go through this Abstract Factory pattern.

      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.

        S Offline
        S Offline
        Super Lloyd
        wrote on last edited by
        #6

        this just look like a bunch of class in the same file. there is hardly enough to call that anything... :) for example

        public class List {}

        public abstract Visual {}
        public class UIElement : Visual {}

        public class String {}

        public class FrameworkElement : UIElement
        {
        public List strings = new ();
        }

        Unless you mean to suggest? perhaps split that in a few files? that not spaghetti, but that would be a little more organisation! :) spaghetti code is about code lacking.... hierarchical stucture, well defined responsibility, that sort of thing. Not so much about whether the code is one humongous file or many small ones.

        A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

        A 1 Reply Last reply
        0
        • S Super Lloyd

          this just look like a bunch of class in the same file. there is hardly enough to call that anything... :) for example

          public class List {}

          public abstract Visual {}
          public class UIElement : Visual {}

          public class String {}

          public class FrameworkElement : UIElement
          {
          public List strings = new ();
          }

          Unless you mean to suggest? perhaps split that in a few files? that not spaghetti, but that would be a little more organisation! :) spaghetti code is about code lacking.... hierarchical stucture, well defined responsibility, that sort of thing. Not so much about whether the code is one humongous file or many small ones.

          A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!

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

          This makes sense. I am starting to understand the code.

          1 Reply Last reply
          0
          • B BillWoodruff

            Namaskara, I'd call it "sloppy pasta" without mnemonic flavors of some strange twisty type, but, definitely not idiyappam :) imho, the best way to evaluate/study it is to ... if you are convinced it is safe, and, it does something interesting ... set break-points and single-step through some code that instantiates the classes. cheers, Bill

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

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

            The sauce however lacks body and flavour. :-D

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!

            "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
            "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

            1 Reply Last reply
            0
            • 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.

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

              It would depend on what the classes contained: it's quite possible for that to be a good design - and the Concrete2 class could be just trying to get round a bug in teh VS designer that has been unfixed since the first release of .NET: you can't use the designer on a Control derived from an abstract class without a dummy concrete class between them:

              public abstract class MyBase: UserControl { ... }
              public class _MyBase: MyBase {}
              public class MyControl : _MyBase { ... }

              The designer can open MyBase and MyControl, but can't open _MyBase

              "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

              A 1 Reply Last reply
              0
              • OriginalGriffO OriginalGriff

                It would depend on what the classes contained: it's quite possible for that to be a good design - and the Concrete2 class could be just trying to get round a bug in teh VS designer that has been unfixed since the first release of .NET: you can't use the designer on a Control derived from an abstract class without a dummy concrete class between them:

                public abstract class MyBase: UserControl { ... }
                public class _MyBase: MyBase {}
                public class MyControl : _MyBase { ... }

                The designer can open MyBase and MyControl, but can't open _MyBase

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

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

                Thanks for your reply. I am starting to understand the code, and it seems to be too intelligent a design for a lay person like me.

                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
                  obermd
                  wrote on last edited by
                  #11

                  If you have to ask, then the answer is probably YES.

                  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.

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