1
jkuhl
135d

I think I hate interfaces

I get the purpose behind them, and I understand why they're best practice in most OOP situations.

But goddamn it makes me groan when I change a parameter in a method and then find out I have go do the same in the interface as well.

Comments
  • 5
    guess you should use a better IDE which does all the refactoring gruntwork for you.
  • 2
    @tosensei to quote some devs:

    Wait that works....

    (and all our devs have an IntelliJ Ultimate license...)
  • 4
    It's a special hell to run across DTOs/POCOs defined as interfaces, then inherited at least 3 layers, then someone decides, "Phone number? No, no no...should be a collection of phone numbers" and the interface breaks 20 dependent projects (in a mix of shared assemblies and nuget packages).

    Then the monday-morning-quarterbacks jump in ..."if the interface was designed <dramatic pause> correctly with a collection you would have never had this problem".
  • 2
    @PaperTrail i just make a new one and deprecate the old one. If that is not doable for some reason I start to consider other careers.
  • 2
    @ars1 > "If that is not doable for some reason I start to consider other careers."

    Ended up re-writing that entire system because of the interwoven complexity of interface dependencies. Looked great on paper, very 'academic', but far to fragile to an ever changing business model. Going on close to 10 years now with little/no changes to the underlying architecture.

    A few guidelines that I follow:

    - Interfaces define behavior, not data.

    - DTOs/POCOs (the data) should be defined/used as close to the implementation as possible.

    - Repositories/Managers/whatever implement the behavior on the data or use that data for the business process.
  • 0
    Why are you developing in notepad?

    Get familiar with your IDEs refactoring tools
  • 0
    on a side note:

    sometimes i _do_ wish i could declare a "reference implementation class" which the interface is implicitely derived from - just to avoid some typing overhead.

    (with that being said - code generation would be an option here 🤔)
Add Comment