










































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This Report provide P, M and D of Advanced Programming subject #btec #greenwich #advancedprogramming #IT
Typology: Assignments
1 / 50
This page cannot be seen from the preview
Don't miss anything!











































Class: GCS0804_NX ID: GCS Assignment due: 0 6 / 0 5 / 2 0 2 1 Assignment submitted: 0 6 / 0 5 / 2 0 2 1
Learner declaration: I certify that the work submitted for this assignment is my own and research sources are fully acknowledged. Learner signature TAN SANG Date Grading grid P 3 P4 M4 M4 D3 D Assignment title Assignment 2: Implement and test an Object Oriented programming solution. In this assignment, you will have opportunities to provide evidence against the following criteria. Indicate the page numbers where the evidence can be found. Assessment criteria Expected evidence Task no. Assessor’s Feedback
Summative feedback: Assessor’s Signature: Date: Distinction descriptor No. (D 4 )
LO3: Implement code applying design patterns P3. Build an application derived from UML class diagrams. LO4: Investigate scenarios with respect to design patterns P4. Discuss a range of design patterns with relevant examples of creational, structural and behavioural pattern types. Specific requirements (see Appendix for assessment criteria and grade descriptors) Scenario: Please see the scenario from Assignment Brief 1. Task 1 In this task you will need to:
Appendix A- Grade Descriptor In addition to the above PASS criteria, this assignment gives you the opportunity to submit evidence in order to achieve the following MERIT and DISTINCTION grades Grade Descriptor Indicative characteristic/s Contextualization M 3 Develop code that imple ments a design pattern for a given purpose. M 4 Reconcile the most appropriate design pattern from a range with a series of given scenarios. D 3 Evaluate the use of design patterns for the given purpose specified in M3. D 4 Critically evaluate a range of design patterns against the range of given scenarios with justification of your choices. This brief has been verified as being fit for purpose Internal Verifier 1 Signature Date Internal Verifier 2 Signature Date
P3. Build an application derived from UML class diagrams. I. Scenario I designed a university management system that includes the lecturer system and the student system in response to a request from Greenwich University. Administrators can enter lecturer information such as ID, name, email, date of birth, address, and department into the system, correct the information if it is incorrect, or completely delete the information of the lecturer. Administrators can enter lecturer information such as ID, name, email, date of birth, address, and department into the system, correct the information if it is incorrect, or completely delete the lecturer's information. View a list of all of the system's teachers. This works in the same way as the student management system. I designed a university management system that includes the lecturer system and the student system in response to a request from the University of Greenwich. This is similar to how students are managed. To create this system, I used the C# programming language and the design pattern to make the program more reusable and flexible. The Singleton Pattern is used in this program. II. Class diagram
− Factory Method Pattern allows the sub-classes to choose the type of objects to create. − It promotes the loose-coupling by eliminating the need to bind application- specific classes into the code. That means the code interacts solely with the resultant interface or abstract class, so that it will work with any classes that implement that interface or that extends that abstract class. Usage of Factory Design Pattern − When a class doesn't know what sub-classes will be required to create − When a class wants that its sub-classes specify the objects to be created.
2. Abstract Factory Pattern Abstract Factory Pattern says that just define an interface or abstract class for creating families of related (or dependent) objects but without specifying their concrete sub-classes. That means Abstract Factory lets a class returns a factory of classes. So, this is the reason that Abstract Factory Pattern is one level higher than the Factory Pattern. An Abstract Factory Pattern is also known as Kit. Advantage of Abstract Factory Pattern − Abstract Factory Pattern isolates the client code from concrete (implementation) classes. − It eases the exchanging of object families. − It promotes consistency among objects. Usage of Abstract Factory Pattern − When the system needs to be independent of how its object are created, composed, and represented. − When the family of related objects has to be used together, then this constraint needs to be enforced. − When you want to provide a library of objects that does not show implementations and only reveals interfaces. − When the system needs to be configured with one of a multiple family of objects.
3. Singleton Pattern Singleton Pattern says that just “define a class that has only one instance and provides a global point of access to it”. In other words, a class must ensure that only single instance should be created and single object can be used by all other classes. There are two forms of singleton design pattern Early Instantiation: creation of instance at load time. Lazy Instantiation: creation of instance when required. Advantage of Singleton design pattern − Saves memory because object is not created at each request. Only single instance is reused again and again. − Usage of Singleton design pattern − Singleton pattern is mostly used in multi-threaded and database applications. It is used in logging, caching, thread pools, configuration settings etc. 4. Prototype Pattern Prototype Pattern says that cloning of an existing object instead of creating new one and can also be customized as per the requirement. This pattern should be followed, if the cost of creating a new object is expensive and resource intensive. Advantage of Prototype Pattern − The main advantages of prototype pattern are as follows: − It reduces the need of sub-classing. − It hides complexities of creating objects. − The clients can get new objects without knowing which type of object it will be. − It lets you add or remove objects at runtime. Usage of Prototype Pattern
− It is most effective in a situation where the rate of initializing a class instance is high. − It manages the connections and provides a way to reuse and share them. − It can also provide the limit for the maximum number of objects that can be created. Usage: − When an application requires objects which are expensive to create. Eg: there is a need of opening too many connections for the database then it takes too longer to create a new one and the database server will be overloaded. − When there are several clients who need the same resource at different times. II. Structural pattern:
1. Adapter Pattern An Adapter Pattern says that just "converts the interface of a class into another interface that a client wants". In other words, to provide the interface according to client requirement while using the services of a class with a different interface. The Adapter Pattern is also known as Wrapper. 2. Bridge Pattern A Bridge Pattern says that just "decouple the functional abstraction from the implementation so that the two can vary independently". The Bridge Pattern is also known as Handle or Body. 3. Composite Pattern A Composite Pattern says that just "allow clients to operate in generic manner on objects that may or may not represent a hierarchy of objects". 4. Decorator Pattern A Decorator Pattern says that just "attach a flexible additional responsibilities to an object dynamically".
In other words, The Decorator Pattern uses composition instead of inheritance to extend the functionality of an object at runtime. The Decorator Pattern is also known as Wrapper.
5. 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". In other words, Facade Pattern describes a higher-level interface that makes the sub- system easier to use. Practically, every Abstract Factory is a type of Facade. 6. Flyweight Pattern A Flyweight Pattern says that just "to reuse already existing similar kind of objects by storing them and create new object when no matching object is found". 7. Proxy Pattern Simply, proxy means an object representing another object. According to GoF, a Proxy Pattern "provides the control for accessing the original object". So, we can perform many operations like hiding the information of original object, on demand loading etc. **III. Behavior pattern:
According to GoF definition, observer pattern defines a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically. It is also referred to as the publish-subscribe pattern. In observer pattern, there are many observers (subscriber objects) that are observing a particular subject (publisher object). Observers register themselves to a subject to get a notification when there is a change made inside that subject. A observer object can register or unregister from subject at any point of time. It helps is making the objects loosely coupled. M 3 Develop code that implements a design pattern for a given purpose. I. Source code: