Let's say you have some issue to develop. And as recommended practice it is good idea to use interfaces ( I don't mean GUI, I mean interface or abstract class ). And you can apply two ( I'm pretty sure, but for now I noticed I apply two ) ways:

  1. Design interfaces upfront and then implement them.
  2. Implement classes and then on basics of classes discover interface.

Personally I prefer second option, but during discussions with other developers I noticed that somebody prefers first approach. I can say that I prefer second approach for the following reasons:

I can faster write code I avoid unnesessary code ( something that I never will use ) Interfaces in that case are more binded to "real" life For me it is more convenient. I'd like to hear other advices why somebody prefers option 1 or option 2. As usually I code in C#, but AFAIK java also have idea of interfaces

There is also third way:

  1. Design interfaces upfront, then write implementing classes, then finally discover all of your interfaces were wrong in the first place.
  • 2
    The way you have written this question is in the style of a poll or discussion (including your own opinion). I dont believe there can be a right answer to this and questions phrased this way often get rather poor quality answers. This question fits the style described in the What types of questions should I avoid asking? - "avoid asking subjective questions where ... your answer is provided along with the question, and you expect more answers: “I use _ for _, what do you use?”" Could you rephrase your question to avoid being a discussion?
    – user40980
    Nov 19, 2015 at 22:14

1 Answer 1


Your question is tantamount to saying "I know I need a plan, but I also know the plan will change, so it's better to not have a plan at all."

There's no question that, during the software development process, you discover things that have to be changed to make them work. We all deal with that. But that's what refactoring is for, what design reviews are for, what code reviews are for, what acceptance tests are for. If we were all perfect human beings, we could design the interfaces once and never have to change them. But we're not perfect human beings. That doesn't mean you throw out the design process entirely, and having proper interfaces is an important step in the architectural design process.

One way that you can discover how your API is supposed to look is by practicing Test-Driven Development. Writing your tests first will force you to think about how the interfaces need to look, and you will eventually get highly testable, well-architected code implementations as a primary benefit. You still have to perform the design work, though; a proper architecture does not naturally emerge from simply writing tests and making them pass.

Not the answer you're looking for? Browse other questions tagged or ask your own question.