inheritance

INHERITANCE: Inspired by Biology, Used in JAVA

Reading Time: 4 minutes INTRODUCTION The term inheritance was actually coined in biology but is widely used in programming languages such as java. the concept is analogous to the concept of genetics in biology, where the children inherit the genetic properties from their parents. and it is reflected in them as well. Technically, Inheritance is described as a mechanism where a class can acquire the features and behaviors of Continue Reading

Object-Oriented Programming in Scala

Reading Time: 3 minutes Object-oriented programming (OOP) is a computer programming model that organizes software design around data, or objects, rather than functions and logic. Scala is also an Object-Oriented language and in this blog, we will see how we achieve that in scala. Classes in Scala Class is like a blueprint for a real-world entity which we call object in programming languages. It provides the initial values for state Continue Reading

Learn How To Start OOPS IN SCALA

Reading Time: 6 minutes INTRODUCTION Scala is a functional-object-oriented programming hybrid that seamlessly integrates the features of object-oriented and functional languages. It has the capability to interoperate with existing Java code and libraries. The main aim of OOP is to bind together the data and the functions that operate on them so that no other part of the code can access this data except that function. Why object-oriented? Scala Continue Reading

Introduction of Inheritance and its types in Scala

Reading Time: 5 minutes One of the important topics of Object-Oriented Programming is Inheritance. Inheritance allows us to define a class in terms of another class, which allows us in the reusability of the code. Here I’ll be giving you an introduction to inheritance in Scala. What is Inheritance in Scala ? It is the instrument in Scala by which one class is permitted to acquire the features(fields and Continue Reading

Scala Beginner Series (2) : Object Oriented Scala

Reading Time: 7 minutes This series is all about the taste of Scala.It is best suitable for all the newbies in Scala. You may also like: Scala Beginner Series (1) : Basics In the previous part, we covered: Values, variables, expressions and types Functions and recursion The Unit type This article will cover the object oriented nature of Scala language. Classes Scala has the same concept of a class as we Continue Reading

Composition over Inheritance: Part 1

Reading Time: 4 minutes Inheritance Inheritance happens to be one of the prime features of the Java language and is one of the key requirements for Object-Oriented Programming. It provides a lot of help in reducing code repetition, helps in designing the application and whatnot. However, for the best use of this feature, we must also know when we shall avoid using it. Just like any other feature of Continue Reading

How to deal with Inheritance while using Lombok builder

Reading Time: 2 minutes Today, I came across a problem and found a beautiful solution for it, which is pretty much straight forward, but the problem may occur to anyone while using the Lombok Library for java. So let’s look at the problem. The Problem I have a class Person, which consists of some fields. It is annotated with the @Builder annotation of lombok, so that lombok can generate Continue Reading

Scala: Generic classes and Variance

Reading Time: 4 minutes Generic classes are classes which take a type as a parameter. This means, one class can be used with different types without actually writing down it multiple times. They are particularly useful for collection classes. Defining a generic class: Generic classes take a type as a parameter within square brackets [ ]. One convention is to use the letter A as type parameter identifier, though Continue Reading