Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Assignment 1 Front Sheet: Qualification BTEC Level 5 HND Diploma in Computing Unit Number and Title Submission Date

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 8

ASSIGNMENT 1 FRONT SHEET

Qualification BTEC Level 5 HND Diploma in Computing

Unit number and title Unit 20: Advanced Programming

Submission date Date Received 1st submission

Re-submission Date Date Received 2nd submission

Student Name Dao Ngoc Huy Student ID GCH190066

Class GCH0903 Assessor name Le Viet Bach

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 Huy

Grading grid

P1 P2 M1 M2 D1 D2
❒ Summative Feedback: ❒ Resubmission Feedback:

Grade: Assessor Signature: Date:


Lecturer Signature:
Table of Contents
1, Introduction............................................................................................................................................................................................................. 4
2, OOP General Concepts............................................................................................................................................................................................. 4
3, OOP Scenario........................................................................................................................................................................................................... 4
3.1, Scenario............................................................................................................................................................................................................ 4
3.2, Use case Diagram.............................................................................................................................................................................................. 4
3.3, Class Diagram.................................................................................................................................................................................................... 4
3.3.1, Class........................................................................................................................................................................................................... 4
3.3.2, Object......................................................................................................................................................................................................... 4
3.3.3, Encapsulation............................................................................................................................................................................................. 4
3.3.4, Inheritance................................................................................................................................................................................................. 4
3.3.5, Polymophism............................................................................................................................................................................................. 4
4, Design Patterns........................................................................................................................................................................................................ 5
4.1, Creational Design Pattern................................................................................................................................................................................. 5
4.2, Structural Design Patern................................................................................................................................................................................... 5
4.3, Behavioral Design Pattern................................................................................................................................................................................. 5
5, Desgin Pattern vs OOP............................................................................................................................................................................................. 5

1, Introduction
This report will review basic concepts of Object-Oriented Programing (OOP) base on a scenario. Some concepts, basic knowledge and scenarios
about design pattern will also mentioned
2, OOP General Concepts
Object-Oriented Programming (OOP) stands for Object-Oriented Programming. Inheritance, hiding, polymorphism, and other real-world
principles are all part of object-oriented programming. The main purpose of OOP is to link data and the functions that run on it so that no other
part of the code can access it except that function

Object-oriented programming has several advantages over procedural programming:

 OOP is faster and easier to excute


 OOP provided a clear structure for the programs
 OOP make the code DRY (Don’t Repeat Yourself) and make the code easier to maintain modify and debug
 OOP makes it possible to create full reusable applications with less code and shorter development time

Object-oriented programming (OOP) languages are designed to overcome these problems

 The basic unit of OOP is a class, which encapsulates both the static attributes and dynamic behaviors within a "box", and specifies the
public interface for using these boxes. Since the class is well-encapsulated (compared with the function), it is easier to reuse these
classes. In other words, OOP combines the data structures and algorithms of a software entity inside the same box
 OOP languages permit higher level of abstraction for solving real-life problems. The traditional procedural language (such as C and
Pascal) forces you to think in terms of the structure of the computer (e.g. memory bits and bytes, array, decision, loop) rather than
thinking in terms of the problem you are trying to solve. The OOP languages (such as Java, C++, C#) let you think in the problem space,
and use software objects to represent and abstract entities of the problem space to solve the problem.

Consider OOP as a car, there may be many cars with different names and brand but all of them will share some common properties like all of
them will have 4 wheels, Speed Limit, Mileage range etc. So here, Car is the class and wheels, speed limits, mileage are their properties.

There are 6 main characterisitc of Object- Oriented Programming:


3, OOP Scenario
3.1, Scenario
Our scenario is to create a system that allows customers to order products from abroad or somewhere far away. This system has 2 actors, admin
and customers. Admin : login to the system with your account, admin can view his customer list, add new products, edit, delete products from
the system. Customers: customers must register an account by name, email, address, phone number. After registration is complete, customers
can log in to the system, customers can view and update their profile, customers can search for products, click on products to view details.
Customers can add products to the cart, or remove products from the cart. Finally, the customer can click order.
3.2, Use case Diagram

3.3, Class Diagram


3.3.1, Class

Classes are special kinds of templates from which you can create objects. Each object contains data and methods to manipulate and access that
data. The class defines the data and the functionality that each object of that class can contain.

A class declaration consists of a class header and body. The class header includes attributes, modifiers, and the class keyword. The class body
encapsulates the members of the class, that are the data members and member functions.. 

3.3.2, Object
An Object is an identifiable entity with some characteristics and behavior. An Object is an instance of a Class. When a class is defined, no
memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated

3.3.3, Encapsulation
Encapsulation is the process of encapsulating data and information into a single unit. Encapsulation is defined as the binding of data and the
functions that manipulate it in Object-Oriented Programming:

 Public: All of the class members, data members and member functions that have been made public will be accessible. To access the
public members of a class from anywhere in the program, use the direct member access operator with the object of that class.
 Protected: Protected access modifier is similar to that of private access modifiers, the difference is that the class member declared as
Protected are inaccessible outside the class but they can be accessed by any subclass(derived class) of that class.
 Private: The private members of the class can only be accessed by functions within the class. Any object or function can't access them
directly
 from outside the class. Only member functions and friend functions have access to a class's private data members.
3.3.4, Inheritance
Inheritance is the process by which one object can acquire the properties of another object. Inheritance is a "is a kind of" relationship and it
supports the concept of classification in which an object needs only define those qualities that make it unique within the class. Inheritance
involves a base class and a derived class. The derived class inherits from the base class and also can override inherited members as well as add
new members to extend the base class.

Classes can inherit from a single class and one or more interfaces. When inheriting from a class, the derived class inherits the members including
the code of the base class. The important point to remember is that Constructors and Destructors are not inherited from the base class.

3.3.5, Polymophism
The word polymorphism means having many forms. In simple words, we can define polymorphism as the ability of a message to be displayed

in more than one form.

A person at the same time can have different characteristic. Like a man at the same time is a father, a husband, an employee. So the same

person possess different behavior in different situations. This is called polymorphism.

An operation may exhibit different behaviors in different instances. The behavior depends upon the types of data used in the operation
4, Design Patterns
4.1, Creational Design Pattern

4.2, Structural Design Patern

4.3, Behavioral Design Pattern

5, Desgin Pattern vs OOP

You might also like