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