Façade Pattern: Submitted By: Ankit Kumar Jaiswal Sambit Panda Abhinav Jain
Façade Pattern: Submitted By: Ankit Kumar Jaiswal Sambit Panda Abhinav Jain
Façade Pattern
Submitted By:
Ankit Kumar Jaiswal
Sambit Panda
Abhinav Jain
+
Facade Pattern
A Facade Pattern says that just "just provide a unified and simplified
interface to a set of interfaces in a subsystem, therefore it hides the
complexities of the subsystem from the client".
So, the complexities and modules involved in achieving the prime goal of
withdrawal and deposit can be kept in Façade.
package facadetestdemo;
}
+
Step 2: Create additional class for user
account checking process
package facadetestdemo;
public class CheckAccount {
}else{
checker.totAmount -= amount;
System.out.println("Withdrawn is completed: " + amount);
System.out.println("Current Balance: " + checker.getTotalAmount() + "\n");
}
}
}
+
Step 3: Continue.
Withdraw withdraw;
Deposit deposit;
CheckAccount accChecker;
accountNo = accNo;
securityNo = secNo;
}
+
Step 4: Continue.
}else
{
System.out.println("Access Dinied: invalid credentials! \n");
}
}
+
Step 4: Continue.
}else
{
System.out.println("Access Dinied: invalid
credentials! \n");
}
}
}
+
Step 5: Create class (main method) to access
methods of the facade class
transHandler.withdrawMoney(1500);
transHandler.depositMoney(200);
}
}
+
Advantage of Facade Pattern
It shields the client from dealing with the complicated inner system
Can use to shield the legacy and poorly designed code which is unable to
refactor
Ability to introduce more the one façade to one system to layer the subsystems
+
Drawbacks of Façade Design Pattern
If used without a real need, your system may get further complicated by
unnecessary codes
Note that Facade does not add any functionality, it just simplifies interfaces
+ 18
Thank you