Skip to content
Advertisement

Tag: design-patterns

How to implement a generic interface that extends another generic interface in Java?

I am new to Java and working on implementing generic interfaces and that’s where I’d love some help. I want to implement a generic interface in Java that extends another interface. This is how the current interface structure looks like – I want to implement the ItemsProviderInterface interface and provide a definition for convertInput(), convertResponse(), request() methods. Maybe something like

Composition or Inheritance for classes with almost similar implementations but different input and outputs for methods?

I have the following classes, which have quite similar method implementations. Only the classes’ method inputs and outputs seem to be of different types. When I put it like this, it sounds like a case for inheritance, however, the fact that the inputs and outputs are different and are related to two lambdas, make me wonder if they should remain

How to extract telemetry code from different methods? Decorator pattern? AOP?

We are using Application Insights to monitor different service calls in our applications. Data for Application Insights is provided by many different methods and classes but always in an identical way/by identical code fragments: How am I able to extract those wrapping try catch fragments to one point of responsibility? I took a look at the dacorator pattern but I

Observer – specifying modifications of interest explicitly – JAVA implementation

I asked here how I should handle the situation when I need to inform observers only when specific attribute of object changes. I received very nice reply with reference to GoF where is written: Blockquote Specifying modifications of interest explicitly. You can improve update efficiency by extending the subject’s registration interface to allow registering observers only for specific events of

Advertisement