Skip to main content

Introduction to Java Programming

  What is Java? Java is a programming language and a platform. Java is a high-level, robust, object-oriented and secure programming language. Java was developed by Sun Microsystems (which is now the subsidiary of Oracle) in the year 1995. James Gosling is known as the father of Java. Firstly, it was called  Greentalk  and the file extension was  .gt . After that, it was called  Oak . Initially Java was designed for small, embedded systems in electronic appliances like set-top boxes. Platform:  Any hardware or software environment in which a program runs, is known as a platform. Since Java has a runtime environment (JRE) and API(Application Programming Interface), it is called a platform. The principles for creating Java programming were "Simple, Robust, Portable, Platform-independent, Secured, High performance, Multithreaded, Architecture neutral, Object-oriented, Interpreted, and Dynamic". Currently, Java is used in internet programming, mobile devices, games, e-business so

2. Object-Oriented Modeling

 

Object-Oriented Modeling

This methodology is all about visualizing the things by using models organized around real world concepts. Object-Oriented Modeling helps in understanding problems, communicating with experts from distance, modeling enterprises, designing programs and databases. In Object-Oriented Modeling, the modeling passes through following processes:

  1. System Analysis
  2. System Design
  3. Object Design
  4. Final Implementation

For a system description, the object-oriented model can be covered by 3 models

  1. Object Model
  2. Dynamic Model
  3. Function Model

Object Modeling

Object modeling are used for describing the objects in the system and their relationship among each other in the system.

Class and Objects

An object is a real-world element in an object-oriented environment that may have a physical or a conceptual existence. An object may have a physical existence like a customer, a car etc, or; an intangible conceptual existence like a project, a process etc.

A class represents a collection of objects having same characteristics properties that exhibit common behavior. It gives a blueprint or prototype of description of objects that can be created from it. Creation of object as a member of a class is called instantiation. Thus, object is an instance of a class.

The notation of a class is a box with three sections. The top section contains the name of class in boldface type, the middle section contains the attributes that belong to the class and the bottom section contains the class operations.

We can also show a class without attributes or its operations, or the name of class can appear by itself.


The notation for an object is the same as that for a class. There are three differences between the notations which are:

  1. In the top section, the object may have a name which appears before the colon or it may be anonymous in which nothing appears before the colon.
  2. The contents of the top compartments are underlined for an object.
  3. Each attribute defined for the given class has a specific value for each object belongs to the class.

Generalization and Specialization

In the generalization process, the common characteristics of classes are combined to form a class in a higher level of hierarchy i.e., sub-classes are combined to form a generalized super-class.

Specialization is the reverse process of generalization. Here, the distinguishing features are used to form specialized classes form existing classes. It can be said that the sub-classes are the specialized versions of the super-class.


Inheritance

The mechanism of acquiring objects and properties from other class is known as inheritance. Inheritance is used to borrow properties and methods from an existing class. Inheritance helps us create classes based on existing classes, which increases the code's reusability.



Links and Association

A link represents a connection through which an object collaborates with another object. In other words, a link represents the relationship between two or more objects. Through a link, one object may invoke(call) the methods or navigate through another object.


Association represents the relationship between objects of one or more classes. Association is a group of links having common structure and common behavior. A link can be defined as an instance of an association.

Degree of Association

Degree of an association denotes the number of classes involved in a connection.

  1. unary relationship connects objects of the same class.
  2. binary relationship connects objects of two classes.
  3. ternary relationship connects objects of three or more classes.

Cardinality Ratios of Associations

Cardinality of a binary association denotes the number of instances participating in an association.

  1. One-to-One: A single object of class A is associated with a single object of class B.
  2. One-to-Many: A single object of class A is associated with many objects of class B.
  3. Many-to-Many: An object of class A may be associated with many objects of class B and conversely an object of class B may be associated with many objects of class A.

Aggregation and Composition

Aggregation is the weak association. An association is said to be aggregated if both objects can exist independently. Example: For an object Bank and another object Employee. The Bank contains many employees, so Bank can exist without an Employee and a Employee can exist without a Bank

Composition is the strong association. An association is said to be composition if an object own another object i.e. both can't exist without each others existence. Example: Human object contains an object Heart. Without Human, Heart can't exist and without Heart, Human can't exist.

Benefits of Object Model

The benefits of using object model are:

  • It helps in faster development of software.
  • It is easy to maintain.
  • It enables reuse of objects, designs and functions.
  • It reduces development risks, particularly in integration of complex systems.
  • It supports relatively hassle-free upgrades.

Process of Object Modeling

  1. Identify associations between classes.
  2. Identify attributes of objects.
  3. Identify links between objects.
  4. Organize and simplify object classes using inheritances.
  5. Iterate and refine the model.
  6. Group classes into modules.
Object Model for University System

Previous

Next

Comments