The WordPress.com stats helper monkeys prepared a 2014 annual report for this blog.

Here’s an excerpt:

A New York City subway train holds 1,200 people. This blog was viewed about 4,000 times in 2014. If it were a NYC subway train, it would take about 3 trips to carry that many people.

Click here to see the complete report.

This is most frequent question asked to me ‘Why I’m a ‘Tester’ ?”.

As usual I want to be a good, Ninja Developer and the obvious answer for the question “where I want to see myself after couple of years in IT industry was never to see my self as a Tester”.

But, Unfortunately I was forced to be a tester with the provided reason was I wasn’t able to do code. I didn’t get good sleep for so many months 😦

I was struggling to quit my first job and want to get back to development, so I never loose my hands on doing code and exploring the technologies.

Meanwhile my offshore client “Completely Nontechnical” manager was looking for “value for money”, she want her team should be most innovative among all others. She was the first person who was believing in my abilities and the journey begins here.

The fruitful outcome of my hard efforts, put me on top. I was leading by the technology not by the position.

Suddenly, I observed that it’s really easy to achive a leading position in QA field and that’s change my way to look testing as a carrier.

Step 1:- As always, you have setup android-sdk and Eclipse.

Step 2:- Please add this jars in Eclipse libs folder

  • gson-2.2..jar
  • harmcrest-core-1.3.jar
  • harmcrest-library-1.3.jar
  • httpclient-4.3.2.jar
  • java-client-1.0.1.jar
  • json-20080701.jar
  • selenium-java-2.42.2.jar
  • selenium-server-standalone-2.39.0.jar

Step 3:- You will need to know your app’s Bundle ID (the same as a package in Java project). It could be found using Xcode. Bundle ID (package com.blabla.company) is simply specified under an app’s name in Xcode. Install app into iOS device. Mount iOS device to your computer using USB. Then launch Xcode. In Xcode panel’s left menu (Windows-> Organizer), choose your iOS device, then click on “Applications” menu under it. There your application will be listed. Bundle name is under the title of your app.

Step 4:- will need to know your device’s UDID. Important to know that serial number is not the UDID. To find your iOS device’s UDID, please follow this simple guide: www.whatsmyudid.com

So, here is simple code to launch and run your JUNIT script.

Start your Appium server and run this code from eclipse.

package test.java.com.appium;

public class AppiumIOSTest {  

    private AppiumDriver driver;

    @Before  
    public void setUp() throws Exception {  

    DesiredCapabilities capabilities = new DesiredCapabilities(); 
        capabilities.setCapability("platformName", "ios");
        capabilities.setCapability("deviceName","iOS");
        capabilities.setCapability("udid", “<<<your iOS device UDID>>>”);
        capabilities.setCapability("app", “<<<your apps bundle id>>>”);
        driver = new RemoteWebDriver( new URL( "http://127.0.0.1:4723/wd/hub" ), capabilities );
    }  

    @After  
    public void tearDown() throws Exception {  
       driver.quit();  
    }  


    @Test  
    public void testScriptGoesHere() throws Exception {  

    System.out.println("Test Output From Within the test");
    System.out.println("Here goes your test script");

    }  
} 

Appium for Android Browsers.

Posted: September 26, 2014 in Technology

I hope you have setup android-sdk and Eclipse.

Please add this jars in Eclipse libs folder

  • gson-2.2..jar
  • harmcrest-core-1.3.jar
  • harmcrest-library-1.3.jar
  • httpclient-4.3.2.jar
  • java-client-1.0.1.jar
  • json-20080701.jar
  • selenium-java-2.42.2.jar
  • selenium-server-standalone-2.39.0.jar

How, to interact with web elements for your iOS/Android Device use device-mode  inbuilt Chrome 32+ feature

So, here is simple code to launch and run your JUNIT script.

Start your Appium server and run this code from eclipse.

public class Browser {
  private AppiumDriver driver;

  // private RemoteWebDriver driver;

  @Before
  public void setUp() throws Exception {
    // set up appium

    DesiredCapabilities capabilities = DesiredCapabilities.android();
    capabilities.setCapability("deviceName", "galaxy S4");
    capabilities.setCapability("platformName", "Android");
    capabilities.setCapability(CapabilityType.VERSION, "4.4.2");
    capabilities.setCapability(CapabilityType.BROWSER_NAME, "chrome");
    capabilities.setCapability("androidPackage", "com.android.chrome");
    driver = new AppiumDriver(new URL("http://127.0.0.1:4723/wd/hub"),
        capabilities);

  }

