Skip to content

Issue #24: Polymorphic Discrimination Smell #24

@shadyashraf174

Description

@shadyashraf174

Issue #24: Polymorphic Discrimination Smell

public IList<BlogComment> Comments { get; set; } // No way to distinguish types

Hidden Problem:

  • Prevents future comment types (e.g., ModeratedComment, AnonymousComment)
  • Forces type checking with is/as operators
  • Violates Open/Closed Principle

Advanced Solution:

classDiagram
    class BlogComment{
        <<abstract>>
        +Id
        +CreatedDate
    }
    
    class UserComment{
        +UserName
        +EditText()
    }
    
    class SystemComment{
        +SourceSystem
    }
    
    BlogComment <|-- UserComment
    BlogComment <|-- SystemComment
Loading

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions