4 Pillars of OOPS



4 pillar oops

Inheritance-




Inheritance is a mechanism in which one class acquires the property of another class.

In OOP that is exactly what we are able to accomplish and it is known to have a lot of benefits such as :

  • Easy code maintenance
  • Frees up our system resources
  • Easier to debug
  • Makes the application much more easier to scale
  • Code re-usability and ease of testing

Abstraction-

An abstraction handles complexity by hiding unnecessary details from user.


Encapsulation-

Encapsulation is an  Object Oriented Programming concept that binds together the data function that manipulate the data, and that keep both safe from outside interface and misuse.

The benefits of encapsulation are very similar to the ones we discussed already

  • Easy code maintenance, debugging & testing
  • Re-usable chucks of code with no outside interference
  • Makes the application much more easier to scale








Polymorphism-
                                            is a ability of an object to take many forms.






Summary-

This was meant to be an overview and introduction to how Object Oriented Programming works.Understanding those four pillars will help you to design better apps that are easy to maintain,scale,test and debug.





  



core java



Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented, and specifically designed to have as few implementation dependencies as possible. It is intended to let application developers “write once, run anywhere” (WORA), meaning that compiled Java code can run on all platforms that support Java without the need for recompilation.

  • Java has been one of the most popular programming language for many years.
  • Java is Object Oriented. However it is not considered as pure object oriented as it provides support for primitive data types (like int, char, etc)
  • The Java codes are first compiled into byte code (machine independent code). Then the byte code is run on Java Virtual Machine (JVM) regardless of the underlying architecture.
  • Java syntax is similar to C/C++. But Java does not provide low level programming functionalities like pointers. Also, Java codes are always written in the form of classes and objects.
For example, you can write and compile a Java program on UNIX and run it on Microsoft Windows, Macintosh, or UNIX machine without any modifications to the source code. WORA is achieved by compiling a Java program into an intermediate language called bytecode. The format of bytecode is platform-independent. A virtual machine, called the Java Virtual Machine (JVM), is used to run the bytecode on each platform.


History of Java

Java was originally developed by James Gosling at Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995 as a core component of Sun Microsystems’ Java platform. The language derives much of its syntax from C and C++, but it has fewer low-level facilities than either of them.

Oracle Corporation is the current owner of the official implementation of the Java SE platform, following their acquisition of Sun Microsystems on January 27, 2010. This implementation is based on the original implementation of Java by Sun. The Oracle implementation is available for Microsoft Windows, Mac OS X, Linux, and Solaris.

The Oracle implementation is packaged into two different distributions:

  1. Java Runtime Environment (JRE) which contains the parts of the Java SE platform required to run Java programs and is intended for end users.
  2. Java Development Kit (JDK) which is intended for software developers and includes development tools such as the Java compiler, Javadoc, Jar, and a debugger.

Features of Java

Java has multiple features. Some of these are unique to Java and some of these are common among other languages.

  • Object Oriented – In Java, everything is represented as objects. An object is kind of wrapper that encapsulated data and its associated behavior.

    Java provides support for all major object-oriented principles as seen in other object-oriented languages.

  • Platform Independent – The programs written in Java are converted to bytecode first, by Java compiler. This bytecode can be run in any machine having Java runtime environment (JRE). It makes the Java applications platform-independent.

    It is very different to C or C++ applications where programs compiled into binaries specific to OS.

  • Secure – Java applications run in Java runtime environment (JRE) with almost no interaction with system OS. It makes Java more secure than other languages.
  • Multithreaded – Java supports writing applications which can do multiple tasks in separate threads. All tasks progress using the time slicing technique of OS threads.

    For example, a Java application serve a user login form while running background processes also.

  • High-performance – Java is an interpreted language, so it may never be as fast as a compiled language like C or C++. But, Java enables high performance with the use of just-in-time compiler.
  • OS Architecture-neutral – Java compiler generates an OS architecture-neutral class files or bytecode.

    For example, in C programming, int data type occupies 2 bytes of memory for 32-bit architecture and 4 bytes of memory for 64-bit architecture. However, it occupies 4 bytes of memory for both 32 and 64-bit architectures in Java.

What Can Java Technology Do?

The general-purpose, high-level Java programming language is a powerful software platform. Every full implementation of the Java platform gives you the following features:

  • Development Tools: The development tools provide everything you'll need for compiling, running, monitoring, debugging, and documenting your applications. 

  • Application Programming Interface (API): The API provides the core functionality of the Java programming language. It offers a wide array of useful classes ready for use in your own applications. It spans everything from basic objects, to networking and security, to XML generation and database access, and more. The core API is very large; to get an overview of what it contains, consult the Java Platform Standard Edition 8 Documentation.

  • Deployment Technologies: The JDK software provides standard mechanisms such as the Java Web Start software and Java Plug-In software for deploying your applications to end users.

  • User Interface Toolkits: The JavaFX, Swing, and Java 2D toolkits make it possible to create sophisticated Graphical User Interfaces (GUIs).

  • Integration Libraries: Integration libraries such as the Java IDL API, JDBC API, Java Naming and Directory Interface (JNDI) API, Java RMI, and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP Technology) enable database access and manipulation of remote objects.


4 Pillars of OOPS

Inheritance- Inheritance is a mechanism in which one class acquires the property of another class. In OOP that is exactly what we are able t...