• Document: BCS THE CHARTERED INSTITUTE FOR IT. BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING
  • Size: 584.1 KB
  • Uploaded: 2019-01-12 14:58:01
  • Status: Successfully converted


Some snippets from your converted document:

BCS THE CHARTERED INSTITUTE FOR IT BCS HIGHER EDUCATION QUALIFICATIONS BCS Level 5 Diploma in IT OBJECT ORIENTED PROGRAMMING Wednesady 23rd March 2016 – Afternoon Answer any FOUR questions out of SIX. All questions carry equal marks Time: TWO hours Answer any Section A questions you attempt in Answer Book A Answer any Section B questions you attempt in Answer Book B The marks given in brackets are indicative of the weight given to each part of the question. Calculators are NOT allowed in this examination. Section A Answer Section A questions in Answer Book A General comments on candidates' performance Future candidates are advised to note the following observations:  Answer all parts of the questions attempted. Some candidates omitted parts of the question. Even if unable to provide a full answer, a partial answer might result in the extra marks that could make a difference between a failure and pass.  Avoid repetition. Some candidates attempted to gain extra marks by repeating points already made. Future candidates are advised that no marks will be gained for such efforts.  Answer the questions set. Some candidates attempted to gain marks by providing answers that were related only vaguely, if at all, to the questions set. Future candidates are advised that no marks are given for such answers.  Use care when writing code. Care and precision is necessary when answering questions using code. Often the examiners had difficulty identifying which variables or commands were being used; inevitably, the candidates lost marks as a result. Note that the answer pointers contained in this report are examples only. Full marks were given for valid alternative answers. Section A A1. Describe the following design patterns: i) Adapter; ii) Decorator; iii) Singleton. For each pattern, state the motivation for the pattern, give a UML class diagram for the pattern and an explanation of the classes which participate in the pattern. (25 marks) Answer Pointers From: http://www.blackwasp.co.uk/gofpatterns.aspx The adapter pattern is a design pattern that is used to allow two incompatible types to communicate. Where one class relies upon a specific interface that is not implemented by another class, the adapter acts as a translator between the two types.  Client. The client class is that which requires the use of an incompatible type. It expects to interact with a type that implements the ITarget interface. However, the class that we wish it to use is the incompatible Adaptee.  ITarget. This is the expected interface for the client class. Although shown in the diagram as an interface, it may be a class that the adapter inherits. If a class is used, the adapter must override its members.  Adaptee. This class contains the functionality that is required by the client. However, its interface is not compatible with that which is expected.  Adapter. This class provides the link between the incompatible Client and Adaptee classes. The adapter implements the ITarget interface and contains a private instance of the Adaptee class. When the client executes MethodA on the ITarget interface, MethodA in the adapter translates this request to a call to MethodB on the internal Adaptee instance. The decorator pattern is a design pattern that extends the functionality of individual objects by wrapping them with one or more decorator classes. These decorators can modify existing members and add new methods and properties at run-time.  ComponentBase. This abstract class is the base class for both the concrete components and all decorator classes. The base class defines any standard members that will be implemented by these classes. If you do not wish to create any actual functionality in this class you may decide to create it as an interface instead.  ConcreteComponent. The ConcreteComponent class inherits form the ComponentBase class. There may be multiple concrete component classes, each defining a type of object that may be wrapped by the decorators.  DecoratorBase. This abstract class is the base class for all decorators for components. The class inherits its public interface from ComponentBase so that decorators can be used in place of concrete objects. It adds a constructor that accepts a ComponentBase object as its parameter. The passed object is the component that will be wrapped. As the wrapped object

Recently converted files (publicly available):