Theme Customizer

Font Family

Background Colors

Text Colors

Card Colors

Accent Colors

Diffrence Between Library and Framework...

featured

Diffrence Between Library and Framework in Programming

Library and Framework in Programming

Table of Contents

Diffrence Between Library and Framework in Programming

Let us start on Library


What is Library in Programming?


In normal life, Library is the storage of books that already written before where readers go to read them. Storage can be physical rooms where books are on shelves or can be electronic database.


In programming, Library is storage of codes that already written before (pre-written codes) that do particular task.


When developers need to do particular task, they call Library codes written before that works well that task they want do.


Why Library Needed in Programming?


As we said above, you call it and perform the task well you want to do, without that library you should write your own codes that performs that task which is difficult and too much time consuming, even no capability to write those codes that perform that task you want to do.


The codes in library were well tested too much times enough in long enough time which makes them more trustable, secured and performs that task well at optimal point.


What can we compare programming library with, in normal life?


Example 1:


When you are going to cook, you need oil and salt.


Imagine that oil and salt are already done libraries stored in warehouse or stock.


You will need them when you are going to cook, you do not need to create your own salt or oil because it is time consuming and use more energy. Also, you should not have capacity to create your own.


Compare then as already written codes before that you need in your application to perform a particular task.


Imagine that the cooking activity is like building application activity where all need already done libraries.


What should happen when those libraries of salt and oil not exist?


If not exist, you should create everything you need.


Create your own oil and salt then use them which takes you more time and energy, even should have no capacity to create them.


But because they are already created, you buy and use them without creating yourself.


Example 2:


When you are going do make a table, you need nails, hammer, hand saw etc.…


Think how it should be difficulty when you nee to make that table and need to create from scratch you own nails, hammer, hand saw to cut timbers and all tools you need to make that table.


So instead, there are already libraries of those tools made before and stored in warehouses or stocks so that when need them, you buy and use them without creating them yourself from scratch.


Also, those tools you need to make a table are libraries the same as pre-written codes you need to build an application.


That action of building a table is like building an application where you use also libraries of already written codes without writing your own codes from scratch.


What should happen when those libraries of all tools you need to make a table not exist?


First of all, you should create each tool you need like hammer, handsaw, nail etc. yourself before you start making table.


But because there are already libraries of them in warehouse and stocks, no need to start from scratch for creating each tool.


Example of library in python and what helps


import math


That library helps in mathematical calculations.


It provides



  •  Math.sqrt(): calculate square root of number

  •  Math.pow(): calculate power of number

  •  Math.pi(): gives the value of pi


Example of library in PHP and what it helps


PHP Mailer


It helps for sending emails from website.


Without this pre-written library, it should be sweat to create your own codes.


Each programming language has different and many libraries that perform different tasks.


Framework


What is Framework in normal life?


Framework is all rules, steps, methodologies and structure you must follow when doing some activity.


Remember, we have talked about cooking and making table in our example on library explanations.


So, Framework is all rules, steps, methodologies and structure that must be followed for doing them.


What is Framework in programming?


Framework is all rules, steps, methodologies and structure that pre-defined to be followed when developing application in particular programming language.


Example of programming frameworks



  •  Laravel for PHP language

  •  Django for Python 

kigalinow.com Iga Programming mu Kinyarwanda