Posts

Showing posts from November, 2020

JavaScript Strict Mode

Image
  JavaScript's strict mode, introduced in ECMAScript 5, is a way to  opt-in  to a restricted variant of JavaScript, thereby implicitly opting-out of "sloppy mode". Strict mode isn't just a subset: it intentionally has different semantics from normal code. Strict mode implements several changes to normal JS code semantics: 1.  Eliminates some JavaScript silent errors by changing them to throw errors. 2.  Fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that's not strict mode. 3.  Prohibits some syntax likely to be defined in future versions of ECMAScript How does one go about invoking strict mode in their code? There are several places you can do this and these include in functions, for whole scripts and since ECMAScript 2015, in modules. To invoke strict mode in functions, simply add  'use strict';  OR  "use strict";  to the beg...

How JavaScript uses hashing

Image
Privacy and the security of information has become more important now than ever. For as long as information - valuable information - has existed, there have always been people plotting to obtain it in nefarious ways. Having established this context, today we will discuss hashing . Before anything else, we answer the occasion's most important question: what is hashing? Hashing is defined as taking a value and applying a mathematical operation (a hashing algorithm or hashing function) to it and getting a new value (known as a hash, hash value or digest message). Yes, it is a form of cryptography. What is this hashing useful for? Well, one of the most important areas in which it is applied is in information security. For example, when storing user passwords in a database, simply storing string values as they are is insecure and this is where hashing comes in. Password values are hashed and the resulting values are stored in the database. The stored hashes are then used to authenticat...

Interfaces in object oriented programming languages and prototype-based languages

Image
Today we talk interfaces. Interfaces are especially important in Object Oriented Programming(OOP) and the programming languages that espouse this paradigm. One of the programming languages that employ OOP is Python. Before we go about explaining what interfaces are, it is important to define OOP first and how it is structured. OOP consists of classes which are entities that contain attributes and methods that perform specific tasks based on what the class is meant for. Classes are used to construct objects which are instances of classes. These objects then inherit attributes and methods from their parent classes.  For example, a button class with attributes such as color, size and methods that perform actions like allowing users to download files or perform operations on databases. Now, different button objects can be constructed from the button class and although they will inherit a set of attributes and methods, they will implement them differently in differing scenarios. Having ...

Big O notation basics for web developers

Image
Today we discuss Big O notation. It is often said that Big O notation makes 'boring math' interesting. Does it? There's only one way to find out. So, What in the world is Big O notation? The technical definition goes like this: Big O notation , also referred to as Landau's symbol , is a symbolism used in complexity theory, computer science and mathematics to describe the asymptotic behavior of functions. Basically, it tells you how fast a function grows or declines. Landau's symbol comes from the name of the German number theoretician Edmund Landau who invented the notation. The letter O is used because the rate of growth of a function is also called its Order . The formal definition is: f(x) = O(g(x)).  Here f(x) and g(x) are functions representing a relationship in which g(x) grows depending on f(x) given that f(x) never grows faster than g(x).  By now, you must be asking yourself, what does Big O have to do with web development? Well, the answer lies in algorithm...

Concurrency in Web Development

Image
It is said that being able to explain a complex concept simply means that one understands the concept in question sufficiently. Today, I will delve into a complex topic known as concurrency .  What is concurrency? Well, simply explained, it is the act of performing multiple actions at the same time; checking out your social media feed while perched on your toilet seat can be considered to be an instance of concurrency.  In programming terms, concurrency occurs when multiple sequences of operations run in overlapping periods of time.  How does one go about achieving concurrency? There are three architectures that allow for concurrency to be achieved. The first is multi-threading . A thread is defined as a unit of execution within a programme. Multi-threading therefore allows for multiple executions and thus concurrency. The second is event-driven architecture. This involves the use of a single thread which stacks events to be executed in an event queue. The events then ex...