Is this spaghetti?
-
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
andMyControl
, 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!
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.
-
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.
-
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.
-
Greetings Kind Regards May I please inquire as to why your name is red colored Thank You - Cheerio
-
Greetings Kind Regards May I please inquire as to why your name is red colored Thank You - Cheerio
-
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?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
-
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.
No. Spaghetti tastes good.
Nothing succeeds like a budgie without teeth.
-
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.
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...
-
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.
No comments in the code?
Paul Sanders http://www.alpinesoft.co.uk
-
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
What makes you think this fellow is much smarter than yourself?
-
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
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
-
What makes you think this fellow is much smarter than yourself?
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
-
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
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
-
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.
People go to C# to escape scary old C++ and this is where they end up.
-
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
-
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.
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?
-
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?
MikeCO10 wrote:
What's for dinner?
Fish.
Software Zen:
delete this;
-
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.
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 -
-
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.
-
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
Let's eat Grandma