question 1aa design pattern can be classified by


QUESTION 1

(a) A design pattern can be classified by its scope, which specifies whether the pattern applies primarily to classes or objects. Differentiate between class patterns and object patterns.

(b) Explain each of the following Object Oriented Design Principles. In each case give an example of a design pattern that can be used to apply the principle.

a. Program to an ‘interface' not to an Implementation

b. Classes should be opened for extension but closed for modification (Open Close Principle)

c. Principle of Least Knowledge - Talk only to your immediate friends

(c) Developers should be encouraged to learn and use design patterns. Elucidate why.

QUESTION 2

(a) A class instance can be created using new operator. Why should we use creational design prototypes to create objects?

(b) The factory method is one of the mostly used and one of the more robust design patterns. Discuss on the factory pattern's motivation, intent, associated benefits and drawbacks. Also provide a UML diagram to illustrate a typical implementation.

(c) The Abstract Factory pattern is often makes use of Dependency Inversion principle. Explain the term Dependency Inversion.

QUESTION 3

(a) XYZ news agency is a company which gathers news and publishes them to different subscribers. You have been asked to create an application that will allow the agency to inform right away, when event occurs, its subscribers about the occurrence. The subscribers can receive the news in different ways: Emails, SMS, etc. The solution need to be extensively enough to support new types of subscribers (maybe new communication technologies will appear). Identify the most appropriate GOF design pattern for the above task. Using a UML class diagram illustrate an implementation of a possible solution for the above problem.

(b) Differentiate between the Strategy and State design patterns.

(c) The Adapters can be implemented either as Object adapters or class adapters. Briefly describe each of these adapters.

QUESTION 4

(a) Active Record is one of the two data source architectural patterns covered during the course. Describe this pattern, explaining how it works and when to use it.

(b) PHP Frameworks such as CodeIgniter and Zend are all based on the Model View Controller (MVC) pattern. Very often such frameworks make use of the Front Controllers. Using a diagram explain the purpose of Front Controllers.

(c) Briefly describe three reuse anti-patterns and their refactored solution.

Request for Solution File

Ask an Expert for Answer!!
PHP Web Programming: question 1aa design pattern can be classified by
Reference No:- TGS0444866

Expected delivery within 24 Hours