JavaScript
Abbreviated as JS. JS is an interpreted programming language that conforms to the ECMAScript specification. JS is a high level , often just-in-time complied, and multi-paradigm.
- Developed by Netscape Communication Corporation, Mozilla Foundation, Ecma International
- First appeared in December 4, 1995
- Designed by Brendan Eich
Reference: https://en.wikipedia.org/wiki/JavaScript
Functions
Simply function is a sub program that designed to perform a specific task.
Can identify few function types
- Anonymous Functions - Anonymous functions declared without any name identifier to refer to it. So usually not accessible after initial creation.
- Named Functions
- Function Expressions - The function can stored in a variable, after stored in variable that function can accessible through that variable.
- Arrow Functions - Introduced in ES6, allow to write shorter functions syntax.
Classes
JS classes are introduced with ECMAScript 2015. Classes are kind of function instead of using function keyword use class keyword for classes. and the properties are assigned inside the constructor(). constructor() method always call when initialize the class object.
Reference: https://www.w3schools.com/js/js_classes.asp
Static Methods
Static methods are defined on the class itself, so you can't call static methods on object but can call on class.
Objects
Objects are variables too but objects can have more than one value. It can be either property or method. Methods are in object stored as function definitions.
Prototypes
To add some new method or property to existing object constructor we must add that to constructor function. Without doing that way we can easily add new methods or properties to existing object constructor.
All JS objects inherits properties and methods from a prototype. The object.prototype is on top of the prototype inheritance chain.
"this" Keyword
this keyword in JS refers to the object it belongs to. It has Different values where it is used.
- In a method, this refers to the owner object.
- Alone, this refers to the global object.
- In a function, this refers to the global object.
- In a function, in strict mode, this is undefined.
- In an event, this refers to element that received the event.
- Methods like call(), and apply() can refer this to any object.
Strict Notation
The "use strict" was introduced in ECMAScript 5. Its literal expression. Purpose of use "use strict" is to indicate that particular code should be execute in strict mode.
Strict mode can declare by adding "use strict;" to the beginning of a script or a function.
The reasons for have "strict mode" are,
Strict mode can declare by adding "use strict;" to the beginning of a script or a function.
The reasons for have "strict mode" are,
- Easier to write secure javascripts.
- Strict mode change previously accepted "bad syntax" in to real errors.
Reference: https://www.w3schools.com/js/js_strict.asp
Closure
JS variables are belongs to local or global. With the closure global variables can made as global variables.
Callback
Callback is a function that is to be executed after another function has finished executing.
Purpose of use callback is JS is an event driven language. That means instead of waiting for a response before moving on. JS will keep executing while listening for other events.
Promises
Promise are used to handle asynchronous operations in javascript. Promises can handle multiple asynchronous operations easily and provide better error handling than callback and events.
Version Controlling
Version controlling systems are category of software tool that help to development team to manage changes of the code over time. Version control system that tracks the each and every change in the code and keep update things. If a developer made some mistake and break the code that developer can get a backup of the code from version control system. Also version controlling systems facilitating multiple developers can work in single code.
The benefits of using version control system are,
- Can have a long term change history of the software
- Can work multiple developers in one code.
- Merging the software is easy.
- Individual can work on their own branches.
- Can trace every modification done to the code.
Terminology
Repository
The repository is where files' current and historical data are stored.
Trunk
The unique line of development that is not a branch.
Branch
Copy of the master branch taken at a given point. All the feature developments and bug fixes will be done in a branch. Usually it is allowed to have multiple branches at the same time.
Commit
Commit is write or merge the changes made in the working copy back to repository.
Merge
A merge or integration is an operation in which two sets of changes are applied to a file or sets of files.
Pull, Push
Copy revision from one repository to another. Pull initiated by receiving repository, while push is initiated by the source.
Git
Git is a distributed version control system that use to track changes of source code during development phase.
Git was created by Linus Torvalds in 2005 for development of the Linux kernel.
Currently Microsoft is the owner of Git.
Git Commands
- git init - To initialize a git repository for a new or existing project.
- git clone - To copy a git repository from a remote source.
- git add - Adds changes to stage/index in your working directory.
- git commit - Commits your changes and sets its to new commit object from your remote.
- git pull/push - Push or Pull your changes to remote.
- git branch - List out all the branches
- git checkout - Switch to different branches.
- git stash - Save changes that you don't want to commit immediately.
NoSql
A NoSQL database provides a mechanism for storage and retrieval of data that is modeled in means other than the tabular relations used in relational databases.
- Simplicity of design
- Horizontal scaling to clusters of machines
- Finer control over availability
- Limiting object relational impedance mismatch
Reference: https://en.wikipedia.org/wiki/NoSQL
CAP Theorem
Types of NoSQL Databases
- Key-Value Store - It has a big hash table of keys and values.
- Document based Store - It stores documents made up of tagged elements.
- Column based Store - Each storage block contains data from only one column.
- Graph based Store - The network databases that uses edges and nodes to represent and store data.
MongoDB
MongoDB is a cross platform document oriented DB program. MongoDB use JSON- like documents with schema. MongoDB is developed by MongoDB Inc in 2009.
MongoDB Queries
- insert() - To insert data into MongoDB collection, Basic syntax : db.COLLECTION_NAME.insert(document)
- find() - To query data from MongoDB collection, Basic syntax: db.COLLECTION_NAME.find()
- update() - Updates the values in the existing database, Basic syntax: db.COLLECTION_NAME.update(SELECTION_CRITERIA, UPDATED_DATA)
- remove() - Use to remove document from a collection. remove() method accepts two parameters. One is deletion criteria and second one is justOne flag.
Deletion Criteria - (Optional) Deletion Criteria according to documents will be removed.
justOne Flag - (Optional) If set to true or 1 then remove only one document.
Basic Syntax: db.COLLECTION_NAME.remove(DELETION_CRITERIA)
No comments:
Post a Comment