4 ms·
The basic problem addressed here is a code smell called "primitive obsession" [0]. Strange name, but worth knowing. [0]: https://medium.com/the-sixt-india-blog
by munchler 3y ago
The basic problem addressed here is a code smell called "primitive obsession" [0]. Strange name, but worth knowing.
[0]: https://medium.com/the-sixt-india-blog/primitive-obsession-code-smell-that-hurt-people-the-most-5cbdd70496e9 https://medium.com/the-sixt-india-blog/primitive-obsession-c...
- ryandv 3y agoAlso see Fowler's book Refactoring [0] where "Primitive Obsession" is listed among many other code smells in Chapter 3. [0] https://martinfowler.com/books/refactoring.html https://martinfowler.com/books/refactoring.html
- rerdavies 3y agoIt's a really awful name. Is primitive obsession a good code smell or a bad code smell? And if code smell is a bad thing, and if primitive obsession is a good thing, wouldn't the code smell be lack of primitive obsession? I don't mean to be pedantic. But it's quite exhausting trying to parse the meaning out of "primitive obsession is a code smell". It took me a while to figure out whether the author considered "primitive obsession" to be a good thing or a bad thing, not least because the they provided an example but not a definition.
- ddejohn 3y agoThe term "code smell" only ever has a negative connotation. The title of the article is also "Primitive Obsession — A Code Smell that Hurts People the Most" -- doesn't seem too difficult to parse...
- rerdavies 3y agoBut the solution being advanced is to prevent inheritance of primitive operators. Implying that Primitive Obsession is a good thing. Unless the author means "primitive type obsession". I imagine they did.