Você está na página 1de 15

Table of Contents

Introduction..........................................................................................................................3
Use Case Diagram...............................................................................................................4
Sequence Diagram...............................................................................................................5
Inheritance...........................................................................................................................6
Encapsulation.......................................................................................................................7
Limitation............................................................................................................................8
Object Oriented Programming Concept..............................................................................9
Comparison of Object-Oriented and Non Object-Oriented...............................................11
Inheritance.....................................................................................................................12
Polymorphism................................................................................................................13
Encapsulation.................................................................................................................14
Advantages of Object Oriented Programming Concept....................................................15
Why you need OO in this assignment?..............................................................................16
What is UML Diagram......................................................................................................16
References..........................................................................................................................17

Introduction
In this assignment, the researcher is to be designed an application to maintain student
exam details for a university. The users should be able to enter, search, edit and view
personnel information of students and also enter, view and edit exam marks of the
students based on different access priority. This application will be used by the
administrators, lecturers, administrative staff and students.
In this case, this system will provide 4 different users such as administrators, lecturers,
administrative staff and students to login to the management system. For each user, they
have different accessibility. For instance, the administrator has the highest access priority
which enables him or her to perform all the functionalities that exist in the application.
He or she is able to register new users to the system and able to add, delete, edit search
and update all the records including student records, staff records, lecturer records and
module records. The lecturers in charge of a module have the right to enter, view, delete
and edit marks for the given module. They are able to view and search student and
module information as well. Whereas, the students are only allow to view their
examination report and module details.
Besides that, the author will need to auto generate ID for each and every users in the
records and the numbers cannot be repeated.

Use Case Diagram

Sequence Diagram

Diagram above shows the sequence diagram of adding records to the system using
database.

Diagram above shows the sequence diagram of and search records including student,
lecturer, and administrator staffs record.

Inheritance

In this case, the author had implemented the class with the use of object oriented
programming concept feature which is inheritance. Diagram above shows the LectPanel
Class will inherit the class db which will allow the subclass to connect the database.

Encapsulation

The author had also included the feature of encapsulation in order to provide data hiding.
The purpose of encapsulation allows developer to hides the internal implementation
detail of an object from its external views. This is to prevent codes in SearchStu Class
and ViewRec class being accessed by other class.

Limitation

Object Oriented Programming Concept


As noted by B.Stroustrup in 1991, Object-oriented programming is a technique for
programming a paradigm for writing good programs for a set of problems, if the term
object-oriented programming language means anything it must mean a programming
language that provides mechanisms that support the object-oriented style of programming
well. According to Andrew Hardwick in 2000, the commands can do input, output,
manipulate data and control the order in which commands are carried out. So as not to
have to duplicate commands in different places in a program where same action needs to
be performed, a set of commands can be combined into a function or subroutine which
acts like a new command. This same set of commands can then be called from different
places in the program. As well as substantially reducing the length of programs, this can
make the structure neater by encapsulating the commands which, together, perform some
particular operation in one place. The rest of the program need not be concerned about
the details of what commands make up the function and just treat it as something which
does the operation. In the researchers opinion, object-oriented programming contains a
list of commands that able to carry out interaction with the user to do things such as
control the order of commands. Besides that, object oriented concept place great
emphasis on codes and commands reusability which mean that part of the codes can be
used in different classes. This had indeed increased the level of efficiency in terms of
programming. In addition, there are a few more characteristics that made up objectoriented programming concept which will be explained below.

Data Hiding
Data Hiding in Object-oriented programming concepts provide the developers to hide the
variables in the function so it will not be accessed by the any part of the program. The
developer then calls it method without revealing the stored data. (Andrew Hardwick,
2001)
Automatic Initialization
A class can create constructors with the default value where the field of a class will be
automatically assigned to the table shown below. Every field of a primitive type is
initialized to a default value of false or zero. All fields of reference type are, by default,
initialized to null. These default values are guaranteed by Java. If the default value of a
field is appropriate, you can simply rely on it without explicitly initializing the field.
(OReilly, 2001)

Source from Java in a NutShell, OReilly 2001 (Primitive Data Types)

Overloading
The method of overloading is refer to using different functions but have the same name
and they will be differentiated by the number and type of arguments passed into the
method. (Baseline Inc, 2003)
Derived Classes
This is one of the most vital techniques that allow developers to share variables and
methods from the other class to set up a new class. The derived class could have extended
it features from the existing class which is named as parent class. (Andrew Hardwick,
2001)

Comparison of Object-Oriented and Non Object-Oriented


Non OO
-

It is a step by step sequence of commands that guide throughout the entire

application to solve the problem.


Codes are not separated into several functions unlike OO uses different objects.
A function is applied to some data to perform the actions on data.
Every command will be executed in order including the methods and functions.
Place great emphasis on the idea that all algorithms are executed with functions

and data
Not every procedural language able to create a GUI application.

Similar to a real world works thus more effectively.


Made up of many entities called objects and it becomes the essential units that

consists of behaviour and purpose.


The codes of the program could be reuse and extend the features.
A much more suited environment to create a GUI based application.
Restrict the visibility of the components to the rest of the program.
Each object controls its own data
Links functions and objects using message passing.

OO

