In this article, we shall consider key concepts of the relational data model and relational database constraints.

First, let us consider terms in the relational data model.

Terms in the Relational Data Model

  1. Relational model: a collection of relations.
  2. Relation: table
  3. Tuple: row
  4. Attribute: column
  5. Domain: a set of atomic values
  6. Atomic values: single values
  7. Degree of a relation: number of attributes in a relation
  8. Cardinality: number of tuples in a relation.
  9. Relation schema: describes the relation by specifying relation name, list of attributes, and degree of the relation.

For example, a relation schema for student:

student(id, name, phone, address, age, gpa) 

student is a relation name. It has six attributes. …

Let’s say we have submitted a pull request to a public repository long ago. That repository’s main branch is updated often since then. Now that repository’s maintainer wanted to merge our pull request but our pull request branch is some number of commits behind their master branch. Therefore we need to update our pull request (branch) without any conflicts.

I had a similar experience.

In this article, I will explain you how to update pull request branch.

Image for post
Image for post
Photo by Yancy Min on Unsplash

Let’s dive in!

Image for post
Image for post
Photo by Everton Vila on Unsplash

Threads share memory and resources (data, code etc.) Threads execute concurrently. Hence, threads can access common resources simultaneously. This may bring us some undesirable outcome.

Synchronization prevents threads from accessing common resources simultaneously. It allows a thread to access a resource at a time.

Each object has a lock. If one thread has gained that object’s lock, the other threads will have to wait until that particular thread releases it. In this way, a thread can access a resource at a time.

We can use synchronized non access modifier to gain object’s lock. …

Image for post
Image for post
Photo by Bailey Torres on Unsplash

Multitasking refers to the execution of multiple tasks simultaneously. Tasks can be programs, processes, and threads. For example, we can play songs on Windows Media Player and edit documents in Microsoft Word simultaneously. Multitasking systems are known as time sharing systems.

This concept is for single CPU (single processor).

Multitasking is the logical extension of multi programming. Multi programming is based on context switching while multitasking is based on context switching and time sharing (time slicing).

Multitasking system executes process on CPU with a timer. Once that timer has finished, it interrupts the current process and switches the process.

Each process executes on CPU until time slice expires or it requires I/O. …

Image for post
Image for post
Photo by Victor Dueñas Teixeira on Unsplash

If a system contains more than one processor (CPU) then it is known as multi processor system.

Single processor (single CPU) system executes a process at a time. As multi processor system has more than one processor, it executes more than one process at a time (multi processing simultaneously). So, we can save time.

These processors (CPUs) share memory, power supply, and peripheral devices. Thus, we can save money (we do not need extra peripheral devices, power supply or memory).

Let’s say we have four processes: P1, P2, P3, and P4. …

Image for post
Image for post
Photo by Pietra Schwarzler on Unsplash

If a computer runs multiple programs at a time then it is known as multi programming. For example, running Google Chrome and Windows Media Player simultaneously.

This concept is for single CPU (single processor).

Multi programming system executes a process at a time on a single processor concurrently.

Operating System (OS) mainly contributes for multi programming.

Processes are executed by CPU. Processes (jobs) wait at job pool for CPU (processor) allocation in order to execute. CPU selects a process from job pool and executes it.

Non Multi Programming System

In a non multi programming system, CPU executes a process until that process requires for an I/O task or an external factor interruption. …

Array is a data structure to store data of same type. Array stores its elements in contiguous memory location. We can store fixed amount of elements in an array.

Image for post
Image for post
Photo by Tim Swaan on Unsplash

In Java, arrays are objects. All methods of class Object may be invoked in an array.

Let’s declare a simple primitive type array:

int[] intArray = {2,5,46,12,34};

Let’s try to print it with System.out.println() method:

// output: [I@74a14482

Why Java did not print our array? What happens under the hood?

System.out.println() method converts the object we passed into string by calling String.valueOf() . If we look into String.valueOf() method’s implementation:

public static String valueOf(Object obj) {
return (obj == null) ? "null" : obj.toString(); …

In this article we shall see what actually is Java Collections framework. We shall walk through Oracle Java Documentation to find out what it is!

What are Collections?

A collection — sometimes called a container — is simply an object that groups multiple elements into a single unit. — Oracle Java Documentation

Real world examples of collection include poker hand (a collection of cards), a mail folder (a collection of letters) or a telephone directory (a mapping of names to phone numbers).

Image for post
Image for post
Photo by Victoire Joncheray on Unsplash

What is a Collections Framework?

A collections framework is a unified architecture for representing and manipulating collections. — Oracle Java Documentation

All collections frameworks contain:

  1. Interfaces: Abstract Data Types (ADT) that represent collections. Interfaces allow collections to be manipulated independently of the details of their representation. These interfaces generally form a hierarchy. …

Image for post
Image for post
Photo by Anna Earl on Unsplash

Objects in Java are created from inside out.

It goes all the the way up to the Object class, comes down through the hierarchy and initializes all instance variables to create objects.

public class Person {
private String name;

In the above code, there is no statement that the Person extends Object but when creating an object, it actually goes inside out. How?

Compiler Rule 1

When you don’t define a super class, the compiler inserts one for you.

While compiling this is what actually happens:

public class Person extends Object{
private String name;

Now we know how Person extends Object.

Let’s say we have defined a super class for Person then what happens? …

Image for post
Image for post

Polymorphism is the ability of an object to take on many forms. That is, at compile time, Java object will be in reference type but at runtime, it will be in runtime type (object type).

Polymorphism in OOP occurs when a super type references a sub type object.

All Java objects are considered to be polymorphic as they share more than one IS-A relationship (at least all objects will pass the IS-A test for their own type and for the class Object).

We can access an object through a reference variable. A reference variable can be of only one type. …


Thanoshan MV

Hard work and perseverance is something we can control, so take action and practice — Christine Alvarado.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store