  @Test
  public void openBrowsers(){
      driver.get("http://google.com");
      WebElement searchBox = driver.findElement(By.name("q"));
      searchBox.sendKeys("hello Appium");
      driver.findElement(By.name("btnG")).click();
  }
  
  @After  
  public void tearDown() throws Exception {  
     driver.quit();  
  } }

Performance testing using Gatling.

Posted: August 20, 2014 in Technology

* How to setup and run Gatling  on Windows :- 

  • First confirm that you have a  Java 1.7+ installed on your system.
  • Download latest version of Gatling.
  • unzip gatling folder.
  • cd to <your path>/gatling/bin folder.
  • Run command ‘gatling’.
  • Done.

* How to setup and run Gatling  on Mac :- 

  • First confirm that you have a  Java 1.7+ installed on your system.
  • Download latest version of Gatling.
  • unzip gatling folder.
  • Run this three basic commands
    • sudo sysctl w kern.maxfilesperproc=200000
    • sudo sysctl w kern.maxfiles=200000
    • sudo sysctl w net.inet.ip.portrange.first=1024
  • cd to <your path>/gatling/bin folder.
  • Run command sh gatling.sh
  • Done.

 

 

Most of the time devices are not get detected by Android Debug Bridge(ADB) on Windows devices.

1. Please set %ANDROID_HOME%\tools and %ANDROID_HOME%\platform-tools environment variable.

2. Open command prompt and type command

adb deices

0486c1332523fae6  devices. It means your device is detected

But if your devices not shown(not detected) in list on command prompt, here are few software which helps you to sort out devices are not detected.

Also We need more stuff to detect Google Devices on windows.

  1. Right click ‘My Computer’ or ‘Computer’
  2. Select properties
  3. Select Device manager
  4. Look for your device. It should have a yellow mark above it.
  5. Click ‘update driver software’.
  6. select browse my computer for driver software.
  7. select the usb_driver folder you saved earlier.
  8. install it

 

Android commands for every day !

android sdk :- To launch android SDK manager.
android avd :- To launch android Virtual Device Manager.
emulator @AVDName :– To launch your emulator
adb  install path/to/your/app.apk :- To install android app on mobile through command line
adb -s emulator-5554 install path/to/your/app.apk :- To install android app on emulator through command line
adb shell screenrecord /sdcard/demo.mp4 :- To record screen session

adb shell settings get secure android_id :- to get Secure Android ID :- which is unique id created for every android device for first time use and can be changed on factory reset.

uiautomatorviewer  :- To launch Android App debugger.

adb shell pm get-install-location :- To check app installation is on internal memory or it on SD Card.

0 means installation location is *auto*
1 means installation location is *internal*
2 means installation location is *sd card*
adb shell pm set-install-location 2 :- Change app installation memory to external storage.

Here is the good document regarding Appium Architecture, which is very useful to read before starting actual coding. 🙂

  • Important Documentation :-

  • Here are the steps to run rspec ruby script for android automation for android API level >17 i.e using uiautomator:-

(Note :- uiautomator is android’s default ui test runner available on API level <17)

  • Make sure you have latest version of java installed and JAVA_HOME environment variable SET.

  • Download and install Android SDK (use USE AN EXISTING IDE option to just download SDKs). After installation open Android SDK Manager and install all API levels.

  • Set System Variable Android_HOME to C:\Users\abc\android-sdks and accordingly for MAC and Linux.

  • Set Path variable to %Android_HOME%\platform_tools, %Android_HOME%\tools

  • Open Terminal or Command-prompt. Run adb if it is successful identified your command means your ANDROID_HOME set properly otherwise check it again.

  • Follow the step to create new AVD(Android Vertual Devices)  here or use external android devices to run automation.

  • Download Appium Setup Extract zip file to windows user folder rename folder as a Appium. for MAC/Linux install .dmg package.

  • Download and install node.js server.

  • Try to run Appium(if your .Net framework is outdated it will ask you to install updated version. Please do install latest .Net Framework)

  • Following command will launch emulator or use external devices.

emulator @NameofEmulator

  • Following command will show all attached devices list with device id

