Please boost your Plan to download papers
Pages 4 (1004 words)
Decorator pattern is used to provide flexibility to the existing class diagram by adding new behavior dynamically. We can stack multiple decorators on top of each other. It is an alternative to subclassing. In an object oriented programming, classes can be created at compile time only, but it helps in extending the functionality of classes at run time…
In the new system, Booking can be done through box office, Telephone or internet and payment can be done online also. So, we can do reservation through boxoffice booking and booking decorator. Booking decorator again consists of telephone booking and internet booking. In the main diagram, decorator class has been shown through blue lines.
Sometimes in object oriented programming we deal with collections. Iterator pattern uses iterators and access the elements of the aggregate objects without exposing their underlying methods and put them in iterator object. It also allows modifying the collection without making changes outside the collection. For traversing different collections, it provides uniform interface. It works on the principle of encapsulation. Collection is traversed sequentially. In this case, we have made two aggregate objects Screen and Seating Plan. In Screen, Show and Show schedule have been aggregated together and iterators iterate through shows for all screens of different cinemas. In Seating Plan, rows and seats have been aggregated together so that iterators can iterate through each seat to check its availability and booking. In the main diagram, iterator pattern is shown using red lines.
Not exactly what you need?