📎 Webclip
Code Smells in JavaScript. We look at feature envy and intimate…
The article defines a code smell as a characteristic of code that may point to deeper problems, and says code quality can be judged by looking for these signs. It then focuses on feature envy and classes that are too intimate.
Reading notes#
- A code smell is a characteristic of code that suggests deeper problems.
- Feature envy happens when one class uses too many features of another class.
- The article says this often shows up when one class references another class’s fields excessively.
- The ShapeCalculator example uses many fields from Rectangle.
- This use exposes Rectangle fields such as height and width and breaks encapsulation.
