Tuesday, February 26, 2019

JavaScript

JavaScript

                  


  • JavaScript is a client side programming language. It means JavaScript code write in to HTML pages.When user request to any HTML page with JavaScript,the script send it to the browser and browser do something with it.
  • It helps to web development. Using this, can reduce the amount of time and efforts for applications.
  • Developers can develop dynamic and interactive web pages using JavaScript
  • Run using a single thread. JavaScript is a single threaded language.
  • JavaScript not wait for until I/O operations complete. And also asynchronous because of NIO nature.

    Different between Java and JavaScript.

  • Java is an OOP programing language. But JavaScript is OOP scripting language. 
  • Java applications can run on virtual machines or browser .But JavaScript can only run on browser.
  •  Java and JavaScript require different plugins.

       Classes and Objects in java script

  •  Constructor function create object using ‘new’ keyword .
  •  Constructor function is another function.
  •  When function use with ‘new’ keyword that function act as a class.
  •  JavaScript support to static methods and variables.
  •  Now use 'class' keyword for create classes in JavaScript.but it is not adopted by all JavaScript engines.

    Prototypes in JavaScript


 JavaScript function has an object called as prototype. It is another object instance. It used when creating objects for inheritance and adding methods to JavaScript class.

    Closure

 
     It is a feature in JavaScript where an inner function has access to the outer function's  variables.variables are in function encapsulate by using this technique.
    


 

Sunday, February 17, 2019

S.O.L.I.D Principles


                                                      

                                                       S.O.L.I.D Principles


 


           S.O.L.I.D are the principles that need to follow when we design the software design in objects oriented language,
these principles helps to design more understandable,flexible and maintainable software product.

1.Single responsibility

     A class should have one and only  reason to change.If we need to change our class more often or it is more complected to
change we can use this principle.it helps to solve this problem by making one responsibility
in each class.This principle helps to reduces the number of bugs and also improve the development speed.

2.Open/Closed Principle

   "Software entities should be open for intention but closed for modification". It focusing on the behavior of super class and its sub classes.
That means we can add a new functionalities without any modifications of existing code.
          Eg:-when we  implement a shape class (parent class)and circle,square etc. as the child classes.child classes extended with parent class
so we can extend new classes without change any of other existing classes.

3.Liskov Substitution Principle

   The super class methods and properties can override to sub classes.Child class cannot give different meanings to the method
after override that method from its super class.


4.Interface Segregation Principle

 Client should not implement unwanted methods.
   Eg:-The shape interface has draw() and area() methods.but circle class is its child class.it wants to use only area()
method.
  The goal of this principle is reduce the side effects.

5.Dependency inversion principle

     High level modules should not depend on low level modules.because of this we can do any    changes to low level class without do change to high level class.
But should depend on abstractions.
  Eg:-In 3 tire architecture business logic layer depend on data link layer.When can change data access layer for different data bases.

These principles use to build a quality software that easy to extend,robust and reusable.