Skip to content

AOP and CSS

AOP and CSS

Problems arising from the absence of scoping

Styles defined elsewhere affect unintended elements.

  • Assuming a consistent design and well-defined selectors, affecting them is normal.
  • For occasional exceptions, override only the relevant property, or set it to “unset,” “initial,” “reset,” “inherit,” etc.
  • Many exceptions? 1) The design is wrong, 2) the selectors are coded incorrectly, or 3) weaving has not been properly considered.

Through CSS inheritance, ancestor styles in the DOM affect descendants.

  • Affecting them is normal.
  • For occasional exceptions, override only the relevant property, or set it to “unset,” “initial,” “reset,” etc.
  • Many exceptions? 1) The design is wrong, 2) ancestor styles are coded incorrectly, or 3) weaving has not been properly considered.

Class names can collide.

  • Create namespaces using selector combinations.
  • Add prefixes based on aspects, as in SMACSS.

Unused CSS is difficult to discover.

Related concepts

Lessons from AOP

Aspect-oriented software development, Chapter 17, Section 6, “Aspect Interaction,” and its references

  • “However, the aspects themselves need not be orthogonal to one another, and this leads to the potential for aspect interactions (interference), where aspects may cooperate or interact with each other or the base program in unexpected ways.”
  • “This problem is not unique to aspect-oriented programming and is well-understood within the domain of telecommunication systems. Borrowing the definition of feature interactions from [52], we can say that an aspect interaction occurs if the behavior of one aspect is affected by the behavior of another aspect. Given the inevitability of aspect interactions, three angles can be considered with respect to providing a solution: avoidance, detection, and resolution, all of which are currently under-researched areas.”

AOSD Chapter 21. “Concern Modeling for Aspect-Oriented Software Development”

Other notes

Created
Updated

Machine-translated from the Korean original.

2026 © ak | markdown | 한국어