Wednesday, 11 February 2015

rdms

Reltaional DBMS



WHAT IS A DATBASE SYSTEM ?

A Database is a collection of related data. By data we mean known facts that can be recorded and that have implicit meaning .

Few properties of database
1 . a database is a logically coherent collection of data with some inherent meaning. A random assortment of data can be referred as a database .
2. A Database is designed , built , and populated with data for specific purpose.

WHY DATABASE ?
The main characteristics of the database approach versus the file application

1 . self-describing nature of a database system .
2. Insulation between programs and data,and data abstraction.
3. Support of multiple views of the data .
4. Sharing of data and multiuser transaction processing.

DATA MODELS
A Data Model is a collection  of concepts that can be used to describe the structure of a database - provides necessary means of abstraction .

SCHEMAS
The description of a database is called the database schema ,which is specified during database design and not expected to change frequently. (mainly ddl commands deal with schema)

Instances
snapshot of a database at a particular moment is known as a database instance .
(dml commands deals with instances mainly )

NOTE :: database schema is known as intension and database state or instance is known as extension.


DATABASE ARCHITECTURE AND DATA INDEPENDENCIES

3-Tier Architecture

<><><><><><><><><><><><><><><><><><>

Data Independence
1. Logical Data Independence is the capacity to change the conceptual schema without having to change external schema or application program .

2. Physical Data Independence is the capability to change the internal schema without having to change the conceptual schema.

Database Languages
ddl,dml,tcl

DBMS INTERFACE

1. Menu Based Interface for Web Clients or Browsing - these interface present the user with lists of options(called menus) that lead the user through the formulation of a request.
2. Form Based Interface - A form-based interface displays a form to each user. User can fill out all the form entries.
3. Graphical User Interface -  A GUI typically displays a schema to the user in diagrammatic form. The user then can specify a query by manipulating the diagram .
4. Natural Language Interface -  These interface accepts request written in english or some other language and attempt to understand them.
5. Speech Input Output - Limited use of speech as an input query and speech as a result of some question or result of a request is becoming common.
6. Interface for Parametric Use - Parametric users, such as bank tellers has small set of operation that they must perform repeatedly.
7. Interface for DBA - Most database system contain privileged commands that can be used only by dba staff.





Relation Databases -
-The relational model was first introduced by Ted Codd in 1970
-simple and based on mathematics
-based on concept of mathematical relation-which looks somewhat like a table of values , and theoritically based on set theory and first-order predicate logic.

Database Models - database model is a type of data model that determines the logical structure of a database and fundamentally determines in which manner data can be stored, organized, and manipulated.

Relational Models - The relational database model represents the database as a collection of relations, informally each relation resembles a table of values .

Relational Database Paradigm 
Ordering of tuples in a relation - A relation is defined by a set of tuples . It is not necessary that the tuples are ordered or not.

Ordering of values in an attributes - A relation consist of tuples and there is no such ordering of attributes are done .However the value should be along with the attribute and does not violate the rule of semantics .
Values and Nulls in tuples - A attribute consist of values and they are atomic , i.e the value stored in a tuple is considered as one. There is another value which is found in tuples known as NULL , which means that either the data is unknown or not present in the tuples. 
Interpretation of a Relation - The relation schema can be interpreted as a declaration or type of assertion.

Keys :
There are mainly four types of keys to maintain some constraints as well as the integrity of a relation .

Super Key : A set of attribute which can identify all the tuples uniquely . Let R( a1,a2,a3,...an) is a relation having a1, a2...an as attributes . A set of attribute say (a1 , a2,a3... am) where m<=n , is the superkey if these set can uniquely identify all the tuples .

Candidate key : minimal super key is known as candidate key. 
Primary key : Its the dba choice to select one of the candidate keys as a primary key. There is one more constraint with the primary key i.e they must be unique and not null.

Foreign Key :   To maintain the referential integrity between two different relation in a database we use this key . Foreign key are basically a set of attributes which are common in both the relation and they are used to identify a tuple uniquely. The value stored in a foreign key must be present in the reference table's attribute to whom it is reffered..

