Docker – Basics and Benefits
 

Docker

How many times have you encountered a situation where the software built on one platform doesn’t work on another platform? It is a very expensive affair to ensure that your software works on all the platforms (Mobile, Tablets, PC and so on). This is one of the crucial problems which Docker helps you to resolve but this is not it. There is much more to Docker which we will explore as we move in my upcoming blogs.

Docker is a container management service or a tool which is designed to help developers to deploy and run applications by using containers.  It ensures that the code will behave the same regardless of environment/platform.

Key components of a Docker

  1. Docker File – A dockerfile is a text document that contains series of all the commands a user a make use of to create a Docker Image. The Docker images are automatically built by reading the instructions from a dockerfile.
  2. Docker Image – It’s a lightweight snapshot of a virtual machine. It is essentially an application with all its requirements and dependencies (read-only copy of OS libraries, application libraries etc.). When you run a Docker image, you get a Docker container. Once a Docker image is created, it guarantees to run on any Docker platform. These can be retrieved to create a container in any environment.
  3. Docker Registry – A Docker image can also be stored at online repository called Docker hub.  You can also store your image in this cloud repository (https://hub.docker.com/). You can also save these images to your version control system.
  4. Docker Container – A Docker container is nothing but a Runtime instances of Docker images.

Benefits of a Docker

  1. Build your application once and use it in multiple environments without the need of building or configuring once again. The application built on dev environment guaranteed to work in prod environment.
  2. Centralized Docker repository makes it very easy to store and retrieve. Moreover, you don’t need to build the image from scratch.  You can always leverage existing image and go from there.  The sharing of an image becomes very simple as well.
  3. Version Control – You can always create next image and version control them.
  4. Isolation – Every application works inside its own container and never interfere with other containers.  If you no longer need an application, you can delete its container. Every container has it’s own resources hence there is going to be no challenge.
  5. Security – The isolation ensures that the applications that are running on containers are completely segregated. The container cannot look into or have a provision to control processes running on other containers. This greatly enhances security.
  6. Multi-cloud platforms/Portability – The image built on Amazon EC2 would very well be ported to Microsoft Azure.
  7. Productivity – This is an implicit benefit of using Docker. The speed of development is much faster as the main focus is writing code and business over worrying extensively about deployment/testing.
Why choose Couch DB over Relational Database?
 

Why choose Couch DB over Rational Database?

Choosing a correct database is very important in software development.

The relational database maintains ACID rules. Relational model requires relational database engine to manage writes in a special way. It locks the rows and table to maintain atomicity and consistency. Protecting referential integrity across the tables and rows increase locking time. Increase locking time means higher latency and slower application. Developers face some problems with the Relational database such as:

Object Relational Impedance Mismatch: When RDBMS is being served by an application program written in an object-oriented programming language, objects or class definitions need to be mapped to database tables defined by a relational schema. Misalignment layer of application objects to tables and rows is called Impedance mismatch.

As an example, below are the schema definitions:

Below is the application code:

Class Foo
{
int Id;
string[] colours;
}

In this example, object foo contains field Id and colours (which is a bunch of strings). To store this into the database we need to create 3 tables.

  • Main object
  • Colour information
  • Relation between color and main object

These forces the developer to write a mapping layer such as Entity Framework or ado.net to translate the objects in memory and what is saved in the database.

Many of the developers use object-oriented languages in development. Objects are not rows and tables. All objects are not uniform. Mapping those objects into rows can be painful.

Couch DB is schema-less. There is no relation between a collection of objects. A developer can store any type of document. The documents can be flat and simple or as complex as the application requires.

Couch DB document for “Foo”:

{

ID:1,

Colours:[“red”,”yellow”]

}

Scalability Issues: Scaling out and replicating data to other servers need to increase the lock. Relational database tries to be consistent and increase the locking time and as result application gets slower.

Replication is one of the features in couch DB. Replication takes advantage of clustering to achieve scalability. We just need to mention the source and destination database. Couch Db will handle to replicate the data into a destination. This can also be achieved through a REST call. It should be a POST request to the endpoint “_replicate” with the source and destination servers specified in the body of the request.

RDBMS With MS SQL SERVER NO SQL WITH COUCHDB
Define table No schema
Rows and Columns Document
Dynamic Query Predefined query
Join/Relations Not required
T-SQL Map Reduce
OLEDB/ODBC/EF/ADO.NET REST API
Management Studio Futon
Constraints, Triggers, SPS Validations, show & List Functions

 

Couch Db stores JSON for documents, JAVASCRIPT as MAPREDUCE queries and HTTP for an API. Couch DB can be considered as a b-tree manager with an HTTP interface. It uses a data structure called a B- tree to index its documents and views. It maintains optimistic concurrency via MVCC (Multi-version concurrency control). Previous versions of a document are available till the database is compacted.

B-trees append data only to the database file that keeps the B-tree on disk and grows at the end. B-tree delivers fast searches, inserts, and deletes.

Couch DB features on the server-side document validation and on the fly document transformation. Although a document is stored in JSON, the document can be served as XML or CSV.

Architecture OF Couch DB:

The lowest tier is simple JSON based file store. The storage engine is responsible to accept the JSON documents and serialize them into the disc. Storage engine can access the JSON store. The query engine does fast access to the stored in JSON store. The query definitions are JAVASCRIPT functions stored in the database. B-tree structured index is built on every query and stored in a database. This helps the query engine to read the data fast. Replication engine provides capabilities in master-master bidirectional replication. Through Rest API we can access any of the three capabilities.

 

 

 

 

Service Oriented Architecture – Basics
 

The Service Oriented Architecture (SOA) is not a technology instead it is a collection of Services. Precisely it is an architectural style for building business applications using loosely coupled services which communicates with each other.

SOA      =    Messages + Services

Services – Self-contained business functionality and communicate using messages.

Messages – It is a discrete unit of communication.  It should be cross-platform, secure, asynchronous, reliable, follow industry standard and able to describe and discovery service.

The SOA shifts your thinking from classes and objects to messages.

The webservice is nothing but a service available over the web (Or method of communication between two devices over a network) while API (Application Programming Interface) acts as an interface between two different applications so that they can communicate with each other. The API may or may not be web-based.  Having said that all the all the web services are APIs but all APIs are not web services. The webservice always needs a network while for API it may/may not be needed.

WebServices are mainly of two types

  1. SOAP
  2. RESTFul

Let’s understand the differences between SOAP and REST

  1. SOAP stands for Simple Object Access Protocol. REST stands for Representation State transfer.
  2. SOAP is an XML based protocol which uses WSDL for communication between source and recipient. REST is an architecture style protocol which uses XML and JSON to communicate between consumer and provider.
  3. SOAP uses RPC while REST directly uses URL.
  4. The transfer is over HTTP, FTP, SMTP and other protocol for SOAP while for REST it is HTTP only.
  5. SOAP is hard to implement over REST.
  6. The performance is slower compared to REST.
  7. SOAP is more secure since it does define its own security. The REST is less secure. The transport defines the security. (Smart consumer and provide while dumb pipe).

The SOAP message is large.  The core element of SOAP message is a SOAP envelope. The SOAP envelope defines the start and end of the message. It has two parts 1. SOAP HEADER 2. SOAP BODY

WSDL – Web Service Description Language

The WSDL is an XML based interface that is used to describe the functionalities of the webservices .

DAR – How to find a better option when you have multiple solution for a given problem?
 

“You must choose … but choose wisely”   Your decisions play a critical to make or break your future. The company you choose, the girl or guy you marry, the house you buy, the career option you choose. Isn’t it a great idea to have a tool or intelligent mechanism to make the life easy which would help you to choose the best possible decision based on some real facts rather than some random decision?

DAR

DAR is a process to make key decisions in your organization and even in personal life more objectively and wisely. Just to add more clarity, what do you do when you have multiple solutions for a given problem? How do you decide to pick one that most suited and obviously wise?

Human psychology plays an important role while using this technique. We have a lot of information which we don’t really process rather we just go by Halo effect which is nothing but taking a decision based on what you have in your mind at that moment instead of considering all the inputs

Let’s take some examples

Business Decisions

Should I outsource or not.

Is it a good idea to start an XYZ office in Pune or Mumbai?

Technical Decision – Which technology to choose – C++, Java or .NET

Which technology to choose – C++, Java or .NET

Architecture decisions.

Alright, seems boring. Let me get on to more personal stuff.

Which car do you want to buy?

The DAR – Decision analysis and resolution is an answer for above situations. It is one of the process area defined by CMMI but practically used everywhere. The reason DAR works most times

  • You think about every possible solution and list them out. Hence you consider everything before taking a decision over just thinking about limited core items.
  • You rank individual items based on comparison hence you have more clarity.
  • The template would give you amazing results.
  • You do consider Risk and constraints.

Essentially writing down everything and coming to conclusion. There is no guarantee that your solution would be perfect while you are increasing the chances of getting it right significantly.  It takes almost no time to use this process once you acquainted with it.

Please leverage attached DAR template. I have created it to have the better clarity.

Dar Template

Try few times and trust me you would fall in love with it.

The most basic Java Script Interview Questions
 

JavaScript developed by Netscape. JS is a client side as well as a server-side scripting language. It is interpreted programming language as well with object orientated capabilities.

1. How do you create a class in JavaScript?

Answer – There are multiple ways you can create a class in JS. For example

Method 1 – Using functions

// This is a class name

function Flat(aptName, location){

// You can define object properties

this.aptName = aptName;

this.location = location;

this.getLocation = getLocationInfo

}

// The method can be defined as

function getLocationInfo{

return “The location is “ + this.location;

}I

// You can even define function of a class like this

Flat.prototype.getFlatInfo = function() {

alert (“The apartment name is” +   this.aptName + “ and the location is “ + this.location = location);

// Instantiate new object of Flat class

var myFlat = new Flat(“Manjeera”, “Kukatpally”);

// Invoke methods like this

alert myFlat.getLocationInfo();

Method 2 – Using object literals

Var Flat = {

this.aptName = “manjeera”;

this.location = “kukatpally”;

this.getLocation = function() {

return “The location is “ + this.location;

}

}

Apart from using functions, and object literals, you can use object constructor as well to create JavaScript class.

2. What is the difference between ‘==’ and ‘===’?

Answer –       ‘==’ checks for equality only

‘===’ checks for equality and type

For example

false == 0 returns TRUE

false === 0 returns FALSE

3. What is isNan? Give example?

Answer – This would return true of the argument is not a number. For example

isNaN(23) returns false

isNaN(“2/3/2017”) returns true

4. What are the difference comments available in JavaScript?

Answer – There are two types of comments available in JavaScript

A. Single line comments

// This is a single line comment

B. Block comments

/*

This can be used

For block comments

..

*/

5. What are the types used by JavaScript?

Answer – There are six types used in Java Script

Boolean (True and False)

Null (null)

Undefined (undefined)

Number (Integers, floating etc.)

String

Object (Objects, Array, Functions etc.)

6. Is JavaScript a case sensitive?

Answer – Yes, JavaScript is case-sensitive.

7. How can you create an object in JavaScript

Answer – You can use object literal as shown below

var student  = {

name: “Sandeep”,

age: 36

};

Alternatively, you can use below (As explained in question number 1)

var myFlat = new Flat(“Manjeera”, “Kukatpally”);

8. Does JavaScript support exception handling?

Answer – Yes, it does support exception handling by means of try and catch. It supports try, catch, finally, throw etc. keywords to handle exceptions.

9. What is the difference between break and continue?

Answer – Break statement causes program control to exit from the loop.

The continue statement causes program control to continue with next statement.

10. What is the primary difference between ViewState and SessionState?

Answer – ViewState represents a page in session while SessionState is specific to user specific data which can be accessed all across in the web application.

 

 

 

 

 

 

 

 

Employee Ranking System (ERS) – Products and Technology
 

What is an employee ranking?

It’s an ordered list of employees from “most valuable” to “least valuable” derived out of the ERS (Employee-Ranking System)

What’s the purpose of an employee ranking?

It provides a logical and consistent framework for employee advancement, recognition, and rewards.  It can unearth and expose significant inequities.  If used on an on-going basis, it can provide valuable insight into employee performance and development trends.

How is “value” defined?

Different definitions make sense in different organizations.  We will consider three major dimensions – competence, the level of contribution, and value to the business.  In other words, how skilled the employees at what they do, how productive are they at what they do, and how irreplaceable are their specific skills or knowledge.  For each dimension, we will consider both “performance to date” as well as the “potential for the future”.  Since performance to date is less ambiguous than future potential, we will give it greater weight. Potentially this would help you to identify core members of your

What process will we use?

We’ll list all employees in a spreadsheet with some basic demographic information, their previous ladder evaluations, and the staff member they report to.  For each of your employees, you will rate them from 1-4 (4 being highest) in the three dimensions described above. You will leverage the details mentioned in this word document below in order to identify rating 1 to 4.  You’ll do that once for past performance and once for future potential for these three areas.  We will then total the numbers and ladder all engineering employees together, assigning a 70% weighting to demonstrated performance and a 30% weighting to future potential. You can download the spreadsheet by clicking on below link

ERS – Products and Technology Ladder

How should I calibrate my evaluations?

Keep in mind that the evaluations are independent of job level and experience.  The idea is to identify “most valuable” to “least valuable” That is, it is perfectly reasonable and generally expected for junior employees to get lower scores than more senior employees.  In fact, when that doesn’t happen, that’s a sign of either a high flying junior employee or an under-performing senior employee.  In addition, you can look at previous years’ rankings to get a sense of overall calibration.  Then, use the supplementary guidance in the sections below.

How precise will all this be?

Don’t worry too much about the precision of the numbers.  Our goal is to get relative ranking right.  The numbers give us a big head start in aligning our reference points and in creating a single merged list for the whole organization.  Once we have a consolidated list, the leadership team can ensure right people are in the right place.

Any other helpful instructions?

  • Please be careful not to break any of the formulas in the spreadsheet.
  • If you see errors in any cell, please highlight the cell and make the appropriate correction.
  • For the Rating column, enter your best estimate of the numeric performance rating (from 1-5) that the employee will receive this year or whatever your rating system is.
  • For the Promotion and the Performance Improvement Plan columns, enter a “Y” if you believe the employee should be on one of these tracks for the current year. Otherwise, you can leave the column blank.

The ranking would be derived from three core factors

  1. 1. Competence
  2. 2. Contribution
  3. 3. Value to business

Competence

Areas to consider:

  • – Breadth and depth of knowledge and skills
  • – Leadership and innovation, applied to people, processes, and projects
  • – Problem-solving ability
  • – Technical, business, communication, interpersonal skills

Rating 4:
Has mastered all required skills. Demonstrates strong leadership in one or more areas (e.g., technical, project management, process, etc.).  Consistently works to leverage skills for team and larger organization success.

Rating 3:    
Often operates above the norm, with advanced skills in some areas. Often expends extra effort to help meet goals. Has demonstrated leadership in one or more areas.

Rating 2:   
Has all basic skills for job category and uses them effectively to meet project goals.

Rating 1:   
Needs additional skills development to meet job requirements and to attain project goals. May demonstrate inconsistent achievement of task objectives and project goals.

Contribution

Areas to consider:

  • -Ability to meet commitments
  • – Overall productivity and volume of output
  • – Early communication of problems and contribution to workarounds that meets business goals
  • – Versatility – willingness and ability to adapt to new tasks
  • – Teamwork – willingness and ability to help others
  • – Leadership skills such as architecture, project management, change management, communication, and mentoring
  • – Ability to motivate others, manage self, and demonstrate initiative.

Rating 4:  
Someone who has a lot of initiative, is a  leader across the organization, and has outstanding productivity.

Rating 3:   
Someone who excels in 1 or 2 of these dimensions but not all 3.

Rating 2:   
Someone who delivers what is expected (i.e. does not take much initiative to do more), is a team player but not a leader, and has productivity as expected.

Rating 1:    
Someone who is below expectations in one or more of these dimensions.

Value to the Business

Areas to consider:

  • – Knowledge and skills as mapped to needs of the business
  • – Extra points here for unique skills we need

Rating 4:    
A critical person on a high profile project, creating a vision or blueprint for the project or accomplishing critical business objectives.  Without this person, current and future objectives would not be accomplished.

Rating 3:  
A core person on a high profile project.  Without this person, current and future objectives would be impaired.

Rating 2: 
Could be replaced without significant negative impact to the business.

Rating 1:     
The negative impact to the business. Drains resources and causes objectives not to be accomplished.

 

SMART Goals – You really have to be smart in setting your goals
 

“Know what you want to do, hold the thought firmly, and do every day what should be done, and every sunset will see you that much nearer to your goal.”
Elbert Hubbard

GOAL – A goal is a description of a condition one wishes to achieve. It is the desired result or possible outcome that a person or a system envisions and commits to achieve.

If there is no goal, there is no direction. “Being happy” is not a goal because it does not describe the specific condition.  Instead, “I would travel to Europe this year” is a goal.

The GOAL should be SMART. This acronym extends to Specific, Measurable, Attainable, Realistic and Timely. This is indeed very powerful tool while hardly used.

S – Specific
If you don’t express your goal in specific terms, it is very difficult to achieve. Moreover, you will never know whether you have achieved your goal or not.

Examples
Ambiguous/Vague  – I want to lose weight.
Specific – I want to lose 5 kg in next 90 days.

M – Measurable/Meaningful
You must have concrete criteria to achieve your goals.  You should be able to measure your result or outcome to ensure you are on track. The goal will be really meaningful when you attach motivation to it.

A – Achievable/Attainable
Goals should be motivating and challenging while do ensure that it’s not virtually impossible.  The moment you define your goals and start working on them, it starts coming closer. Things get easier.  Attainable doesn’t mean choosing very simple goals.  The tough goals stimulate you to do more and expand your comfort zone.

R – Realistic/Relevant
The goals which are not realistic, you are highly unlikely to achieve them. Although nothing is impossible but the exceptions are rare.  For instance, if you decide to go for ACP certification with little agile knowledge, assuming you will read 5 books in 5 days, the chances are fat that you will have a success.

T – Timely/Timebound
It is critical to specify a timeline for achieving your goals. If the goal is for the long term, break them down into smaller multiple goals to hit your ultimate goal. This would keep you motivated throughout the journey. For instance, you want to rank number one blogging site for Agile in 24 months, you can target to get into first 1000 in 6 months, 100 in a year, 10 in 1.5 years and eventually number one in 2 years.

Guidelines

  1. Give a deep thought, identify your goals, discuss if needed.
  2. Write them down clearly.
  3. Review them regularly.
  4. Track your progress.
  5. Update your goals as required.
  6. Take the complete ownership of your goals.
  7. Short term goals need to be more realistic. The long term should be broken down into multiple short term goals.

The “Law of Attraction” principle works very well with your goals. If you constantly keep looking at your goals every day, then the chances of achieving them become very high. According to “Law of attraction”, if you can convince yourself of something, the whole world support you to achieve that.  The self-motivation/self-realization/self-acceptance of accomplishing a goal is more important than putting an effort has been proven many times.

The people will treat you the way you treat yourself.  If you think, you would get promoted and you convince yourself that it would happen, it is very likely that it will happen. In order to convince yourself, you should set SMART goals. This will be one of the inputs for “Law of Attraction” to work. You must have noticed that if you want something desperately and constantly focusing on that, you will just get it. In the process of desperation, you actually work on convincing yourself.

Getting Started with the MEAN stack (Mongodb Express Angular Node) – What is MEAN
 

I’ve been helping out some friends with setting up a new site for their endeavors. The basic requirements were

  1. The site needs to be a ‘single page application’ (SPA)
  2. Should be light weight
  3. Should be easy to deploy to one of the many available hosted environments

MEAN stands for the set of technologies used in application development, much like the LAMP (Linux, Apache, MySql and PHP) stack before it. The technologies and frameworks involved in the MEAN stack include Mongodb, Express Js, Angular Js, and Node Js. From a comparative standpoint, I believe that MEAN is popular today, for many of the same reasons that the LAMP stack gained popularity earlier.

Despite their limitations, both development stacks received a strong push from the community, have ubiquitous ‘Hello, World!’ tutorials, are supported on a number of cheap (and sometimes free!) PAAS hosting providers, and required little to no prior experience to get off the ground, giving instant results with minimal effort. They might not be the best dev stacks of their times, but the sheer inertia from their communities has also played a major role in the two being among the most popular web development platforms in the world today.

Why use the MEAN stack

One of the primary advantages of the MEAN stack that the code is written in Javascript, through all layers of the stack. This means that the programmer’s experience with one language (Javascript), is reused for everything, including persistence and server side code (in addition to the usual client side manipulation using a UI framework, which in this case, happens to be AngularJS)

The other big advantage of having javascript at all levels in your dev stack is that objects don’t need to be marshaled and unmarshaled when moving from one layer to another, usually removing the boilerplate code responsible for such conversions. This also helps developers take advantage of Javascript’s loosely typed nature to manipulate data as and when needed. Considering that Mongodb is a document database, and ‘documents’ don’t really *need* to have a fixed schema, this lines up pretty well with Javascript’s the loosely typed nature allowing us to do some really interesting things.

One of the drawbacks that I have personally experienced, however, of the MEAN stack is that developers with prior experience primarily in relational databases tend to continue to think in terms of tables. Relating collections to tables, and documents to records isn’t wrong, conceptually, but the patterns for relational patterns don’t necessarily lend themselves favourably to NoSql databases. Relational databases tend to have long, mature histories with a standardized set of interfaces and features that a developer can reasonably expect to get if he chooses any of the competing options out there.

Sadly, in my experience, NoSql is nothing like that. Different implementations (read databses) have widely differing ideologies on the ‘Right Way’™ of doing things, and they are correct! This is mostly because each implementation seems to be built for a slightly different use case, that needs different trade-offs to make the system function efficiently (for the chosen scenario). This doesn’t mean the databases can’t be used for anything outside their original intended mainline use cases, just that the default settings for the system may not be the best for you. The minor differences in behaviors also means that again, patterns identified for one NoSql database may not be the best for a different one.

While this may change in future as the stack matures and ‘enterprise patterns’ (I hate that term, but it seems apt for this situation) emerge and become ‘common knowledge’ ingrained in a majority of the developers out there, this is not the case today.

Check out the next post on how we got started.

MEAN stack Part 2 – Yeoman and generator-angular-fullstack