adb devices

  • Launch Appium by double clicking on the Appium icon in Appium folder that you extracted in your user folder for Windows. for MAC appium& will launch the node.js server.

  • Here are the steps to run rspec ruby script for android automation for android API level <17:-

(Note :- uiautomator is android’s default ui test runner available on API level <17) so we are using selendroid server

  • Clone appium github code (Don’t download zip file which leads problems in git url not found when rebuilding selendroid.)

git clone https://github.com/appium/appium

  • Go to C:\Windows\Temp folder and delete  selendroid.com.examlepackage.mobility.apk file also com.examlepackage.mobility folder

  • we may need to rebuild selendroid server by cd to appium-master github code directory and run command

reset.bat –selendroid

  • To run automation on lower android devices we need to use ‘Selendroid’ as shown below( Appium Bug  is still open)


capabilities =  {

   ‘browserName’ => ‘Selendroid’,

   ‘platform’ => ‘WINDOW’,#Mac, Linux

   ‘version’ => ‘2.3.3’,

   ‘device’ => ‘Selendroid’,

   ‘app’ => absulute_path,

   ‘app-package’ => ‘com.example.android.contactmanager’,

   ‘app-activity’ => ‘com.example.android.contactmanager.ContactManager’

}

  • Node server will be launched.

  • install necessary ruby gems


     gem install selenium-webdriver

     gem install rspec

     gem install net-http-persistent

  • Ruby script :- (Run rspec your_file_name.rb)


require ‘selenium-webdriver’

require ‘selenium/webdriver/remote/http/persistent’

require ‘rspec’

absulute_path = ‘C:\Users\abc\Desktop\AppiumTest\ContactManager.apk’

capabilities =  {

   ‘browserName’ => ‘Android’,

   ‘platform’ => ‘WINDOW’,#Mac, Linux

   ‘version’ => ‘4.3’,

   ‘device’ => ‘Android’,

   ‘app’ => absulute_path,

   ‘app-package’ => ‘com.example.android.contactmanager’,

   ‘app-activity’ => ‘com.example.android.contactmanager.ContactManager’

 }

server_url = ‘http://127.0.0.1:4723/wd/hub&#8217;

describe “Contact” do

 before :all do

   @driver ||= Selenium::WebDriver.for( :remote,

     :desired_capabilities => capabilities,  :url => server_url,

   )

end

 after :all do

   @driver.quit if @driver

 end

 it “add a contact” do

new_button = @driver.find_element(:name, “Add Contact”)

new_button.click

       wait = Selenium::WebDriver::Wait.new(:timeout => 20) # seconds

textfields = @driver.find_elements(:tag_name,”textfield”)

textfields[0].send_keys(“Android_Appium”)

textfields[1].send_keys(“12345”)

textfields[2].send_keys(“Android@Appium.com”)

@driver.find_element(:name, “Save”).click()

 end

end  

  • Explanation of ruby script :-


*Capabilities*

capabilities =  {

   ‘browserName’ => ‘Android’,

   ‘platform’ => ‘WINDOW’,#Mac, Linux

   ‘version’ => ‘2.3.3’,#  4.3

   ‘device’ => ‘Selendroid’,#Android

   ‘app’ => absulute_path,

   ‘app-package’ => ‘com.example.android.contactmanager’,

   ‘app-activity’ => ‘com.example.android.contactmanager.ContactManager’

 }

Instantiate Selenium driver instance with server_url as node.js server uses JSON-Wire Protocol.

Appium will execute JsonWireProtocol command by converting selenium code.

server_url = ‘http://127.0.0.1:4723/wd/hub&#8217;

@driver = Selenium::WebDriver.for(:remote, :desired_capabilities => capabilities, :url => server_url)

@driver instance will launch your application specified in capabilities on emulator or on attached devices.

  • I’m able to run ruby scripts for android devices on Win 7(64 bit) machine with android Devices having API level >15(version 4.1+) as uiautomator is only supported by android devices having API level >15(version 4.1+) with capabilities


capabilities =  {

   ‘browserName’ => ‘Android’,

   ‘platform’ => ‘WINDOW’,#Mac, Linux

   ‘version’ => ‘4.3’,

   ‘device’ => ‘Android’,

   ‘app’ => absulute_path,

   ‘app-package’ => ‘com.example.android.contactmanager’,

   ‘app-activity’ => ‘com.example.android.contactmanager.ContactManager’

}

For Java use TestNg framework or any frame work you like to run this code.

