Skip to content

Issues understanding the use of Interfaces in your Rubberduck website entry #6

@OmarZini

Description

@OmarZini

https://rubberduckvba.wordpress.com/2020/02/27/vba-classes-gateway-to-solid/

I'm still trying to get my head around this post and I certainly need some help here. I can't seem to properly understand the use of the Interface. Initially, the goal was not to expose some members of the class due to the fact that it could raise a run-time error, which we want to avoid (compile errors are preferred). When not exposing a procedure member like a function, the best way is to use an Interface. I get that. But two questions arise:

  • Why haven't you included the FillData signature in the Interface just as you did with the ChangeLastName Function? One could argue that then the Interface might not be implemented in other classes because they don't need to implement this Function but, wouldn't this comply with the Interface Segregation Principle (i.e. having several interfaces is preferred over having one)?

  • Anyways, let's stick to the Factory Design, wasn't the ultimate goal of this post to rely on compile errors? What is the point of having the Factory if it's still using the FillData method. I can see it throwing a run-time error as soon as we pass in wrong data types.

I'm by no means an expert, I'm trying to understand the concepts you are exposing.

Thank you very much for your posts and the RubberDuck project!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions