4 ms·
Even with OO, what would you suggest? A bunch of classes, classes, inheritance, and virtual methods to replace it? Great, now my logic is spread out all over t
by EpicEng 13y ago
Even with OO, what would you suggest? A bunch of classes, classes, inheritance, and virtual methods to replace it? Great, now my logic is spread out all over the place.
I know that there are definitely cases in which an OO approach beats a bunch of switch statements scattered throughout the code (specifically, when checking the type of the input variable), but I don't think that applies here. If I saw an interpreter written in that way I would assume it was created by someone who didn't know what they were doing.
As an aside, 1) I can't stand the term "code smell" as it tends to be used by hipsters with little to no experience building complex systems, and 2) I realize that you posted your honest thoughts and did a good job of analyzing the approach taken by the author. I'm not trying to prop up a straw man here.
- bromagosa 13y agoWhen most people hear OO they understand C++... NesTalk is a good, real OO aproach to a machine emulator: http://smalltalkhub.com/#!/~zeroflag/NesTalk http://smalltalkhub.com/#!/~zeroflag/NesTalk
- fit2rule 13y agoI just wanted to say that 'code smell' predates hipsters as a term, yo, and a lot of very experience engineers are right when they say 'this code smells' (i.e. I am suspicious of its suitability for consumption..) In my experience the term is something I learned in the 70's from the smelly retiring hippies whose code I had to maintain for a decade or so. ;)
- dalke 13y ago"code smell" in the use that EpicEng complained about dates from the late 1990s. To get a sense of its history, https://books.google.com/ngrams/graph?content=code+smell&year_start=1997&year_end=2008&corpus=15&smoothing=3&share=&direct_url=t1%3B%2Ccode%20smell%3B%2Cc0 https://books.google.com/ngrams/graph?content=code+smell&yea... put a start date of around 1998. It was definitely in Fowler (1999) "Refactoring: Improving the Design of Existing Code". See also http://c2.com/cgi/wiki?CodeSmell http://c2.com/cgi/wiki?CodeSmell , which claims "A code smell is a hint that something has gone wrong somewhere in your code. ... KentBeck ... seems to have coined the phrase in the "OnceAndOnlyOnce" page" and points to "Refactoring" as earliest known use. The phrase you refer to - "this code smells" - and the implication that it reflects hygiene, has different meaning and intent. While related, they are not the same thing as a "code "smell." Compare "the wine smells" vs. "wine smell" to get a sense of how there can be a difference. The modern use of the term "hipster" dates from 1999-2003, claims Wikipedia at http://en.wikipedia.org/wiki/Hipster_%28contemporary_subculture%29 http://en.wikipedia.org/wiki/Hipster_%28contemporary_subcult... , but it's easy to find things like the 1998 alt-comic "Urban Hipster #1" at http://www.indyworld.com/uh/uh01.html http://www.indyworld.com/uh/uh01.html which predate 1999 and use hipster in its modern meaning. In any case, the term 'hipster' is derived from a term in widespread use from the 40s-60s, which then fell into disfavor. To get a rough idea of the change in use pattern, see https://books.google.com/ngrams/graph?content=hipster&year_start=1800&year_end=2008&corpus=15&smoothing=3&share=&direct_url=t1%3B%2Chipster%3B%2Cc0 https://books.google.com/ngrams/graph?content=hipster&year_s... . Obviously the 1940s "hipster" term predates "code smell" as applied to computer code, because there was no computer code in the 1940s. So no, "code smell" does not predate the term "hipster."
- diggitydoggity 13y agofit2rule didn't say that the term 'code smell' outdates the term 'hipster'. He said that the term 'code smell' outdates hipsters' use of it. Heck, even I remember hearing about a code smell or two in the 80's ..
- dalke 13y agoAhh, I see how you can draw that conclusion. The quote is "'code smell' predates hipsters as a term", which I interpreted to mean that "code smell" (as a term) is older than "hipster" (as a term, or as a movement), while you interpret to mean "was used by people before hipsters used it." I agree with you that "code smell" did not originate from hipster use. But I don't think EpicEng implied that either. The parent comment is "it tends to be used by hipsters with little to no experience building complex systems." I don't see in it an implication that hipsters came up with the term. So if that is fit2rule's point, then it's rather like saying "fixed-wheel bicycles existed before hipsters" - true, but a tangential remark which ended up derailing the conversation. I know of no use of the phrase "code smell" before 1999, with its modern use. Could you speak more about your recollections from the 1980s? Was it used the same? Do you have a citation or reference?
- EpicEng 13y agoYeah, pretty much, and I admit it is a gross generalization. The term just bugs me because I see it used so often by people who lack the experience to understand why code which may not seem optimal to them was written the way that it was. I've also seen it used by smart people who know what they're talking about. Who knew I would get such an education on the term "code smell"? :)
- deleted 13y ago[deleted]