Domain - The values stored in an attribute are known as its domain . for example : let class be a table having department as one of its attribute then the collection of values stored in the department attribute only is known as domain.

RELATION OPERATOR :
Select :: select all tuples that satisfy the selection condition from a relation R .
Project :: Produces a new relation with only some of the attributes of R , and removes duplicate tuples .
Equijoin ;; Produces all combination of tuples from R1 and R2 that satisfy the join condition.
Natural Join :: Same as EQUIJOIN excpet that the join attributes of R2 are not included in the resulting relation; if the join attributes have the same name , they do not have to be specified at all.
Union :: Produces a relation that includes all the tuples in R1 or R2 or both R1 and R2., R1 and R2 must be union compatible.
Intersection :: Produces a relation that includes all tuples in both R1 and R2 ; R1 and R2 must be union compatible .
Set Difference :: Produces a relation that includes all the tuples in R1 that are not in R2 ; R1 and R2 must be union compatible.
Cartesian Product :: Produces a relation that has the attributes of R1 and R2 and includes as tuples all possible combination of tuples from R1 and R2.


INTEGRITY

To achieve the consistency and to avoid redundancy we mainly come across integrity .
Integrity is of two types (i) entity integrity (ii) referential integrity

Entity Integrity ; Various constraints which are applied in a relation like primary key ,  unique etc applied to an attribute are known as entity integrity .

Referential Integrity : Constraints applied between two or more relation are know as referential integrity. eg .  foreign key .



NORMALIZATION

First Normal Formal - it was defined to disallow multivalued attributes , composite attributes , and their combinations . It states that the domain of an attribute must include only atomic(simple,indivisible) values and that the value of any attribute must be single value from the domain of the attribute .

Second Normal Form -  it is based on the concept of full functional dependency. A functional dependency X->Y is a  full functional dependency if removal or any attribute A from X means that the dependency does not hold any more,

Third Normal Form - it is based on the concept of transitive dependency. X-> Y and Y->Z , if X->Z is present then we say that there exist a transitive dependency.

BCNF - A relation schema R is in BCNF if whenever a nontrivial function dependency X->A holds in R , then X is a superkey of R.








Thursday, 29 January 2015

CLIENT SERVER ARCHITECTURE ( cont ..3)

   
     SYLLABUS

           Networking Concepts

                 o Basic Introduction to Network
                 o TCP/IP Introduction
                 o Communication between two systems
                 o Domain registration, DNS mapping, ISP
                 o Security



Its really tough to explain the whole networking module in one single post. It  is a huge concept and it is divided into layers to simplify our understanding which we will see later. 
First we need to start with the basic concepts of networking .

Network is a group of  computers or nodes connected by some medium i.e ethernet , wifi or infrared . This group of computer within a network is known as domain and we can share data , exchange files or perform some other activities in this network.

We can further find different types of networks depending upon the number of nodes present on it or the interaction between the nodes.

On the basis of number of nodes in a network , we generally come across three different networks
LAN , MAN and WAN
LAN is a small scale group of nodes which is generally found in colleges or small companies where computers are connected directly with the help of ethernet wire (optical cable ) or wifi .
MAN is a group of nodes in a particular range or space , where computers may or may not be connected directly eg two office buildings connected together .
WAN is used for global prospects i.e when we talk about world wide web  . We are basically talking about this kind of network.

On the basis of interaction between the nodes , the network can be divided into intra-network and inter-network .
Intra-network - When two different nodes within the same network interact with each other , then it is known as intra-network, When a person of company A tries to send a file to its colleague working in the same company then both of them uses same network A.
Inter-network - When two nodes from different network interact with each other , we call it as inter-network. Eg . when a person of company A tries to send a file to another person of company B , it uses two different networks  i.e . network A and network B . So we call it as inter-network.

Network Topology is the structure of the network i.e. arrangement in which the nodes are connected with each other. Star , Mesh , Bus and ring topology are few examples of network topology.

