This is a high level guide that can help new-comers get started with Kubernetes, also known as K8s. The aim of this post is to serve as a compass or a map rather than get into the nitty gritty details for each section. For more details on any of the sections below, one can easily search the internet. I just find it very useful to understand the big picture first rather than getting overwhelmed with details at first.

Installing Kubernetes Locally

It goes without saying that docker is a pre-requisite to K8s. You have to have docker running locally on your machine.

Docker…


Most developers coming from a C# or a Java background find the ‘for-in’ loop feature in JavaScript confusing. Perhaps the reason is that the ‘for-in’ loop is often confused by the ‘foreach’ loop in C# or Java. The truth is, the ‘for-in’ loop is very similar to the ‘foreach’ loop in C#. However, there are some fundamental differences.

The ‘for-in’ loop in JavaScript iterates over the indexes of an array.

Example below:
// JavaScript
var numArray = [1, 4, 3];
for(var n in numArray){
console.log(n);
}

Running the code in the JavaScript example above prints the values 0, 1, 2…


JavaScript has gotten very popular lately with the right rich web client applications. There a many JavaScript libraries available, both open source and commercial with very strong support from the community. However, as JavaScript application grows in size, it is very easy for the code to get messy and out of control. If care and consideration are not kept in mind as new features are added, it is easy to run into all sorts of variable collisions and other scope issues. Third party libraries such as RequireJS were introduced to help keep JavaScript code modular. However, there are several techniques…


Like JQuery, native JavaScript supports querying the DOM using standard CSS selectors. This is typically done using the function ‘document.querySelectorAll()’. However, unlike the JQuery selector function, this function return a NodeList object as opposed to a JavaScript array. This can be challenging because the NodeList object does not support iteration. There are several tricks one can do to manipulate the NodeList object and iterate over its contents.

The ‘for’ Loop Approach
This approach relies of using a standard JavaScript For loop to iterate over the NodeList. Elements in the NodeList can be accessed using the standard ‘[]’ operator at a given…


What made jQuery Popular?
jQuery has become so popular lately, mainly due to it’s ease of use, robustness, small size (< 50kb). However, the secret to jQuery’s success in my opinion is it’s reliable cross-browser support. Anyone who attempted building a reliable front end application knows how difficult it can get, especially if you are catering to older browsers such as IE7 and IE8. This roots from the fact that each browser maintained it’s own JavaScript JIT compiler (SpiderMonkey in Mozilla, Chakra in IE and Webkit in Chrome/Safari … etc). These JavaScript engines did not always follow the EcmaScript specifications closely…


JQuery is capable of filtering query results through the ‘filter()’ function. The function takes in a CSS selector or a function. If the function returns something ‘truthy’, the element is kept in the result set. Otherwise, it gets rejected. In the following block of HTML code, the ‘filter()’ function is used to select the labels that has the class ‘red’ assigned to them:

var labels = $('.mainDiv label')// Using a CSS selector with the filter() function
var filteredLabels = labels.filter('.red');
// Passing in a function to the filter() function
var filteredLabelsWithFunction = labels.filter(function(index, item) {
return $(item).hasClass('red');
});

Native…


Finding Descendants in JQuery
In JQuery, you can use the built in ‘find’ function to search trough query results and select specific descendants. The find function accepts a CSS selector and it is straight forward to use:

// To search the 'mainDiv' descendants and find all paragraphs with the class 'large' on them: 
$(".mainDiv").find("p.large");

Finding Descendants in Native JavaScript
Searching for descendant elements in JavaScript is not so trivial. JQuery does a lot under the covers when performing such a task. Initially, a call to ‘querySelectorAll’ is triggered to perform the top level search and return a nodeList. Next, the ‘NodeList’…


RequireJS is an open source JavaScript library that has gained a lot of popularity in the recent years. The library is used to manage JavaScript dependencies and to prevent script loading order issues. It is also helps avoid having to load all the JavaScript files at once and only load the ones needed on demand. It also promotes ‘modularizing’ the code and breaking it apart into smaller modules that are managed independent of one another, which leads to a more scalable and robust applications.

RequireJS relies on using the Asynchronous Module Design (AMD) pattern. In this pattern, each Javascript module…


The bridge pattern is a very popular patterns that is used often in object-oriented architectures. It is a pattern that is difficult to grasp initially and can often be difficult to identify. It appeared in the famous Gang of Four book “Design Patterns: Elements of Reusable OO Software”, and it was designed as the following:

Decouple abstraction from it’s implementation so the two can vary independently

. This statement can be a little vague and somewhat difficult to understand. However, it can be broken down into smaller pieces so that it is better understood.

An abstraction is classified as a…


The adapter pattern is a simple and very common pattern that is often used in object-oriented designs. The intent behind using the adapter pattern is to convert the interface of a class into another interface that the client expects, without having the vary the client. The need to do this often arises when one is utilizing a third party library that contains the desired functionality, but it does not implement the desired interface. This pattern makes it possible to achieve this by creating an adapter that sits between the class and the third party library. This is also common when…

Omar Barguti

An enthusiastic architect and full-stack developer with many years working with enterprise software and cloud services in multiple domains.

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