Coding like Shakespeare: practical function naming conventions

What a piece of work is a man! How noble in reason, how infinite in faculty! Hamlet, William Shakespeare Code is prose. Clear and meaningful prose is easy to read and follow. Everyone enjoys reading such prose. The same quality should apply to source code. The way developer express his thoughts through a programming language is important. Writing code is communication: with your teammates and… Continue reading

The art of writing small and plain functions

The complexity of software applications is growing. The code quality is important in order to make the application stable and easily extensible. Unfortunately almost every developer, including myself, in his career faced with bad quality code. And it's a swamp. Such code has the following harmful characteristics: Functions are too long and do too many things Often functions have side effects that are difficult to… Continue reading

Six ways to declare JavaScript functions

A function is a parametric block of code defined one time and called any number of times later. In JavaScript a function is composed and influenced by many components: JavaScript code that forms the function body The list of function parameters The variables accessible from the outer scope The returned value The context this when the function is invoked Named or anonymous function The variable… Continue reading

JavaScript variables hoisting in details

Variables in a program are everywhere. They are small pieces of data and logic that always interact with each other: and this activity makes the application alive. In JavaScript an important aspect of working with variables is hoisting, which defines when a variable is accessible. If you're looking for a detailed description of this aspect, then you're in the right place. Let's begin. 1. Introduction… Continue reading

Gentle explanation of 'this' keyword in JavaScript

1. The mystery of this A lot of time this keyword was a mystery for me and many starting JavaScript developers. It is a powerful feature, but requires some efforts to be understood. From a background like Java, PHP or other standard language, this is seen as an instance of current object in the class method: no more and no less. Mostly, it cannot be… Continue reading