Skip to main content

Questions tagged [decorator]

The tag has no summary, but it has a tag wiki.

5 votes
7 answers
587 views

Consider the following scenario. I have an interface IService: public interface IService { void DoSomething(); } with an implementation: public class Implementation : IService { // This might ...
Codisattva's user avatar
2 votes
1 answer
144 views

In my project I have several "basic" interfaces whose behavior is fixed, i.e. the default implementation will always be good for every puropse. So I defined them as concrete classes with ...
Nicola Mori's user avatar
0 votes
1 answer
250 views

It is possible to nest many decorators. @decorator_one @decorator_two @decorator_three @decorator_four def some_silly_function(): pass How do we write a decorator class so that the order in which ...
Samuel Muldoon's user avatar
0 votes
0 answers
135 views

I'm trying to design and develop a software (part of a bigger application) that should compute and render a spectrogram. The spectrogram can be rendered either from live microphone or a file (assuming ...
Baffo rasta's user avatar
2 votes
2 answers
665 views

So I've been going over some design patterns and I came across this discussion https://stackoverflow.com/questions/43565475/using-lists-instead-of-decorator-pattern I've been thinking that in all ...
crommy's user avatar
  • 129
-1 votes
1 answer
88 views

In a project I am doing, I have to perform a lot of repetitive checks at the beginning of each API end point. As the amount of duplicate code started to grow, I thought of using a decorator to wrap ...
Farzad's user avatar
  • 3
0 votes
2 answers
205 views

I've got a class that is a facade class (encapsulates complex-ish behaviour for reusability). It has a function called manage (the class is called Manager): function manage() { $entityBuilder = '...
pro100tom's user avatar
  • 449
-1 votes
1 answer
2k views

Here's what I'd like to do in the form of working code, since it's difficult for me to explain otherwise: from typing import Callable, Generic, TypeVar from typing_extensions import Self # The type ...
lapraswastaken's user avatar
0 votes
2 answers
4k views

I've started learning Python recently, and there are some topics I cannot really understand. One is the usage of the decorators in user defined objects, or encapsulation more generally. I mean, let's ...
tommy1996q's user avatar
0 votes
2 answers
652 views

I have a service class that does some magic. I want to introduce a new type of functionality - raise an event. I am absolutely sure that decorator pattern is great for this scenario. The problem is ...
pro100tom's user avatar
  • 449
1 vote
1 answer
370 views

I have a Dao interface which doesn't have any methods defined. Then I have multiple classes which implement this interface, like PetDao and HouseDao. For some of the implementation classes, and some ...
Pepit's user avatar
  • 13
2 votes
1 answer
265 views

I have a C++ class (Class D) that is a decorator of another class (Class B). Class D inherits from B and also requires an instance of B to construct that it keeps track of. Class D overrides all ...
Alexis Winters's user avatar
-1 votes
2 answers
962 views

How to design a service layer structure that will be resistant to exceptions. Let's say I have a simple OrderService service, this service performs basic operations - saving an order. public interface ...
jnemecz's user avatar
  • 299
3 votes
1 answer
168 views

I had some engaging conversation with my co-worker and we've discussed the "proper way" of Decorator Pattern usage. Unfortunately I couldn't find any confirmation of my assumptions and it's ...
Maciej Król's user avatar
4 votes
1 answer
915 views

I've got a web application with an architecture somewhat like a front-controller MVC design. I get HTTP requests, route them, run them through a filter layer, dispatch them to my domain classes which ...
CXJ's user avatar
  • 187

15 30 50 per page