Inheritance
The word inherit means the using something that already exists. In object-oriented
programming concept, inheritance is one of the important features that allow a class
to use the properties and methods of another class while adding its own functionality. An
example of where this could be useful is with an employee records system. You could
create a generic employee class with states and actions that are common to all
employees (John W.M.Russell, 2011). In this feature, there must be a parent class which
has the method or object which enable other class to derive to form into new class. The
derived class is called as child class or the subclass or we can say the extended class and
the class from which we are deriving the subclass is called the base class or the parent
class (RoseIndia, 2007). The keyword extend will be used in the new class in order to
retrieve data from the parent class. In object-oriented programming concept, a class can
only has a super class while super class could have unlimited number of subclasses. The
author will explain inheritance in diagrams below. For example, Class Z is the Vehicle
Registration Form that has all the variables and behavior of a vehicle. Class A for car
registration while Class B for motorcycle registration and Class C for lorry registration.
In this case, Class A, B and C do not need to declare the variables and method that had
been declared in Class Z if Class A, B and C have extended the Class Z.

Class Z

Class A

Class B

Class C

Polymorphism
Polymorphism is the capability of an action or method to do different things
based on the object that is acting upon(John W.M. Russell, 2011). It is the ability of
appear in many forms that allow changing or modifies the method in the subclass that
extended from the parent class. Any java object that can pass more than on IS-A test is
considered to be polymorphic. In java, all java objects are polymorphic since any object
will pass the IS-A test for their own type and for the class object. It is important to know
that only possible way to access an object is through a reference variable. A reference
variable can be of only one type. Once declared the type of reference variable cannot be
changed. The reference variable can refer to any of its declared type or any subtype of its
declared type. A reference variable can be declared as a class or interface
type.(TutorialsPoint, 2012).
This allows several methods of different subclasses could be treated as objects of
a single super class, while automatically selecting the proper methods to apply to a
particular object based on the subclass it belongs to. There are 3 types of polymorphism
which are the overriding, the methods of a subclass override the methods of a superclass;
overriding (implementation) of the abstract methods, the methods of a subclass
implement the abstract methods of an abstract class; overriding through the Java
interface, the methods of a concrete class implement the methods of the interface.
(JPassion.com, 2012)

Encapsulation
Last but not least, encapsulation is another feature that provides data hiding in the
programming concept. This allows developer hides the internal implementation detail of
an object from its external views. Internal structure remains private and services can be
accessed by other objects only through messages passed via a clearly defined interface.
Encapsuation ensures that the object providing service can prevent other objects from
manipulating its data or procedures directly, and it enables the object requesting service
to ignore the details of how that service is provided (Cramerz.com). For instance, a
watch that displays the hour, minute and second to the user, the user does not need to
know the working principle of display the hour, minute and second while the user could
control and adjust the setting through the watch. Therefore, it involves hiding a data but
allow user to access through the interface.
However, hiding data is not the full extent of information hiding. David Parnas
first introduced the concept of information hiding around 1972. He argued that the
primary criteria for system modularization should concern the hiding of critical design
decisions. He stressed hiding difficult design decisions or design decisions which are
likely to change. Hiding information in that manner isolates clients from requiing
intimate knowledge of the design to use a module and from the effects of changing those
decisions (Wm. Paul Rogers, 2001)

Advantages of Object Oriented Programming Concept


Codes Reusability
One of the main advantages of object oriented programming concept is the codes
reusability. This is because object oriented concept uses the technique of inheritance and
polymorphism and allows that most of the codes can be shared and reused between the
classes. Thus, developers could develop the solution efficiently. Therefore, object
oriented programming concept suitable for large project such as management system that
include storing data, retrieving data, edit records and many more that the scope of the
system is very wide. Besides that, it also suitable for system that repeating the same
action over and over again such as creating records.
Highly Efficient
Object oriented programming is mainly used for its efficiency in the web development
process. It makes you task simple and less stressful. It takes a bigger problem at hand and
breaks it into small problems and solves it separately thus solving the entire problem
successfully. Their flexibility to work on any domain, efficient error handling techniques
and refactoring are some of the many merits Object oriented programming that has made
it popular among many developers and programmers with good expertise in web
development. It faces some challenges when it comes to transforming older systems, built
in structured programming languages. But with OOP, the merits outweigh the demerits
thus making it a much sought language for web development. (Forix LLC, 2012)
Scalable
Object oriented programming concept applications are more scalable then their structured
programming roots. As an objects interface provides a roadmap for reusing the object in
new software, it also provides you with all the information you need to replace the object
without affecting other code. This makes it easy to replace old and aging code with faster
algorithms and newer technology. (Raymondlewallen, 2005)

Why you need OO in this assignment?


In this assignment, the researcher were about to develop an application to maintain
student exam details for a university. The research decided to use object-oriented
programming concept in this application because there are many repeating action in this
application such as enter, search, edit and view personnel information of students. For
example, the administrator will be using the application to enter records such as their
name, gender, National Identification Card Number, Date of Birth, modules, batch, date
joined and nationality. Besides that, there are 4 different types of users will be accessing
the management system, 3 of the users will be using it to search and view the student
records. Therefore, with object oriented programming concept, the developer can reuse
the objects to do different functions for different users. This had indeed speed up the
programming development and much more efficient in terms of coding.

What is UML Diagram


UML (Unified Modelling Language) is diagrams that designed to aid in software
development phase. This allows the developers to read and understand the structure easily
before they started to do the coding. It displays all the objects to be created, relationship
between classes, and their attributes. Besides that, a proper set of UML diagrams helps a
programmer to understand how they should structure the program during coding. There
are many different types of UML diagrams such as use case, sequence, collaboration,
statechart, class diagram and so on. Each of them describe different parts of the system.
For example, use case diagrams represent and document the dialog between external
actors and the syste while sequence and collaboration diagrams describe interactions
between objects.

Você também pode gostar