Four Basic Principles of Object-oriented Programming(OOP), Abstraction, Encapsulation, Polymorphism, Inheritance

I am sorry about next three paragraphs. Because, I wrote too much. If you don’t have time, you can skip them directly 🙂

The four principles of OOP are entry point to build a well designed OOP applications. You definetely need to know whether you are a junior or senior developer to write an effective code. Before telling about them, I just want to tell why you need to know them. Probably, you already use some of them even without knowing principles. But, when you know them, you will have a higher perspective and more confidence related with complex codebase(Projects). Because, writing a class is not difficult at the beginnig but when you have more complex codebase, it will be difficult to maintain development if you don’t apply some patterns and principles. Furthermore, it is a common language between software engineers. So, easy to communicate and easy to design complex applications. They are also not dependent to any programming language like Java, C#, Python etc. If you know and understand what they mean, then you can definetely benefit from them to build an application. By the way, some developers named as different naming convention like basic principles of OOP, main concepts of OOP, basics of OOP, basic concepts of OOP, etc 🙂 But all of them are mentioning about same things Abstraction, Encapsulation, Inheritance and Polymorphism.

Novadays, developers have to be very pragmatist because of the market. They need to learn and use new stuffs very quickly. For example, I read every time about new frameworks. Although I don’t develop any project with new framework, I spend my time to become ready on the software market. So, it is difficult to work and think on some basic concepts due to lock of time. But, I realized that I spend too much effort for every new framework or library to understand. When I anlyze different open-source projects for weeks, I had my way of exploring the projects in a time. This means that I want to follow same way every time unconsciously. It is very very funny 🙂 because I tried to create basic principles and patterns in my way unnecesarily. I every time try to find some key points. But, there is more funny side as well. Developers of open source projects were already applying basic principles. That is why, many developers could work together. In this case, I have learned many principles and patterns unconsciously. Finally, I learned the existence of basic concepts or principles of OOP :))))

Unfortunately I was not only one person who makes same mistakes in the market. Developers who have different experience still don’t know or care for significance of OOP principles. This doesn’t mean that they are not good developers. Many of them were developing complex projects with well known frameworks like Spring Boot, Express Framework, etc. But, they just copy and paste codes from tutorials generally. Big frameworks are making development easer and safer. So, we don’t need to think for low level details for our applications and just need to think about business logic. So, it is decreasing development cost and increasing efficiency for the organizations(companies). But, in this case, developers are becoming lazy in a time and don’t want to spend time to learn or even remember about basic principles of OOP and some common software patterns. Anyway, I decided to write this post for myself. I hope that some developers will benefit in the future as well 🙂

There are four basic principles of OOP as below;

  1. Abstraction
  2. Encapsulation
  3. Polymorphism
  4. Inheritance

I read many different posts about them so I will write different versions of definitions that I took note and you can decide which one is more clear to you 🙂 They are not my sentences. I don’t want to create a new one. I just want to show the way of my thinking.

Continue reading

JavaScript Hoisting

This topic is very very important in javaScript. It is an unknown behavior of javaScript. Shortly, javaScript compiler moves variables and function declarations

Hoisting is JavaScript’s default behavior of moving declarations to the top of the current scope.

Variables and constants declared with let or const are not hoisted!

JavaScript Declarations are Hoisted

In JavaScript, a variable can be declared after it has been used.

In other words, a variable can be used before it has been declared.

Hoisting applies to variable declarations and to function declarations.

function declarations are hoisted before variable declarations.

Continue reading

JavaScript Functions

I sometimes try to remember basis of JavaScript Functions. So, I often exercise about it. I followed this link I copied some important descriptions from that link. My aim is to follow this post when I need to remember again 🙂

JavaScript Functions

A JavaScript function is a block of code designed to perform a particular task.

A Function is much the same as a Procedure or a Subroutine, in other programming languages.

Why Functions?

You can reuse code: Define the code once, and use it many times.

You can use the same code many times with different arguments, to produce different results.

JavaScript Function Types

  1. Function Declaration (function statement)
  2. Function Expression
  3. Function Constructor
  4. Self-Invoking Function (Immediately Invokable Function Expression IIFE)
  5. Arrow Function
  6. Object Method Shorthand Definition
  7. Generator Function

JavaScript Function Syntax

Function parameters are listed inside the parentheses () in the function definition.

Function arguments are the values received by the function when it is invoked.

Inside the function, the arguments (the parameters) behave as local variables.

1. Function Declaration (function statement)

When a function declaration is created, a variable named as function name is created as well. This variable is hoisted top of the current scope. In other words, variable is moved to top of current scope. This means that the function can be called before the function declaration

Continue reading

LoopBack 3 – Simple API with Oracle Example

Expose your Oracle Database as a REST service with LoopBack 3 (Node.js Open API Framework)

This post is continuation of previous post

So if you want to start from beginning, read that one as well.

Follow this link to create a Oracle container 🙂

You can find LoopBack 3 project in the following repository. After clonning switch to oracle branch 🙂 or run the following command.

git checkout oracle

Kubernetes configure kubectl to use multiple clusters

First of all, you need to have kubectl CLI in your host machine. So, follow the below steps.

Install with Chocolatey on Windows

choco install kubernetes-cli

Install with Homebrew on MacOS

brew install kubernetes-cli

Install with Kubernetes Official Documentation(with Curl)

Follow this link

Test to ensure the version you installed

kubectl version

Checking kubectl config

When you run below command, you will see output as shown in the following screenshot. I didn’t configure yet so, it shows an empty config.

kubectl config view
Continue reading

Creating, Starting, Stopping, Packaging and Publishing a Vagrant Box

I use Vagrant for local development in order to build any development environment. For example, when I need a Kubernetes multi node cluster, I can demonstrate with Vagrant quickly( After I complete my exercise about any technology, I also publish to Vagrant Cloud so that it can be used later without wasting time. But, I am not using only Vagrant, there are different technologies and there are different CLI for them. So, if I don’t use one technology sometime, I can forget some important commands. That’s why, this post is important for me to remember Vagrant CLI 🙂

To read more information about Vagrant CLI follow official link.

Continue reading

Oracle Docker Container Exercise

You can up and run Oracle Docker container in your local machine and later connect from sqlplus CLI to query your database.

Follow the following Oracle GitHub link for more details

After cloning Oracle docker-images repository from GitHub, run the following command in your terminal to build a Oracle Docker XE image.

docker build --force-rm=true --no-cache=true --shm-size=1G --build-arg DB_EDITION=xe -t oracle/database:18.4.0-xe -f Dockerfile.xe .

When build is done, run the following command to start a Oracle XE Database container.

docker run -d --name oracleXe --network=oracle_xe_network -p 1521:1521 -p 5500:5500 -e ORACLE_PWD="Pass_123456" oracle/database:18.4.0-xe

LoopBack 3 – Simple API with Redis Example

Expose your Redis NoSQL as a REST service with LoopBack 3 (Node.js Open API Framework)

This post is continuation of previous post

So if you want to start from beginning, read that one as well.

You can find LoopBack 3 project in the following repository. After clonning switch to mongodb branch 🙂 or run the following command.

git checkout redis

LoopBack 3 – Simple API with MongoDB Example

Expose your MongoDB NoSQL as a REST service with LoopBack 3 (Node.js Open API Framework)

This post is continuation of previous post

So if you want to start from beginning, read that one as well.

Follow this link to create a MySQL container 🙂

You can find LoopBack 3 project in the following repository. After clonning switch to mongodb branch 🙂 or run the following command.

git checkout mongodb