Networking devices
There are few networking devices which have some specific work to perform while transferring or receiving a message from a node. Here are few networking devices which we use .

Repeaters are used in the physical layer and there work is to increase the signal strength and does not add anything to it. Actually data is transferred in signals which after going to certain distance through the wire looses its strength . Therefore,  we use repeater to increase signal strength so that data which we want to send does not get lost somewhere in the cable.

Switch is used to connect two or more networks and helps to control the flow of data  in some particular domain . Example - Suppose our switch connects  4 different networks lets say A ,B ,C and D . If I want to send data from network A to D then , switch will help me to broadcast my data only in network D and not in any other networks like B and C.

Hub is used to connect several ethernet(cables) together and make them look like one. While broadcasting some data , unlike switch it transfers data to all the networks that are connected with the help of hub.

Bridge also helps to connect different networks but it brings out some different features. It maintains a table which helps to avoid looping while sending data i.e if our packet of data travels in a network and come across a loop of nodes , it will circulate there only . Thus , prevent the actual receiver to get the message.

Router is a networking device which not only helps to connect two or more network but helps to find the optimal path i.e the shortest path for reaching one node to another. It forms a routing table based on some routing algorithm and it also helps in the packet formation also.

Gateway is used to connect two different networks following similar or different network protocols .


Addresses 

In computer networks , we come across three types of addresses .
(i) Logical address / IP address - assigned by the ISP (internet service provider)
(ii) MAC address/Physical address -  Network interface card has a unique 48 bit address provided by the manufacturer.
(iii) Service Port Address - each process running on our system is assigned a unique port address which helps to communicate at the process level.


TCP/IP protocol
Prior to this protocol (set of rules) OSI model was passed , which forms the base for all networking protocols. It consist of 7 layers which plays a huge role while transferring data. Below diagrams tells us about the OSI layers.



Lets go into brief detail about each layer of OSI model :

Physical Layer :: ensures a safe and efficient travel of data in the form of bits , consists of electronic circuits for data transmission.

Data Link Layer :: in charge of data encapsulation under the form of frames and their interpretation at the physical level. It is also responsible for hop to hop transmission of data .

Networking Layer :: in this layer , routing algorithm is followed to find the shortest path and is responsible for packet formation and node to node transmission of data.

Transport Layer :: It is responsible for process to process communication with help of service port address , and formation of segments from the message is done.

Session Layer :: it creates a dialog box where the two computer system communicate on some protocol  which later helps for efficient data transmission.

Presentation Layer ::  determines the format of data transferred to application , data compression / decompression and encryption .

Application Layer :: it deals with the application interface which helps to interact with the user.


After this TCP/IP was introduced which are more reliable and hardware based architecture. It was found more efficient than the OSI model. Below diagram shows different layers of tcp/ip protocol




Network Layer :: has same functionality like physical layer , data link layer and networking layer.
                            packet formation and  ip and physical address mapping is done.

Internet Layer :: Based on internet protocol (ip) which provides the frame for transmitting data from                               place A to place B

Transport Layer :: mainly depends on two protocol  TCP and UDP .
                             TCP is a connection oriented protocol i.e process to process or end to end                                              connectivity is done using the ip and service port address . Thus forming a logical                                 path between two process also known a virtual circuit or tunnel . Data flows in a                                   stream of packets while using this protocol .

                              UDP is a connection less protocol i.e no virtual network or tunnel is made prior to                                data transferring. Unlike to TCP protocol , data are sent in discrete packets and                                    one packet is independent of other packets .

Application Layer :: comprises the work of session , presentation and application layer of the OSI                                     model . HTTP , FTP , SNMP are some protocols of application layer


DOMAIN NAME SERVICE 
It is very difficult to remember the ip address of each system connected in a network . So , the best and the easy way to remember them is to name them . eg . www.atos.net , which is nothing but a sub network of .net domain , and a specific name atos is given to it.
IP address and its corresponding names are maintained in the dns server located in various parts of the network . Whenever , we type an URL , then the name is resolved by checking the tables present at the dns server . If the corresponding name is found , it returns the ip address and then it redirects the packets to that specific host.

