Questions tagged [facade]

The Facade pattern is one of the Gang of Four's structural design patterns.

The facade pattern is a software engineering design pattern commonly used with Object-oriented programming. The name is by analogy to an architectural facade.

It is one of the Gang of Four's structural , first published in Gamma et al.'s book "Design Patterns: Elements of Reusable Object-Oriented Software".

From Wikipedia: The Facade pattern provides a unified interface to a set of interfaces in a subsystem. It defines a higher-level interface that makes the subsystem easier to use.


References

392 questions
4
votes
1 answer

How to Attach Event from Facade to Another Class

Supposed I've Facade class that has two subsystem classes. Each subsystem has different event. The FacadeClass is public class FacadeClass { private SubsystemClass1 _s1; private SubsystemClass2 _s2; public FacadeClass() { …
Hensembryan
  • 1,067
  • 3
  • 14
  • 31
4
votes
4 answers

How to simplify a class without writing methods that are already simple?

I have a complex class and I want to simplify it by implementing a facade class (assume I have no control on complex class). My problem is that complex class has many methods and I will just simplify some of them and rest of the will stay as they…
reader_1000
  • 2,473
  • 17
  • 15
3
votes
1 answer

Facade Pattern for rxjs streams for cleaner Angular architecture?

For context: I'm working on an Angular 15 app, where I distinguish between smart and dumb components. My smart components do have connection to services, whereas the dumb components only communicate via Inputs and Outputs with the smart component…
MikhailRatner
  • 452
  • 6
  • 13
3
votes
1 answer

Adding new method to Abstract Base class which has many derived classes without breaking existing base class

I have a abstract base class . There are many abstract classes which derived from this Abstract Base class #if ABI_VERSION_ATLEAST1 class Base { public: virtual void food() =0 }; #endif for example #if…
3
votes
0 answers

Dynamic @Selector with NGXS Facades pattern

I have the following structure: state: @Selector() static getClientById(state: ClientListStateModel) { return (id: number) => state.clientList.find(f => f.id === id); } facade (storeService): @Select(ClientListState.getClients) clients$:…
3
votes
3 answers

Association or Aggregation relationship for Facade design pattern?

I'm studying the GoF design patterns, in particular the Facade pattern. I understand its use and implementation, but I have a doubt about its UML model. The solution proposed by my professor, summarized, is the following: public class Facade{ …
sixpain
  • 342
  • 1
  • 5
  • 13
3
votes
0 answers

How to mock pass-by-reference parameter using laravel Facade?

I'm making a simple laravel package to wrap bash executions and make it be able to mock as laravel facade, but I have a problem. Most of Php functions that runs bash commands uses pass-by-reference parameters, and the question is, how can I mock the…
axsor
  • 470
  • 1
  • 6
  • 16
3
votes
3 answers

Public Fields in DTO and Domain object

I'm doing a code review for one project. It's architecture you can see on the following scheme: At this moment DTO - are simple POJO's and Domains - contains Hibernate anotations. As I know one of the benefits using DTO is that you can make all…
trnl
  • 514
  • 3
  • 20
3
votes
2 answers

Composition vs facade pattern

I found a response that made me understand a bit more class compositioning. class Engine { } class Automobile { } class Car extends Automobile // car "is a" automobile //inheritance here { Engine engine; // car "has a" engine //composition…
elzoy
  • 5,237
  • 11
  • 40
  • 65
3
votes
1 answer

Does Intellij Idea IDE has a feature to composite Java classes (forwarding class generation)

For example, I want to extend HashSet class, but instead of extending the class, I give my new class a private field that references an instance of the existing class. Each instance method in the new class invokes the corresponding method on the…
Aleksei Sotnikov
  • 633
  • 4
  • 15
3
votes
1 answer

Call to undefined method Illuminate\Notifications\Channels\MailChannel::route()

I am trying to send notification to a particular mail id and is using the following code in my controller: $product=Product::first(); Notification::route('mail','suraj@yahoo.com') ->notify(new NewProducts($product)); But I get an error …
Suraj Jeswara
  • 446
  • 2
  • 10
  • 23
3
votes
1 answer

Facade with two services inside and dependency injection - design pattern approach

I want to create Facade class to handle few operations on two services. For contacting those services I've got proxy classes. Having abstract Proxy and derived proxy per service - how can I create this part of architecture, to avoid Resolving in…
Saint
  • 5,397
  • 22
  • 63
  • 107
3
votes
1 answer

Scala.js does not see a JS *class* in the global scope, but sees a constructor function

While trying to write scalajs facade for javascript class, i am getting the following error: "error Uncaught TypeError: $g.MyRect2 is not a constructor" in chrome console. My javascript class defination is as follows: class MyRect2 { …
br_sysx
  • 43
  • 3
3
votes
1 answer

Constructing Proper Python Facade Class with Super?

I thought I had a handle on Multiple Inheritance with Super() and was trying to use it inside a Facade class, but I am running into a weird bug. I'm using a well made Python Workflow software called Fireworks, but the structures of the classes and…
3
votes
1 answer

Wrapping ElasticSearch SDK in facade to include additional info on some calls

This requires a little bit of background knowledge, so I apologize if I am not clear enough. I have an ES (ElasticSearch) service that is exposed through a secondary API. The secondary API is responsible for checking ownership and access to…
Nicklas Kevin Frank
  • 6,079
  • 4
  • 38
  • 63