package com.test.selenium; import org.openqa.selenium.*; import org.openqa.selenium.interactions.HasTouchScreen; import org.openqa.selenium.interactions.TouchScreen; import org.openqa.selenium.remote.CapabilityType; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteTouchScreen; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.AfterMethod; import org.testng.annotations.BeforeMethod; import org.testng.annotations.Test; import java.io.File; import java.net.URL; import java.util.List; public class AndroidContactsTest { private WebDriver driver; @BeforeMethod public void setUp() throws Exception { // set up appium File classpathRoot = new File(System.getProperty(“user.dir”)); File appDir = new File( “C:\Users\abc\appium-master\sample-code\apps\ContactManager\”); File app = new File(appDir, “ContactManager.apk”); DesiredCapabilities capabilities = new DesiredCapabilities(); capabilities.setCapability(“device”, “Android”); capabilities.setCapability(CapabilityType.BROWSER_NAME, “Android”); capabilities.setCapability(CapabilityType.VERSION, “4.2”); capabilities.setCapability(CapabilityType.PLATFORM, “Windows”); capabilities.setCapability(“app”, app.getAbsolutePath()); capabilities.setCapability(“app-package”, “com.example.android.contactmanager”); capabilities.setCapability(“app-activity”, “.ContactManager”); driver = new SwipeableWebDriver(new URL(“http://127.0.0.1:4723/wd/hub&#8221;), capabilities); } @AfterMethod public void tearDown() throws Exception { driver.quit(); } @Test public void addContact() { WebElement el = driver.findElement(By.name(“Add Contact”)); el.click(); List textFieldsList = driver.findElements(By .tagName(“textfield”)); textFieldsList.get(0).sendKeys(“Some Name”); textFieldsList.get(2).sendKeys(“Some@example.com”); driver.findElement(By.name(“Save”)).click(); } public class SwipeableWebDriver extends RemoteWebDriver implements HasTouchScreen { private RemoteTouchScreen touch; public SwipeableWebDriver(URL remoteAddress, Capabilities desiredCapabilities) { super(remoteAddress, desiredCapabilities); touch = new RemoteTouchScreen(getExecuteMethod()); } public TouchScreen getTouch() { return touch; }}}

Search engine optimization (SEO) : SEO works in two ways

  • search engine’s “natural” or un-paid (“organic”) search results.
  • Pay Per Click.

Search engine optimization (SEO) is the process of affecting the visibility of a website or a web page in a search engine’s “natural” or un-paid (“organic”) search results. In general, the earlier (or higher ranked on the search results page), and more frequently a site appears in the search results list, the more visitors it will receive from the search engine’s users .

Here We discuss about optimizing search engines for “natural” or un-paid (“organic”) search results.

Example:

Consider, you are a librarian and many people depend on you to find exact book you need. You need to know , what inside every in every book and how they related to each other.

So you need to store a lot of information and it should be properly structured.

How Search Engines works:

As we discussed search engines stores a lot of information using Search engine indexing. Search engine indexing is a database where information(after being collected, parsed, and processed) is stored to allow quick retrieval. Cache base search engines stores index along with Carpus(collection of documents).  Search engine indexes are auto updating for new feeds and stores collection of data by auto merging.

factors which affects your web content search visibility:-

  • Title:- Title tag should be mention properly. Search Engines doesn’t use the title tag 100% of the time. Occasionally, Google pulls the title from the anchor text of a link to that page. Make sure your words in Title and web link words matches.
  • Snippet The snippet is the description for the page that appears beneath the title. Google may pull this from the page’s meta description tag.  Put relevant sentences, it helps to best search queries.
  • Bolding Google bolds the query words anywhere they appear in the search result.
  • Cached link :- If the page is down or loading slowly, a searcher can still get to the information via the cache. If the page is accidentally deleted, the webmaster can retrieve the data from the cache to recreate the page. Also, the cache shows when the page was crawled.
  • Meta data Other items in a search result include the URL, the page size etc.
  • Sitelink:- Link to other sites helps, improve search results.
  • Want to avoid negative search results about your web content ?  Put unwanted links in robots.txt  in webmaster tools.
  • This  all operations could be done  through  HTML Meta  tags and using  webmaster tool from search engines.

                                            Pune_search_results

Google PageRank  Algorithm:- 

  • Key Points:-
  1. Developed by Larry Page and Sergey Brin in 1988
  2. Trade Mark of Google.
  3. Back Bone of Google Search Technology.
  4. Patterned by Stanford University.
  • Understanding Simple PR Algorithm:-
  1. Every inbound link increase the weightage of a page.
  2. Page Rank is based on numbers of pages linked to that page.
  3. Hence , appropriate SERP listing.
  4. Calculated by Nature and Numbers of back links.
  5.  Indicated on Google toolbar
  6. Highest PageRank is 1 but in real world Indicated with numbers
    between 1 – 10(using a logarithmic scale.)
    Toolbar PageRank (log base 10) Real PageRank
    0 0 – 10
    1 10 – 100
    2 100 – 1,000
    3 1,000 – 10,000
    4 10,000 – 100,000
    5 and so on…             
  • Definition of PageRank Algorithm:-
Assume a small universe of four web pages: A, B, C and D  , then page rank calculated as:
PR(A) = PR(B) + PR(C) + PR(D)
Where page B had a link to pages C and A, page C had a link to page A, and page D had links to all three pages. Then PR is:-
PR(A) = PR(B)/2 + PR(C)/1 + PR(D)/3
Let denote , outbound links by L() then,
PR(A) = PR(B)/L(B) + PR(C)/L(C)+ PR(D)/L(D), final summation will be,
PR(u) = ∑ PR(v)/L(v) , for every v ∈ Bu

i.e. the PageRank value for a page u is dependent on the PageRank values for each page v contained in the set Bu (the set containing all pages linking to page u), divided by the number L(v) of links from page v.

Introduction to Damping factor(By SergeyBrin)(d = 0.85) :-
The PageRank theory holds that an imaginary surfer who is randomly clicking on links will eventually stop clicking. The probability, at any step, that the person will continue is a damping factor d  , generally  assumed  value is  0.85
So generalized PageRank algorithm is :-
PR( Pi ) = 1- d/N + d ∑ P(j)/L(j)
  • Understanding PageRank Algorithm:- 
A Simple Example:-  Consider a small universe (A Set of N pages)where , we have  only to web pages, then

image001

Guess 1st :- Say, initial page rank of each page is 1.0 and d = 0.85

PR(A) = (1 – d) + d(PR(B)/1) and  PR(B) = (1 – d) + d(PR(A)/1) We get,

PR(A) = 0.15 + 0.85 * 1 = 1 and PR(B) = 0.15 + 0.85 * 1 =  1

Guess 2nd :- Say, initial page rank of each page is 40 and d = 0.85

PR(A) = (1 – d) + d(PR(B)/1) and  PR(B) = (1 – d) + d(PR(A)/1) We get,

First Calculation:-

PR(A)= 0.15 + 0.85 * 40 = 34.25 ,

PR(B) = 0.15 + 0.85 * 0.385875  =  9.1775

Second Calculation:-

PR(A)=  0.15 + 0.85 * 29.1775 = 24.950875

PR(B) =  0.15 + 0.85 * 24.950875  =  21.35824375  and so on …

On Kth  Calculation:-  When the sum of PageRank of each page is equal to number of pages present in the set , that would be your page rank of page.
Average page rank never cross to 1.
  • Linear system of equations:-
Assume in small set ‘x’, we have Pages 1, 2 , 3 , 4,

graf2

Please  note some observations here:-

Page 1:- donates = 1/3+1/3+1/3 = 1 and gains 1+1/2 = 1.5 importance.

Page  2:- donates = 1/3+1/2 = 0.83 and gains 1/3 = 0.33 importance.

Page  3 :- donates = 1 = 1 and gains 1/3 +1/2+1/2 = 1.33 importance.

Page  4 :- donates = 1/3+1/2 = 0.83 and gains 1/2 = 0.5 importance.

then, Matrix will be,  A :-                       

matrix

  • Solving Linear Equation:-

Linear system of equations =

eq3

We, got a linear equation:-

system

Solving this equation by substitution method(substitute value of x2, we and ), we get,
eq4
We get a vector eigenvectors corresponding to the Eigen value 1 are of the form
eq5
Here we don’t know about value of x1, choose x1/12  as some constant so we could get Eigen vector, whose average value is 1.
31

                                              PR(x) = 0.38 + 0.132 +0.29 + 0.19 = 0.992

(Since PR never cross 1 and average/Maximum PR will be 1)

  • How PR help you ?

Linking your web content with many links can increase your search visibility and A outbound link from highly Ranked page optimize your search query. 

image006

  • Google Bomb :-
The terms Google bomb is creating large numbers of links, that cause a web page to have a high ranking for searches on unrelated or off topic keyword phrases, often for comical or satirical purposes.
  • References :
  1. I would like to thanks to Dr. Vinayak Joshi, Department of Mathematics, University of Pune, Who introduce me to this algorithm and motivated me.
  2. Department of Mathematics, Cornell University, Lecture 3 and 6
  3. Linear Algebra by Vivek Sahai and Vikas Bist.
For Poll hit the link :-

Most of the mainstream languages, including object-oriented programming (OOP) languages such as C#, Visual Basic, C++, and Java, were designed to primarily support imperative (procedural) programming.

And Haskell, gofer like languages are pure functional, Here we elaborate what is the difference between this two way of programming?

functional languages: The functional programming paradigm was explicitly created to support a pure functional approach to problem solving. Functional programming is a form of declarative programming.

Imperative  languages: An imperative language uses a sequence of statements to determine how to reach a certain goal. These statements are said to change the state of the program as each one is executed in turn.

Pros:

  • functional languages: 
  1. The primary reason to implement functional transformations as pure functions is that pure functions are composable: that is, self-contained and stateless. These characteristics bring a number of benefits, including the following: Increased readability and maintainability. This is because each function is designed to accomplish a specific task given its arguments. The function does not rely on any external state.
  2. Easier reiterative development. Because the code is easier to refactor, changes to design are often easier to implement. For example, suppose you write a complicated transformation, and then realize that some code is repeated several times in the transformation. If you refactor through a pure method, you can call your pure method at will without worrying about side effects.
  3. Easier testing and debugging. Because pure functions can more easily be tested in isolation, you can write test code that calls the pure function with typical values, valid edge cases, and invalid edge cases.
  • Imperative  languages: 
    • Object-oriented languages are good when you have a fixed set of operations on things, and as your code evolves, you primarily add new things. This can be accomplished by adding new classes which implement existing methods, and the existing classes are left alone.
    • Functional languages are good when you have a fixed set of things, and as your code evolves, you primarily add new operations on existing things. This can be accomplished by adding new functions which compute with existing data types, and the existing functions are left alone.

Cons:

It’s depend on user requirement to choose the way of programming, so there is harm only when user don’t’ choose the proper way.

When evolution goes the wrong way, you have problems:

  1. Adding a new operation to an object-oriented program may require editing many class definitions to add a new method.
  2. Adding a new kind of thing to a functional program may require editing many function definitions to add a new case.

Where n Why ?

  • functional languages:
  1. Declarative, whereof functional is a subcategory:
  • Milk is a healthy drink, unless you have problems digesting lactose.
  • Usually, one stores milk in a refrigerator.
  • A refrigerator is a box that keeps the things in it cool.
  • A store is a place where items are sold.
  • By “selling” we mean the exchange of things for money.
  • Also, the exchange of money for things is called “buying”.

… and so on and on …

  • Make sure we have milk in the refrigerator (when we need it – for lazy functional languages).
  1. Imperative way of programming:
  • Start
  • Turn on your shoes size 9 1/2.
  • Make room in your pocket to keep an array[7] of keys.
  • Put the keys in the room for the keys in the pocket.
  • Enter garage.
  • Open garage.
  • Enter Car.

… and so on and on …

  • Put the milk in the refrigerator.
  • Stop.

Examples: Java is an imperative language. For example, a program can be created to add a series of numbers:

 int total = 0;
 int number1 = 5;
 int number2 = 10;
 int number3 = 15;
 total = number1 + number2 + number3; 

Each statement changes the state of the program, from assigning values to each variable to the final addition of those values. Using a sequence of five statements the program is explicitly told how to add the numbers 5, 10 and 15 together.

Summary:

In imperative languages you tell the computer how to change bits, bytes and words in it’s memory and in what order. In functional ones, we tell the computer what things, actions etc. are. For example, we say that the factorial of 0 is 1, and the factorial of every other natural number is the product of that number and the factorial of its predecessor. We don’t say: To compute the factorial of n, reserve a memory region and store 1 there, then multiply the number in that memory region with the numbers 2 to n and store the result at the same place, and at the end, the memory region will contain the factorial.

by Swapnil kotwal