SECURITY :: cryptography , firewall , antivirus etc are some security methods adopted by the network administrator to provide security .

Wednesday, 28 January 2015

CLIENT SERVER ARCHITECTURE (cont..2)

 Client server architecture
                
                 o Client
                 o Server
                 o Thin Vs Thick client
                 o Services
                 o Presentation layer
                 o Application/business logic layer
                 o Generalized services layer
                 o Communication with RPC and SQL
                 o Middleware


I am going to cover this part of the module in this post .  To begin with this with client and server architecture , you need to recall the definition of client server model/  architecture.

DEFINITION - The client-server model of computing is a distributed application structure that partitions tasks or workloads between providers of a resources of service, called servers, and service requesters, called clients . Often clients and servers communicate over a computer network on separate hardware, but both client and server may reside in the same system . A server host runs one or more server programs which share their resources with clients. A client does not share any of its resources , but requests a server's content or service function. Clients therefore initiate communication session with server which await incoming requests. Example emails , web browser. 

Let us go into detail and know more about clients and servers. 

CLIENT

Definition ::  A client is a piece of computer hardware or software that access a service made available by server. The server is often (but not always) present in another computer system , in which case the client access the services by way of a network.

SERVER

Definition :: A server is a running instance of an application (software) capable of accepting request from the client and giving response accordingly . Servers can run on any computer including dedicated computers, which individually is  also often referred as "the server" . In many cases , a computer can provide several services and have several servers running. The advantages of running server on dedicated system is security . For this reason the server  are daemon processes and designed in that they can run on specific computer(s).

THIN VS THICK CLIENT

There are three types of client computers or devices : 
(i)  thin client
(ii) thick client
(iii) hybrid client

# THIN CLIENT

A thin client is a computer or device which completely depends on the server to run an application. It uses the resources of host and it only presents the data which are processed in bulk at the server side .
A device based on web application (such as web office app) is a thin client .

The programming environment for thin client includes JavaScript , Jsp , RUBY etc.

#THICK CLIENT

Thick client is also known as FAT client or rich client. It processes the bulk of data by itself and does not rely on any software . When we talk about the examples of thick client we must think of application in which we process all the data there itself for eg . autocad , where all the data are processed and we only send the result of it.


HYBRID CLIENTS

This type of client has both the traits of thick and thin client. Hybrid client processes all the data at the client side only , but relies on the server for it's processing . Hybrid clients are generally those computers or devices which has online activities involved with it eg. online game

SERVICES

The client server architecture is an abstraction of computer resources . The client does not know anything about the server functioning , it only sends request which is processed at the server ends and depends on the server for  response of the request made by it. The client work on the response based on some application protocol . There are different types of services provided by the server for example file server which serves with computer files and web server which serves with web pages. Thus , there are different types of servers and each server has their  own job to do and provide service to the user.


As we have discussed earlier in the layered architecture that the whole application is divided in layers (i) presentation layer , (ii) business layer and (iii) data layer.

PRESENTATION LAYER 

It is the User Interface which is nothing but graphical interface which helps the  user to interact with the system. It basically does not know anything about the detailed structure of the application , its basic work is to be in front end and take whatever data the user is giving . Then it passes the data to the subsequent layer.


# user interface(UI) components is nothing but the text field , buttons , scroll .. etc which we generally see in any type of application.
# user interface(UI) process components , deals with the components and what action needs to be done when user does something.

BUSINESS LAYER / APPLICATION  LAYER 

This layer basically creates a blanket on the data and helps to prevent intervention of other users . It deals with the logic behind every services provided by the application . It helps to deals with what kind of data and how the data need to be stored in the memory .

Application layer contains four components application facade , business workflow , business components and business entities which is not our concern for this moment.

SERVICE  LAYER
When providing application functionality through services , its better to introduce a new layer i.e service layer in the architecture . This layer consist of  service interface and message types . The main constraint for this layer is not to expose the application details to others while providing services . It also  checks that there is no unduly action taking place which hampers the message type or data which is either processed or moved to the data layer.


NOTE ::: ALL THE LAYERS IN LAYERED ARCHITECTURE ARE INDEPENDENT  FROM  EACH OTHER  AND WORKS LIKE AN ABSTRACTION FOR THE END USER. 

COMMUNICATION WITH RPC AND SQL

REMOTE PROCEDURE CALL (RPC) 

Remote procedure call is used for inter process communication .that allows a computer program or subroutine to run on different computer without programmer explicitly coding for the remote interaction i.e the programmer writes the same code for the subroutine is local to the executing program or remote ,

In other words ,we can say that rpc is a method used to communicate between different process which actually runs on two different computers and the programmers does not write different codes for local connected computers i.e with the help of LAN or a computer which is remote i.e situated in a distant place. Each time it invokes same code and helps to communicate between two process running on different computers.

sql part we will cover in the dbms module of our syllabus .


MIDDLEWARE

Definition :: Middleware is an software that provides services to the software application beyond those available from the operating system.

It is basically a software layer that lies between the operating system and the software application on each side in a distributed computer networks. It helps to make business application and provides core services like concurrency , scheduling , threading , messaging (communication) ,provide security and many more.


Tuesday, 27 January 2015

CLIENT SERVER ARCHITECTURE



Hii friends this is my first post regarding the courseware Hope you'll like it. I have tried to come across all the topics given in the syllabus and few more points which I think is important to share with you all.


  Subject :: CLIENT SERVER ARCHITECHTURE
   

  Syllabus :-

            Overview of software architecture

                 o What is architecture and its importance
                 o Architectural styles
                 o Pipe and filter
                 o Black-board
                 o Layered architecture
                 o Frames and patterns
       
            Client server architecture
                
                 o Client
                 o Server
                 o Thin Vs Thick client
                 o Services
                 o Presentation layer
                 o Application/business logic layer
                 o Generalized services layer
                 o Communication with RPC and SQL
                 o Middleware
           
           Networking Concepts

                 o Basic Introduction to Network
                 o TCP/IP Introduction
                 o Communication between two systems
                 o Domain registration, DNS mapping, ISP
                 o Security

           Examples of Client server architecture:

                 o Two tier architecture
                 o Three tier architecture
                 o Three tier with transaction processing (TP) monitor technology
                 o Three tier with message server
                 o Three tier with application server
                 o Three tier with middleware technology:


This is the topics which we need to cover in our training session. Before fgoing into the technical details lets get familiar with how client server application works . Lets take an example of it and latter we can explore it technicalities in detail.

Now a days emails are the basic mode of communication between two different parties. It is a good example to start our discussion. Let us consider A want to send message to B. A writes an email and sends it to B. He/She thinks the letter will reach to B without any problem. B receives that mail after 3 hour. Now many of us know about the technical details of it but for A and B it is new. A doesn't care weather B's computer is online , but how it is possible. It is a complex process of message passing from one end to other. First A send email , it moves to hundreds of yards and get stores in a box . Now when B turns on his computer he/she login into his/her email browser and looks into the inbox. Guess what ? a magic happens and the mail from A which was saved in a box comes in his/her inbox list. Here in our example A and B are client and they do not know anything about the process which is run to pass that mail between them . The BOX which we were talking about is nothing but a server , where the letter was kept from A and after few hours it was surprisingly passed to B.

Well , now we need not think much about the hardware or networking concepts hidden in this task . We need to draw a clear picture of client and server in our mind. The client are nothing but a front end application running in distant computers.Its main job is to provide an interface where a user can interact with the server i.e request-response mode of communication. Client sends request to do some job . Whereas , a server can be consider as an application running somewhere else on a different computer or within the same computer where client was working , server's job is to listen to each request from the client and execute the need of client and provide a response to the clients.

Hope you got an idea of client server in the above example. Now lets go through the definition of client server architecture and latter we can begin with the topics as mentioned in our syllabus.


DEFINITION - The client-server model of computing is a distributed application structure that partitions tasks or workloads between providers of a resources of service, called servers, and service requesters, called clients . Often clients and servers communicate over a computer network on separate hardware, but both client and server may reside in the same system . A server host runs one or more server programs which share their resources with clients. A client does not share any of its resources , but requests a server's content or service function. Clients therefore initiate communication session with server which await incoming requests. Example emails , web browser.


OVERVIEW OF SOFTWARE ARCHITECTURE

Definition : Software architecture is a blueprint of the system explaining the structure of the system.








The above diagram is an example of software architecture , which shows the interaction between the different components or modules-smallest unit of software architecture . The software architecture tells us about the module and how they interact with each other. Each module has some assigned work to do and the architecture helps us to know on which platform they are running and what kind of services they are providing ?


ARCHITECTURE STYLES

From the word architecture , an idea of building or some planned structure comes in our mind . We find different types of building in our daily life but they are categorized on the basis of a common features like when we are talking about Shopping mall , we get a clear idea about what all basic things should be present in the shopping mall. In software , architecture also does the same thing . It tells us about the key features of a given software architecture like reusability , adaptability. Architecture styles has nothing to do with the appearance of the software.


Commonly there are 5 types of client server architecture.

           # Call-Return :
               -  main program/subroutines
               - simple client server

          # Hierarchical
               - n-tier

         # Interacting processes
               - implicit invocation (Publish- Subscribe)
         # Data Flow
              - pipe and filter
        
         # Shared Data / Repository
              - Blackboard

CALL-RETURN

In call return architecture , the client component is responsible for invoking a functionality in the server component . The components wheather it is client or server each of them wait till the invoked functionality is completely executed . The correctness of each component depends on the correctness of functionality it invokes .

 DATA FLOW 
    - Pipe and Filter

Pipe and Filter

In a Pipe Filter architecture , each component (filter) of the system,  reads a stream of data and produces a stream of data .It is also known as one way network model , where data reach to a filter and processes it and again produce stream of data as shown in the below diagram. All the filters are completely independent of each other i.e it must not share state common threads and doesn't share identity with other filters on its upstream and downstream interface.


BLACKBOARD ARCHITECTURE STYLE

Definition :: A blackboard architecture is a distributed architecture system , where distributed system modelled as intelligent agents , and they share a common database known as "blackboard" and a scheduling/ control process. The blackboard can be centralized or distributed depending on the constraint of application.


From the above diagram , we can simplify the definition of blackboard architectural system . In this architecture there is a common database known as "blackboard" . Initially one agent (client) , let agent 1 starts writing and the other agents watch the blackboard and tries to collect information from the blackboard.   Whenever, other agents find something new or different from the previous agent  then it will take the chalk from the agent 1 and start adding new solution on the blackboard.


LAYERED  ARCHITECTURE                                                                                                             
In layered architecture , the whole software is divided in layers and data or control flow from one layer to other . There can be multi-layered architecture also depending on the need of software application. In general , we basically deal with three layers (i) presentation layer or User interface , (ii) logical layer or business layer and (iii)  data access layer or data layer. Each layer has its own importance and together they help in the smooth functioning of an application.
Presentation layer or user interface is an graphical interface where the user can interact with the application by giving some data or control options. In logical layer , a link is made between user interface and data layer . This layer helps to know what kind of data is store and how it need to be stored in the database. Finally the data access layer mainly deals with the data storage i.e where the data need to be stored in the storage area (memory) .


FRAMES AND PATTERNS
A Pattern describes a reusable solution to a common problem that arises in a particular problem context when related patterns are woven together they form so called pattern languages that provide a vocabulary and process for an orderly resolution of a software development.
A frame (framework) is an integrated set of software components that collaborate to provide a reusable architecture for a family of related applications. Framework can also be viewed as a concrete realization of pattern languages that facilitate direct reuse of detailed design and source code