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:Design interfaces upfront and then implement them.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 codeI avoid unnesessary code ( something that I never will use )Interfaces in that case are more binded to real lifeFor 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 interfacesThere is also third way:Design interfaces upfront, then write implementing classes, then finally discover all of your interfaces were wrong in the first place.
What is better to design or discover interface
java;c#;design
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.