Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. When is an Interface too big?

When is an Interface too big?

Scheduled Pinned Locked Moved C#
questioncsharpdatabasewpfcom
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jammer 0
    wrote on last edited by
    #1

    Hi All, I'm just working on some new features for my current project. Its a WPF project that makes use of the Composite Application Library. I have a number of assemblies that all talk to the database via a single class caled DatabaseManager in my data layer module. Part of the Composite Application Library is a dependency injection container so all other modules communicate with this class via the IDatabaseManager interface. The class is used to keep table on what is being done with the database so is also registered with the container as a singleton. At the moment the interface defines 12 properties/methods and I'm just about to add 2 more to this. Considering the context does this constitute a bloated interface? Its not as if its a 'normal' interface that is going to be implemented in multiple classes its more of an API onto a single class due to the dependency injection.

    Jammer My Blog | Article(s)

    realJSOPR S U 3 Replies Last reply
    0
    • J Jammer 0

      Hi All, I'm just working on some new features for my current project. Its a WPF project that makes use of the Composite Application Library. I have a number of assemblies that all talk to the database via a single class caled DatabaseManager in my data layer module. Part of the Composite Application Library is a dependency injection container so all other modules communicate with this class via the IDatabaseManager interface. The class is used to keep table on what is being done with the database so is also registered with the container as a singleton. At the moment the interface defines 12 properties/methods and I'm just about to add 2 more to this. Considering the context does this constitute a bloated interface? Its not as if its a 'normal' interface that is going to be implemented in multiple classes its more of an API onto a single class due to the dependency injection.

      Jammer My Blog | Article(s)

      realJSOPR Offline
      realJSOPR Offline
      realJSOP
      wrote on last edited by
      #2

      It's too big when you can't dead-lift it.

      "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997
      -----
      "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001

      1 Reply Last reply
      0
      • J Jammer 0

        Hi All, I'm just working on some new features for my current project. Its a WPF project that makes use of the Composite Application Library. I have a number of assemblies that all talk to the database via a single class caled DatabaseManager in my data layer module. Part of the Composite Application Library is a dependency injection container so all other modules communicate with this class via the IDatabaseManager interface. The class is used to keep table on what is being done with the database so is also registered with the container as a singleton. At the moment the interface defines 12 properties/methods and I'm just about to add 2 more to this. Considering the context does this constitute a bloated interface? Its not as if its a 'normal' interface that is going to be implemented in multiple classes its more of an API onto a single class due to the dependency injection.

        Jammer My Blog | Article(s)

        S Offline
        S Offline
        Scott Dorman
        wrote on last edited by
        #3

        Considering interfaces themselves have no implementation details, I don't think this is an issue. If all of the methods/properties logically make sense to belong to the same interface, then they should be in the same interface. If you can logically break things up into smaller portions and those portions could possibly be used elsewhere indepedantly of the larger whole then break them up and have IDatabaseManager inherit from the smaller interfaces.

        Scott Dorman

        Microsoft® MVP - Visual C# | MCPD President - Tampa Bay IASA [Blog][Articles][Forum Guidelines]


        Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai

        1 Reply Last reply
        0
        • J Jammer 0

          Hi All, I'm just working on some new features for my current project. Its a WPF project that makes use of the Composite Application Library. I have a number of assemblies that all talk to the database via a single class caled DatabaseManager in my data layer module. Part of the Composite Application Library is a dependency injection container so all other modules communicate with this class via the IDatabaseManager interface. The class is used to keep table on what is being done with the database so is also registered with the container as a singleton. At the moment the interface defines 12 properties/methods and I'm just about to add 2 more to this. Considering the context does this constitute a bloated interface? Its not as if its a 'normal' interface that is going to be implemented in multiple classes its more of an API onto a single class due to the dependency injection.

          Jammer My Blog | Article(s)

          U Offline
          U Offline
          Urs Enzler
          wrote on last edited by
          #4

          You may also consider the "interface segregation principle": One possible link to find information: http://www.objectmentor.com/resources/articles/isp.pdf[^] You find a lot of hits with google about it, too.

          -^-^-^-^-^-^-^- no risk no funk

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups