Skip to content

Low Cohesion: Large Classes with Mixed Responsibilities (God Objects) #126

@coderabbitai

Description

@coderabbitai

Overview

This is a sub-task of #119 - Refactor: Address Law of Demeter violations for better encapsulation

Priority: High
Anti-pattern: God objects - classes that know/do too much

Large Classes Found (>500 lines)

  • mcp_fuzzer/fuzz_engine/strategy/aggressive/protocol_type_strategy.py (917 lines)
  • mcp_fuzzer/fuzz_engine/strategy/schema_parser.py (775 lines)
  • mcp_fuzzer/cli/args.py (671 lines)
  • mcp_fuzzer/fuzz_engine/fuzzer/protocol_fuzzer.py (650 lines)
  • mcp_fuzzer/fuzz_engine/runtime/watchdog.py (515 lines)
  • mcp_fuzzer/fuzz_engine/runtime/manager.py (505 lines)

Why It's a Problem

  1. Low cohesion - Methods don't work together toward a single purpose
  2. Multiple responsibilities - Violates Single Responsibility Principle
  3. Hard to test, understand, and maintain

Refactoring Strategy

For each large class:

  1. Identify responsibilities
  2. Group related methods
  3. Extract classes
  4. Use composition
  5. Maintain backward compatibility

Acceptance Criteria

For each large class:

  • Analyze responsibilities
  • Design new class structure
  • Extract new classes
  • Update tests
  • Verify all tests pass
  • Update documentation
  • Code review

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions