Posts

Showing posts from September, 2018

Big-O notation basics for web developers

Image
What is the Big-O notation? Big O notation is a mathematical notation that describes the limiting behavior of a function when the argument tends towards a particular value or infinity. It is a member of a family of notations invented by Paul Bachmann, Edmund Landau, and others, collectively called Bachmann–Landau notation or asymptotic notation. And is used in Computer Science to describe the performance or complexity of an algorithm. Big O specifically describes the worst-case scenario, and can be used to describe the execution time required or the space used (e.g. in memory or on disk) by an algorithm. Let's break that down: - how quickly the runtime grows It's hard to pin down the exact runtime of an algorithm. It depends on the speed of the processor, what else the computer is running, etc. So instead of talking about the runtime directly, we use big O notation to talk about how quickly the runtime grows. - relative to the input If we were measuring our runtime dir...

How JavaScript uses hashing

What is Hashing? - Hashing is generating a value or values from a string of text using a mathematical function. - A hash function is any function that can be used to map data of arbitrary size to data of a fixed size. The values returned by a hash function are called hash values, hash codes, digests, or simply hashes. - Hashing is one way to enable security during the process of message transmission when the message is intended for a particular recipient only. A formula generates the hash, which helps to protect the security of the transmission against tampering. - Hashing is also a method of sorting key values in a database table in an efficient manner, because it is faster. - A cyclic redundancy check (CRC) is an error-detecting code often used for detection of accidental changes to data. Encoding the same data string using CRC32 will always result in the same hash output, thus CRC32 is sometimes used as a hash algorithm for file integrity checks. - Hashes play a role ...

Interfaces in OOP languages and prototype-based languages

Basic OOP principles - Polymorphism . In object-oriented programming,  polymorphism  refers to a programming language's ability to process objects differently depending on their data type or class. More specifically, it is the ability to redefine methods for derived classes. - Abstraction . Abstraction is one of three central principles (along with encapsulation and inheritance). Through the process of abstraction, a programmer hides all but the relevant data about an object in order to reduce complexity and increase efficiency. - Inheritance . Inheritance is the principle of class hierarchy. It is the ability for one object to take on the states, behaviour, and functionality of another object. - Encapsulation . The most important principle of object orientation is encapsulation : The idea that data inside the object should only be accessed through a public interface – that is, the object’s methods. Encapsulation is a good idea for several reasons:...

Concurrency in Web Development

What is  Concurrency? In computer science, concurrency refers to the ability of different parts or units of a program, algorithm, or problem to be executed out-of-order or in partial order, without affecting the final outcome. (wikipedia .org ) What is Concurrency in operating systems? Process management in operating systems can be classified broadly into three categories: - Multi-programming involves multiple processes on a system with a single processor. - Multi-processing involves multiple processes on a system with multiple processors. - Distributed processing involves multiple processes on multiple systems. All of these involve cooperation, competition, and communication between processes that either run simultaneously or are interleaved in arbitrary ways to give the appearance of running simultaneously. Concurrent processing is thus central to operating systems and their design. (teaching.csse.uwa.edu.au) What is difference between multi-threading and mult...