Designing OOP Step by Step

I read Head First Design Patterns book shown as below. It is pretty good reference of Design Patterns. If you want to be familiar of Design Patterns, i recommend it definitely. This post contains some examples of this book but in a different presentation. When I want to remember fundamentals of Design Patterns, this post will remind me 🙂 I hope that you will benefit from this post.

I will create a class diagram and improve it step by step.

If you don't want to read all paragraphs, you just view class diagrams and code samples step by step. But, i heavily recommend to read and think of this post 🙂

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.

Hoisting is only possible with declaration but not the initialization. JavaScript will not move variables that are declared and initialized in a single line.

Continue reading

JavaScript Functions

I sometimes try to remember basis of JavaScript Functions. So, I often exercise about it. I followed this link https://www.w3schools.com/js/js_function_definition.asp. 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
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

https://github.com/kenanhancer/loopback3-simple-api.git

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 https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-macos

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(https://kenanhancer.com/2019/09/08/kubernetes-multi-node-cluster-with-one-updated-vagrant-file/). 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 https://www.vagrantup.com/docs/cli/ follow official link.

Continue reading