Alex Rivera | Logout

Should I still code to the interface even if I am ONLY EVER going to have ONE implementation?

Asked 2009-10-05T13:03:50.907
12

I think the title speaks for itself guys - why should I write an interface and then implement a concrete class if there is only ever going to be 1 concrete implementation of that interface?

Edit
Report

1 Answer

1

You need to decide what the programming interface is, by specifying the public functions. If you don't do a good job of that, the class would be difficult to use.

Therefore, if you decide later you need to create a formal interface, you should have the design ready to go.

So, you do need to design an interface, but you don't need to write it as an interface and then implement it.

answered 2009-10-05T13:34:56.910

Your Answer