Questions tagged [facade]

16 questions
3
votes
1 answer

Multiple Facade Classes must be combined in 1 Facade Class

Is this some rule that if I have multiple Facade classes they must be combined in 1 Facade Class? For example, I have a Hospital System with different classes, like Appointment, Patient, Doctor, Medicine. I created different Facade Classes like,…
sallushan
  • 179
  • 4
2
votes
5 answers

Facade pattern or just expose child objects?

Wondering about pros and cons around a facade pattern implementation (or perhaps there is a better pattern I should consider), versus simply exposing a dependent object to a caller. Consider the following: public class Model implements Player { …
gdbj
  • 123
  • 5
2
votes
1 answer

What if Facade contains business logic?

Consider that the Facade has inside it lots of sub-components but it done not pass messages from one sub-component to the other but also has some business logic in it. Is it still Facade pattern?
Narek
  • 1,133
  • 1
  • 9
  • 19
1
vote
1 answer

Does it make sense to have a facade centralizing events too?

From my understanding a facade is a class with the sole purpose of simplifying the use of a specific system/module behavior (its methods). It should not contain any relevant logic of the underlying system, just centralize and simplify its use. My…
1
vote
1 answer

Choosing which operations to perform in the front-end or the back-end

I am implementing a system where in the front-end, the user needs to select if option A or option B should be active. Depending on the option, a conversion module converts other input data for use with a low-level calculation-core. If option A is…
1
vote
3 answers

Is it good practice to create a facade only to be able to mock the wrapped implementation?

I'm currently writing unit tests for ASP.NET Core Controllers. Some controllers inject UserManager which seems to be a really hard type to mock. After some attempts to mock or even fake it, I eventually had the idea to create a facade to wrap the…
Sandro
  • 113
  • 3
1
vote
1 answer

Decorator or Facade

I face an issue if to use a decorator or facade pattern to accomplish my needs. Imagine a client wants to play a video. He can use the interface public interface IVideoPlayer { // Prepares everything to set up and plays the video void…
Creepin
  • 219
  • 1
  • 7
1
vote
2 answers

Is it okay to put all your error handling on facade layer?

I am doing a Java Spring-Boot backend project and I am implementing a controller-facade-service pattern on my structure. So is it best to put all my error handling on the facade layer, while the service just throws the errors occured, and the…
alona
  • 21
  • 3
0
votes
2 answers

How to refactor code so that a facade class could be decoratable?

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 = 'Some builder'; $someData = 'Some data'; …
pro100tom
  • 449
  • 2
  • 8
0
votes
2 answers

Separate DTOs consequently for each module?

Following the hexagonal architecture and package design you will have somewhere an entry point reaching to your core functionality. Often this is done by using a facade. To hide the core logic from outside i usually pass DTOs into that facades. For…
Jim Panse
  • 338
  • 3
  • 11
0
votes
1 answer

Should Facade handle all exceptions or throw

I am trying to abstract the elasticsearch python client. I have a method index document def index(self, body, id=None): """ Inserts one document into elasticsaerch. If id is None then it will autogenerate the id. …
user212699
0
votes
2 answers

Using typeless maps on api boundaries

What do you think about passing typeless maps to APIs (packages, systems, adapters) outer to Core Domain as in 1st Way below? Strongly-typed objects are inside Domain API, and business rules are using them. 1st WAY: Domain -> Web API -> …
-1
votes
3 answers

What is the difference between Facade and God?

A Facade is a higher level API over a whole subsystem. A God is class that violates SRP. Where do we draw the line? Does the following code represent any of the two: enum UnitType{Demon, Paladin}; namespace demons { bool are_scary(); static…
Vorac
  • 7,073
  • 7
  • 38
  • 58
-1
votes
1 answer

What is the C++ equivalent of a logging facade in Java?

I'm currently writing a library in C++ and was wondering if I should log from within it. Googling the issue I came across this question but it makes reference to a logging facade. Is there anything equivalent for C++?
ruipacheco
  • 119
  • 5
-3
votes
1 answer

How can interface work, if there is no code inside its abstract methods?

Interface is used to implement more than one class but it doesn't have any code inside its methods... however the method that is called works with its respective function. Also, it gets very confusing when it is used in design patterns like facade.…
1
2