\\ Facade Pattern
Function Package1 {
Class Class1 {
module operationA {
Print "Class1 operationA"
}
}
Class Class2 {
Private:
x=10
Public:
module operationB {
Print "Class2 operationB", .x
}
Class:
module Class2(.x) {
}
}
Class Class3 {
Group Inner1 {
Private:
z=2000
Public:
x=100
module operationD {
Print "Class3 inner1 operationD", .z, .x
}
}
module operationC {
\\ we can't read the .inner1.z because .z is private to .Inner1
Print "Class3 operationC", .inner1.x, valid(.inner1.z)=false
}
}
Class Facade {
Private:
\\ these are private inner clases
\\ not pointer to objects.
Class1 a
Class2 b(300)
Class3 c
Public:
module doSomething {
.a.OperationA
.b.OperationB
.c.OperationC
.c.inner1.OperationD
}
}
=Facade()
}
M=Package1()
Print M is type Facade
M.doSomething
Function Package1 {
Class Class1 {
module operationA {
Print "Class1 operationA"
}
}
Class Class2 {
Private:
x=10
Public:
module operationB {
Print "Class2 operationB", .x
}
Class:
module Class2(.x) {
}
}
Class Class3 {
Group Inner1 {
Private:
z=2000
Public:
x=100
module operationD {
Print "Class3 inner1 operationD", .z, .x
}
}
module operationC {
\\ we can't read the .inner1.z because .z is private to .Inner1
Print "Class3 operationC", .inner1.x, valid(.inner1.z)=false
}
}
Class Facade {
Private:
\\ these are private inner clases
\\ not pointer to objects.
Class1 a
Class2 b(300)
Class3 c
Public:
module doSomething {
.a.OperationA
.b.OperationB
.c.OperationC
.c.inner1.OperationD
}
}
=Facade()
}
M=Package1()
Print M is type Facade
M.doSomething
Δεν υπάρχουν σχόλια:
Δημοσίευση σχολίου
You can feel free to write any suggestion, or idea on the subject.