Higher Nationals in Computing Advanced Programming ASSIGNMENT 1 Learner’s name: NGUYỄỄN HOÀNG PHƯƠNG ID: GCS200104 Class: GCS0902 Subject code: 1651 Assessor name: Nguyễễn Văn Sơn Assignment due: Assignment submitted: ASSIGNMENT 1 FRONT SHEET Qualification BTEC Level 5 HND Diploma in Computing Unit number and title Unit 20: Advanced Programming Date Received 1st Submission date submission Date Received 2nd Re-submission Date submission Student Name Nguyen Hoang Phuong Student ID Class GCS200104 Assessor name Nguyen Van Son Student declaration I certify that the assignment submission is entirely my own work and I fully understand the consequences of plagiarism. I understand that making a false declaration is a form of malpractice. Student’s signature Grading grid P1 P2 M1 M2 D1 D2 ❒ Summative Feedback: ❒ Resubmission Feedback: Grade: Assessor Signature: Date: Lecturer Signature: ASSIGNMENT 1 BRIEF Qualification BTEC Level 5 HND Diploma in Computing Unit number Unit 20: Advanced Programming Assignment title Examine and design solutions with OOP and Design Patterns Academic Year 2018-2019 Unit Tutor Doan Trung Tung Issue date 25 April 2019 Submission date 7 May 2019 Submission Format: Format: The submission is in the form of a group written report. This should be written in a concise, formal business style using single spacing and font size 12.
You are required to make use of headings, paragraphs and subsections as appropriate, and all work must be supported with research and referenced using the Harvard referencing system. Please also provide a bibliography using the Harvard referencing system. Submission Students are compulsory to submit the assignment in due date and in a way requested by the Tutors. The form of submission will be a soft copy in PDF posted on corresponding course of http://cms.vn/ Note: The Assignment must be your own work, and not copied by or from another student or from books etc.
If you use ideas, quotes or data (such as diagrams) from books, journals or other sources, you must reference your sources, using the Harvard style. Make sure that you know how to reference properly, and that understand the guidelines on plagiarism. If you do not, you definitely get fail Assignment Brief and Guidance: Scenario: You have recently joined a software development company to help improve their documentation of their in-houses software libraries which were developed with very poor docu e o o e ouses so w e b es w c we e deve oped w ve y poo documentation. As a result, it has been very difficult for the company to utilise their code in multiple projects due to poor documentation.
Your role is to alleviate this situation by showing the efficient of UML diagrams in OOAD and Design Patterns in usages. Tasks You and your team need to explain characteristics of Object-oriented programming paradigm by applying Object-oriented analysis and design on a given (assumed) scenario. The scenario can be small but should be able to presents various characteristics of OOP (such as: encapsulation, inheritance, polymorphism, override, overload, etc. The second task is to introduce some design patterns (including 3 types: creational, structural and behavioral) to audience by giving real case scenarios, corresponding patterns illustrated by UML class diagrams.
To summarize, you should analyze the relationship between the object-orientated paradigm and design patterns. The presentation should be about approximately 20-30 minutes and it should be summarized of the team report. Learning Outcomes and Assessment Criteria Pass Merit Distinction LO1 Examine the key components related to the object-orientated programming paradigm, analysing design pattern types P1 Examine the M1 Determine a design D1 Analyse the relationship characteristics of the pattern from each of the between the object-orientated object-orientated paradigm creational, structural and paradigm and design patterns. as well as the various class behavioural pattern types.
LO2 Design a series of UML class diagrams P2 Design and build class M2 Define class diagrams for D2 Define/refine class diagrams using a UML tool. specific design patterns using a diagrams derived from a given code UML tool. scenario using a UML tool. Table of Contents 1.
Examine the characteristics of the object-orientated paradigm as well as the various class relationships. What is OOP ?. 4 Basic concept of OOP. Various Class Relationship.
Design and build class diagrams using a UML tool. Examine the characteristics of the object-orientated paradigm as well as the various class relationships. What is OOP ? - Object oriented programming (OOP) is a programming structure where programs are organized around objects as opposed to action and logic. This is essentially a design philosophy that uses a different set of programming languages such as C#.
Understanding OOP concepts can help make decisions about how you should design an application and what language to use.[ CITATION ALE17 \l 1066 ] - A simple example would be a class representing a person. The person class would contain attributes to represent information such as the person’s age, name, height, etc. The class definition might also contain functions such as "sayMyName" which would simply print that person’s name to the screen. - A family could be constructed by instantiating person objects from the class for each member of the family.
Each person object would contain different data attributes since each person is unique. 4 Basic concept of OOP - Object-oriented programming has four basic concepts: encapsulation, abstraction, inheritance, and polymorphism. Even if these concepts seem incredibly complex, understanding the general framework of how they work will help you understand the basics of an OOP computer program. Below, we outline these four basic principles and what they entail: + Encapsulation + Abstraction + Inheritance + Polymorphism [ CITATION Kyl21 \l 1066 ] 1.
Encapsulation - The word, “encapsulate,” means to enclose something. Just like a pill "encapsulates" or contains the medication inside of its coating, the principle of encapsulation works in a similar way in OOP: by forming a protective barrier around the information contained within a class from the rest of the code. - In OOP, we encapsulate by binding the data and functions which operate on that data into a single unit, the class. By doing so, we can hide private details of a class from the outside world and only expose functionality that is important for interfacing with it.
When a class does not allow calling code access to its private data directly, we say that it is well encapsulated. - Example: Elaborating on the person class example from earlier, we might have private data in the class, such as "socialSecurityNumber," that should not be exposed to other objects in the program. By encapsulating this data member as a private variable in the class, outside code would not have direct access to it, and it would remain safe within that person’s object. - If a method is written in the person class to perform, say, a bank transaction called "bankTransaction()," that function could then access the "socialSecurityNumber" variable as necessary.
The person’s private data would be well encapsulated in such a class. - Often, it’s easier to reason and design a program when you can separate the interface of a class from its implementation, and focus on the interface. This is akin to treating a system as a “black box,” where it’s not important to understand the gory inner workings in order to reap the benefits of using it. - This process is called “abstraction” in OOP, because we are abstracting away the gory p , g y g y implementation details of a class and only presenting a clean and easy-to-use interface via the class’ member functions.
Carefully used, abstraction helps isolate the impact of changes made to the code, so that if something goes wrong, the change will only affect the implementation details of a class and not the outside code. - Example: Think of a stereo system as an object with a complex logic board on the inside. It has buttons on the outside to allow for interaction with the object. When you press any of the buttons, you're not thinking about what happens on the inside because you can't see it.
Even though you can't see the logic board completing these functions as a result of pressing a button, it's still performing them., albeit hidden to you. - This is the concept of abstraction, which is incredibly useful in all areas of engineering and also applied to great effect in object-oriented programming. - Example: In OOP, we might have a class defined to represent the human body. One might define some functions as part of its publicly facing interface such as “walk()” or “eatFood().” Calling code could call these functions and remain completely oblivious to the complex inner workings of the human body and its necessary functions to perform the act of walking or eating.
These details are completely hidden in the implementation of the walk() and eatFood() body functions and are, therefore, us abstracted away from the end user. In these cases, it’s not important for calling code to understand how the brain coordinates walking or how the stomach manages digesting the food, but rather simply that a human walked or ate. Inheritance - Object-oriented languages that support classes almost always support the notion of “inheritance.” Classes can be organized into hierarchies, where a class might have one or more parent or child classes. If a class has a parent class, we say it is derived or inherited from the parent class and it represents an “IS-A” type relationship.
That is to say, the child class “IS-A” type of the parent class. - Therefore, if a class inherits from another class, it automatically obtains a lot of the same functionality and properties from that class and can be extended to contain separate code and data. A nice feature of inheritance is that it often leads to good code reuse since a parent class’ functions don’t need to be re-defined in any of its child classes. - Consider two classes: one being the superclass—or parent—and the other being the subclass—or child.
The child class will inherit the properties of the parent class, possibly modifying or extending its behavior. Programmers applying the technique of inheritance arrange these classes into what is called an “IS-A” type of relationship. - Example: For instance, in the animal world, an insect could be represented by an Insect superclass. All insects share similar properties, such as having six legs and an exoskeleton.
Subclasses might be defined for grasshoppers and ants. Because they inherit or are derived from the Insect class, they automatically share all insect properties. Polymorphism - In OOP, polymorphism allows for the uniform treatment of classes in a hierarchy. Therefore, calling code only needs to be written to handle objects from the root of the hierarchy, and any object instantiated by any child class in the hierarchy will be handled in the same way.
- Because derived objects share the same interface as their parents, the calling code can call any function in that class’ interface. At run-time, the appropriate function will be called depending on the type of object passed leading to possibly different behaviors. - Example: Suppose we have a class called, “Animal” and two child classes, “Cat,” and “Dog.” If the Animal class has a method to make a noise, called, “makeNoise,” then, we can override the "makeNoise" function that is inherited by the sub-classes, "Cat" and "Dog," to be “meow” and “bark,” respectively. Another function can, then, be written that accepts any Animal object as a parameter and invokes its "makeNoise" member function.
The noise will be different: either a “meow” or a “bark” depending on the type of animal object that was actually passed to the function. Various Class Relationship - Classes are interrelated to each other in specific ways. In particular, relationships in class diagrams include different types of logical connections.