Click here to Skip to main content
15,887,214 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: How do I load a UI based on a user specific role Pin
Eddy Vluggen30-Jan-15 0:31
professionalEddy Vluggen30-Jan-15 0:31 
AnswerRe: How do I load a UI based on a user specific role Pin
BillWoodruff29-Jan-15 5:47
professionalBillWoodruff29-Jan-15 5:47 
AnswerRe: How do I load a UI based on a user specific role Pin
Mycroft Holmes30-Jan-15 13:34
professionalMycroft Holmes30-Jan-15 13:34 
AnswerRe: How do I load a UI based on a user specific role Pin
BillWoodruff31-Jan-15 18:34
professionalBillWoodruff31-Jan-15 18:34 
GeneralRe: How do I load a UI based on a user specific role Pin
CHill601-Feb-15 21:13
mveCHill601-Feb-15 21:13 
QuestionDesign question for a project in C# Pin
Malindor23-Jan-15 6:06
Malindor23-Jan-15 6:06 
AnswerRe: Design question for a project in C# Pin
Matt T Heffron23-Jan-15 14:10
professionalMatt T Heffron23-Jan-15 14:10 
Question'Interface' Considered Harmful : Uncle Bob Pin
popchecker14-Jan-15 17:48
popchecker14-Jan-15 17:48 
Hi,

In his recent blog[^] Uncle Bob come up with a situation that explains interface is harmful. Here is the code snippet taken from his blog.

Java
public class Subject {
    private List<Observer> observers = new ArrayList<>();
    private void register(Observer o) {
        observers.add(o);
    }
    private void notify() {
        for (Observer o : observers)
            o.update();
    }
}

public class MyWidget {...}

public class MyObservableWidget extends MyWidget, Subject {
    ...
}


Here he explains that to implement Observer pattern done correctly, compilers must allow multiple inheritance.

So my question is why don't the MyObservableWidget implement using dependency injection like below to avoid multiple inheritance with greater degree of separation of concerns?

Java
public class MyObservableWidget extends MyWidget {

   private Subject subject;

   public MyObservableWidget(Subject subject) {
     this.subject = subject;
   }

}


Of course the Subject class should be an abstract class. Please let me know your thoughts.

Thanks,
Pop
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
PIEBALDconsult14-Jan-15 17:53
mvePIEBALDconsult14-Jan-15 17:53 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker14-Jan-15 18:20
popchecker14-Jan-15 18:20 
AnswerRe: 'Interface' Considered Harmful : Uncle Bob Pin
Pete O'Hanlon14-Jan-15 20:29
mvePete O'Hanlon14-Jan-15 20:29 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan14-Jan-15 22:47
mveRichard MacCutchan14-Jan-15 22:47 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 0:52
popchecker15-Jan-15 0:52 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan15-Jan-15 2:29
mveRichard MacCutchan15-Jan-15 2:29 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 2:44
popchecker15-Jan-15 2:44 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Richard MacCutchan15-Jan-15 3:03
mveRichard MacCutchan15-Jan-15 3:03 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 3:54
popchecker15-Jan-15 3:54 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Pete O'Hanlon15-Jan-15 5:35
mvePete O'Hanlon15-Jan-15 5:35 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
popchecker15-Jan-15 17:08
popchecker15-Jan-15 17:08 
AnswerRe: 'Interface' Considered Harmful : Uncle Bob Pin
Keld Ølykke5-Mar-15 3:53
Keld Ølykke5-Mar-15 3:53 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
TheGreatAndPowerfulOz23-Jun-15 10:15
TheGreatAndPowerfulOz23-Jun-15 10:15 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Keld Ølykke23-Jun-15 13:52
Keld Ølykke23-Jun-15 13:52 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
TheGreatAndPowerfulOz23-Jun-15 13:57
TheGreatAndPowerfulOz23-Jun-15 13:57 
GeneralRe: 'Interface' Considered Harmful : Uncle Bob Pin
Keld Ølykke23-Jun-15 14:07
Keld Ølykke23-Jun-15 14:07 
Suggestionlogical Pin
Member 113586967-Jan-15 22:42
Member 113586967-Jan-15 22:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.