Glossary

c

code duplication

Criticality: 2

Code duplication refers to instances where identical or very similar blocks of code appear in multiple places within a program, leading to increased maintenance effort and potential for errors.

Example:

If both Square and Rectangle classes independently calculate area using length * width without a common Shape superclass method, it's an example of code duplication.

i

inheritance

Criticality: 3

Inheritance is a fundamental OOP principle where a new class (subclass) derives properties and behaviors from an existing class (superclass), promoting code reusability and establishing an "is-a" relationship.

Example:

A SportsCar demonstrating inheritance from a Car class means a SportsCar "is a" Car and can use its methods like startEngine().

m

method overloading

Criticality: 2

Method overloading allows a class to have multiple methods with the same name but different parameter lists (different number, type, or order of parameters).

Example:

A Calculator class might have an add(int a, int b) method and an overloaded add(double a, double b, double c) method.

method overriding

Criticality: 3

Method overriding occurs when a subclass provides a specific implementation for a method that is already defined in its superclass, having the exact same method signature (name, return type, and parameters).

Example:

An ElectricCar subclass might override the fuelUp() method from a Car superclass to implement chargeBattery() instead of fillGasTank().

s

subclass

Criticality: 3

A subclass (also known as a child class or derived class) is a class that inherits features from another class, its superclass.

Example:

If Dog extends Animal, then Dog is the subclass that inherits properties and behaviors from Animal.

super keyword

Criticality: 3

In Java, the `super` keyword is used to refer to the immediate parent class object. It can invoke a superclass's constructor or call a superclass's method.

Example:

In a Dog subclass, super("Buddy") might call the Animal superclass's constructor, while super.makeSound() would call the Animal's makeSound method before the Dog adds its specific bark.

superclass

Criticality: 3

A superclass (also known as a parent class or base class) is a class whose features (fields and methods) are inherited by another class.

Example:

In a hierarchy where Car extends Vehicle, Vehicle is the superclass of Car.