Linked Questions

14 votes
4 answers
11k views

Possible Duplicates: Factory Pattern. When to use factory methods? Why do static Create methods exist? Though I know what is Factory Design Pattern. But I am unable to comprehend what are the ...
Vaibhav Jain's user avatar
  • 34.6k
-2 votes
2 answers
2k views

I am a student and I had this question asked in my viva voce today and I hadn't even heard about it before. I have searched over the internet about it and I always found the results to be very ...
Kaushal Jain's user avatar
2 votes
2 answers
387 views

Lighten a specific aspect of: Factory Pattern. When to use factory methods? At my team there was a discussion about the factory design pattern. In our project we have some Factories that are ...
Christian Waltjen's user avatar
0 votes
2 answers
449 views

The factory method is used to avoid violation of Open-closed principle. Instead of creating an object by inheritage: Product myProd = new ConcreteProduct1; // concreteProduct extends abstract product ...
Marco's user avatar
  • 134
-1 votes
1 answer
384 views

I can appreciate the value of factory methods, but I'm struggling with the value of using dedicated factory classes. This will work: class Brady { int age; String name; static Brady ...
Joe's user avatar
  • 6,827
2034 votes
39 answers
1.4m views

What exactly is the difference between an interface and an abstract class?
Sarfraz's user avatar
  • 384k
549 votes
31 answers
493k views

In one of my interviews, I have been asked to explain the difference between an Interface and an Abstract class. Here's my response: Methods of a Java interface are implicitly abstract and ...
Thinker's user avatar
  • 6,952
644 votes
16 answers
174k views

Java 8 allows for default implementation of methods in interfaces called Default Methods. I am confused between when would I use that sort of interface default method, instead of an abstract class (...
Narendra Pathai's user avatar
39 votes
8 answers
31k views

I keep coming across this term: Program to an interface. What exactly does it mean? A real life design scenario would be highly appreciated.
gameover's user avatar
  • 12.1k
18 votes
3 answers
11k views

I'm trying to succinctly describe when to use a factory, for both myself and my team. I ran across the following related questions, which helped somewhat: When to use factory patterns? (useful pdf ...
Luke's user avatar
  • 2,181
5 votes
5 answers
13k views

I'm trying to create a really simple Factory Method design pattern example in Java. I don't really know Java, I am new to programming in general but I need to come up with a a basic FactoryMethod ...
user avatar
16 votes
2 answers
3k views

I'm new to unit testing and PHPUnit, but I've reading a lot lately about design patterns and isolated tests and I've decided to refactor an application I'm working on to get rid of static classes, ...
Mahn's user avatar
  • 16.7k
4 votes
4 answers
2k views

[MAJOR EDITS, my first post was somewhat misleading. My appologies] Given a class such as: public class DatabaseResult{ public bool Successful; public string ErrorMessage; //...
Oliver Kane's user avatar
4 votes
3 answers
315 views

I was going through a Java code and I saw that objects have been allocated using some interface and this interface contains some methods to allocate objects using new operator. I am unable to think ...
SIGSTP's user avatar
  • 1,155
3 votes
6 answers
3k views

I'm sure there's some solution or pattern to this but i'm having trouble articulating the question to find the right answer. I have an interface, ICar: public interface ICar { void SetMake(String ...
Tom's user avatar
  • 530

15 30 50 per page