-
Notifications
You must be signed in to change notification settings - Fork 0
Issue #24: Polymorphic Discrimination Smell #24
Copy link
Copy link
Open
Description
Issue #24: Polymorphic Discrimination Smell
public IList<BlogComment> Comments { get; set; } // No way to distinguish typesHidden Problem:
- Prevents future comment types (e.g., ModeratedComment, AnonymousComment)
- Forces type checking with
is/asoperators - Violates Open/Closed Principle
Advanced Solution:
classDiagram
class BlogComment{
<<abstract>>
+Id
+CreatedDate
}
class UserComment{
+UserName
+EditText()
}
class SystemComment{
+SourceSystem
}
BlogComment <|-- UserComment
BlogComment <|-- SystemComment
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels