Nyi Min Khant AP Ass 1

You might also like

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

Assignment 1: Features and

Design Diagram for Employee


Management System

Unit 20: Advanced Programming


[Date]

Nyi Min Khant


batch 21
Contents
P1 Encapsulation in Java.................................................................................................................1
P2 What is Class Diagram................................................................................................................6
Reference........................................................................................................................................8

P1 Encapsulation in Java
Encapsulation, which may be compared to a capsule carrying several pharmaceuticals, is a
technique used to combine code and data into a single entity in Java.
Because Java allows us to keep all of a class's data members private, we can completely
encapsulate it. Using setter and getter methods, we can now set and get data from it.

Inheritance
Inheritance is the term used in Java to describe the process of establishing a hierarchy between
classes by deriving from other classes. Sedan will inherit from the Vehicle class if it extends Car
and Car extends Sedan since Java inheritance is transitive. Superclasses of the Vehicle include the
Car and the Sedan.

Abstraction
The tactic of concealing technical details from the user and just exposing functionality is called
abstraction. In a different approach, it just shows the user's requirements while concealing internal
data, similar to how SMS messaging works when you input the text and send the message.

pg. 1
Polymorphism
In Java, the term "polymorphism" describes a class's ability to provide several method
implementations depending on the kind of object it receives as a parameter. Simply said, Java's
polymorphism allows us to do the same action in a number of different ways.

Dependency
Our software uses Java's Dependency Injection feature, which moves object binding from compile
time to runtime, to achieve inversion of control (IOC). IOC may be carried out using the Factory
Pattern, Template Method Design Pattern, Strategy Pattern, and Service Locator Patterns.

Association
An association in Java is a connection or relationship made between two objects of various
classes. The link between two things demonstrates their familiarity with one another and their
utilization of one another's strengths. It is possible to communicate one-to-one, one-to-many,
many-to-one, and many-to-many.

pg. 2
Composition
In Java, there may be a composition of two related objects if there is a tight relationship between
two classes. Additional classes cannot exist without the owner class or parent class. For instance,
the heart and lungs belong to the "Human" class.

Generalization
Common characteristics and functions from two or more classes must be removed in order to
construct a new class that acts as the parent class of the original classes, or what we may refer to
as the generic class of the original specialized classes. Each subclass represents a distinct
superclass. Thus, it is possible to say that the superclass "is-A" subclass. Generalization is
referred to as a "is-A relationship".

Realization

pg. 3
When two objects are connected by a realization in UML modeling, the client (one model
element) is responsible for carrying out the provider's (another model element's) instructions. The
realization connection is used in both class diagrams and component diagrams.
The collaboration that was achieved has no labels. It mostly appears in interfaces. The connection
between the client and server is represented as a dashed line with a hollow arrowhead at one end.

Multiplicity
The Association in Java specifies how many different kinds of objects there are. It shows how
things can communicate with one another and take use of the features and services that the other
thing has to offer. Association is used to handle various types of relationships, including one-to-
one, one-to-many, many-to-one, and many-to-many.
Constructors / Destructors
In object-oriented programming, constructor and destructor are member functions of a class with
the same name as the class. An object's constructor helps initialize it by allocating memory for it.
By erasing the created constructor when it is no longer required, a destructor, on the other hand,
deals with locating an object's memory.
In this post, we'll go through the key differences between constructors and destructors. Let's start
by discussing some basic constructor and destructor concepts.
Constructors and Destructors
Although it is not practical to build objects using an abstract class, it is possible to do so using a
concrete class. This is the main contrast between abstract and concrete classes.
The paradigm of object-oriented programming (OOP) is popular in the world of software
development. It makes coming up with a real-world scenario easier. It also gives programmers the
ability to design a collection of objects to model the software. These things communicate with one
another to transmit messages. An object can also be created using a class. A concrete class is a
default class. In OOP, abstraction is a key principle. The abstract class is a method of achieving
abstraction.
Method redefinition
Overriding a method in Java refers to redefining a method in a subclass to replace the
functionality of a superclass method.
Implementing a superclass method in a subclass to provide a more specific implementation is
known as method overriding.

pg. 4
Generics and Templates
Templates are the foundation of generic programming, which comprises writing code in a manner
that is independent of any particular type. A template is a guide or recipe for creating a class or
function that can be used by everyone.

Containers
A component and the platform-specific, low-level functionality that enables it are connected
through containers. Before it can be used, a web, enterprise bean, or application client component
must be assembled into a Java EE module and deployed into its container.

pg. 5
P2 What is Class Diagram
When used in software engineering, a class diagram in the Unified Modeling Language (UML)
shows the classes, properties, operations (or methods), and interactions between objects in a
system to describe the system's structure.

Purpose of Class Diagrams

displays the system's classifiers' static structure.

Diagram offers a foundational notation for further UML-required structural diagrams.

beneficial to both devs and the rest of the team

Class diagrams are a tool that business analysts may use to model systems from a business

viewpoint.

A UML class diagram is made up of:


A set of classes and
A set of relationships between classes

pg. 6
pg. 7
Reference
GeeksforGeeks. (2017). Templates in C++ vs Generics in Java. [online] Available at:
https://www.geeksforgeeks.org/templates-in-c-vs-generics-in-java/.

GeeksForGeeks (2017). Inheritance in Java - GeeksforGeeks. [online]


GeeksforGeeks. Available at: https://www.geeksforgeeks.org/inheritance-in-java/.

creately.com. (n.d.). Class diagram for an e-library system | Creately. [online]


Available at: https://creately.com/diagram/example/i64rely82/class-diagram-for-
an-e-library-system.

pg. 8

You might also like