Object Oriented Javascript : ECMA Script 5 : Summary


JavaScript is famous for being the world’s most misunderstood programming language. JavaScript is now used by an incredible number of high-profile applications, showing that deeper knowledge of this technology is an important skill for any web or mobile developer.

Unlike most programming languages, the JavaScript language has no concept of input or output. It is designed to run as a scripting language in a host environment, and it is up to the host environment to provide mechanisms for communicating with the outside world.

The most common host environment is the browser, but JavaScript interpreters can also be found in a huge list of other places, including Adobe Acrobat, Adobe Photoshop, SVG images, Yahoo’s Widget engine, server-side environments such as Node.js, NoSQL databases like the open source Apache CouchDB, embedded computers, complete desktop environments like GNOME (one of the most popular GUIs for GNU/Linux operating systems), and others. Continue reading

Programming : Atomic analogy of OOP Concept

Let us consider the Lewis Structure for the Water molecule. Lets define Lewis structure first – “Lewis Structures are visual representations of the bonds between atoms and illustrate the lone pairs of electrons in molecules.


Oxygen has 6 valence electrons and Hydrogen has 1; altogether water molecule has 8 valence electrons. If we pay attention and analyze individual atom, we see every atom has fulfilled it octet – Hydrogen has 2 electrons and Oxygen has 8 electrons(counting 2 it got from 2 Hydrogen atoms).

In chemistry, a valence electron is an electron that is associated with an atom, and that can participate in the formation of a chemical bond; in a single covalent bond, both atoms in the bond contribute one valence electron in order to form a shared pair.

My point

Consider the valence electrons as public methods and non-valence electrons as private/protected methods. OOP suggests to keep data at the core so that it is always private. So, consider private data as nucleus of the atom.

When two unstable atoms bond with each other to form a rather stable structure sharing their valence electrons, then yields more usable stable chemical structure. Now lets make analogy:

  • bonding                      –> message passing
  • unstable atoms            –> Individual software components (say classes) that need to cope with other entities to form a usable software.
  • valence electrons        –> Public methods (public API) that take part in assembly
  • lone pair of electrons –> Public methods that might not be used in that software at all.
  • core electrons               –> Private methods that do not take part in
  • Atom nucleus              –> Private data of object; never shared directly with other
  • Yielded usable stable chemical structure  –> A releasable software component

Atomic analogy of OOP


OOP : Why are there access modifier in OOP? Public/Protected/Private

In my opinion, all of them have different purposes to fulfill. I have tried to list them below. If you want to understand the concept of OOP then first go through this post “Atomic Analogy of OOP Concept“.


  • Primarily, it is to converge / decrease the dependencies of outer world to these data/method. It makes sure that the developers are not going to use these data/methods and are safe to be modified if deemed.
  • So, it makes sure that its fine to make some tweak in this portion of code. It confirms that its safe and its not gonna trouble the library users.
  • Also, since outer world has no direct connect strings whatsoever, therefore, I can freely change the behavior and be confident that only the same class is gonna be affected.
  • I might(not) have test coverage for this.
    Continue reading