Tuesday, September 3, 2013

Software Requirements Engineering

Software Requirements Engineering:

As we know that need is the mother of all inventions, Now if we take it in the sense that when ever we need any thing then we started trying to made that thing. Our needs told's that which thing we have to made, whose are the most needy modules of that thing which we required in our need. Now here thing to be noticed is that need is the base from where we get the requirements of that invention and requirements told's us that which we really have to made  which leads us to the invention of maximum output or near to perfectness.

In every ENGINEERING where we have to do sum new inventions we need the perfect requirements to do perfect invention, therefore requirements are equally most important  in every field and every engineering. Due to this importance of requirements A course of requirements with name of "REQUIREMENTS ENGINEERING" is announced and added in all the curriculum's of all engineering's at all universities. This course is just to teach the students to how to gather requirements of their inventions.

Now if we discuss this all in the respective of Software's or Software Engineering we found that every project for a software Engineer is a new invention because he have to made a new software for every new customer. Rarely its happens that the requirements of two customers match otherwise in every case every project is a new invention and due to this level of dissimilarity in requirements for software engineers they have to learn "REQUIREMENTS ENGINEERING" course deeply and sincerely because it is likely to be the core courses of SOFTWARE ENGINEERING.

Thursday, May 30, 2013

Cloud Databases Cloud Computing Cloud Technology Research Paper Report

CLOUD DATABASES
Muhammad Abdullah 
Department of Software Engineering
Bahria University Karachi


Abstract: The purpose of this research paper is to define the Cloud database, History of cloud computing, Architecture, Potential Concerns about Cloud Databases,  Data model Used in Cloud databases,  Deployment model of Cloud Databases, Vendors Providing Cloud Databases and in last Conclusion

Introduction:

In this document we will discuss what the SQL Server Administrator’s responsibilities, why we need to system and who can benefit from it. Microsoft SQL Server is a relational database management system developed by Microsoft. As a database, it is a software product whose primary function is to store and retrieve data as requested by other software applications, be it those on the same computer or those running on another computer across a network (including the Internet).
1.      Cloud Databases refers to the whole set of activities performed by a database administrator to ensure that a database is always available as needed. Other closely related tasks and roles are database security, database monitoring and troubleshooting, and planning for future growth.

2.      History of Cloud Databases & Cloud Computing is a person responsible for the installation, configuration, upgrade, administration, monitoring and maintenance of databases in an organization.
2.1 Year  1960 John McCarthy opined in the 1960s that "computation may someday be organized as a public utility.

2.2 Year  1969 The idea of an "intergalactic computer network" was introduced in the sixties by J.C.R. Licklider, who was responsible for enabling the development of ARPANET (Advanced Research Projects Agency Network) in 1969.

2.3 Year  1999 since the internet only started to offer significant bandwidth in the nineties, cloud computing for the masses has been something of a late developer. One of the first milestones for cloud computing was the arrival of Salesforce.com in 1999, which pioneered the concept of delivering enterprise applications via a simple website. The services firm paved the way for both specialist and mainstream software firms to deliver applications over the internet.

2.4 Year  2002 The next development was Amazon Web Services in 2002, which provided a suite of cloud-based services including storage, computation and even human intelligence through theAmazon Mechanical Turk.

2.5 Year  2006 Then in 2006, Amazon launched its Elastic Compute cloud (EC2) as a commercial web service that allows small companies and individuals to rent computers on which to run their own computer applications.

2.6 Year  2008 In early 2008, Eucalyptus became the first open-source, AWS API-compatible platform for deploying private clouds. In early 2008, OpenNebula, enhanced in the RESERVOIR European Commission-funded project, became the first open-source software for deploying private and hybrid clouds, and for the federation of clouds.

2.7 Year  2009 Another big milestone came in 2009, as Web 2.0 hit its stride, and Google and others started to offer browser-based enterprise applications, though services such as Google Apps.

2.9 Killer Apps "The most important contribution to cloud computing has been the emergence of "killer apps" from leading technology giants such as Microsoft and Google. When these companies deliver services in a way that is reliable and easy to consume, the knock-on effect to the industry as a whole is a wider general acceptance of online services," said Dan Germain, chief technology officer at IT service provider Cobweb Solutions.

2.10 Year  2011 On March 1, 2011, IBM announced the IBM SmartCloud framework to support Smarter Planet.

3.       Architecture It is difficult to pin down a canonical definition of cloud storage architecture, but object storage is reasonably analogous. Cloud storage services like OpenStack, cloud storage products like EMC Atmos and Hitachi Cloud Services, and distributed storage research projects like OceanStore are all examples of object storage and infer the following guidelines.
Cloud storage is:
Ø  Made up of many distributed resources, but still acts as one
Ø  Highly fault tolerant through redundancy and distribution of data
Ø  Highly durable through the creation of versioned copies
Ø  Typically eventually consistent with regard to data replicas.
The systems architecture of the software systems involved in the delivery of cloud computing, typically involves multiple cloud components communicating with each other over a loose coupling mechanism such as a messaging queue. Elastic provision implies intelligence in the use of tight or loose coupling as applied to mechanisms such as these and others.
4.      Deployment Model
There are two primary methods to run a database on the cloud:
      Virtual machine
      Database as a service 

4.1 Virtual Machine: Cloud platforms allow users to purchase virtual machine instances for a limited time. It is possible to run a database on these virtual machines. For example, Oracle provides a ready-made machine image with an installation of Oracle Database 11g Enterprise Edition on Amazon EC2.

4.2 Database as Service: Some cloud platforms offer options for using a database as a service. For example, Amazon Web Services provides three database services as part of its cloud offering, SimpleDB, Amazon Relational Database Service, and DynamoDB.
4.3 A third option is managed database hosting on the cloud, where database is not offered as a service, but cloud provider hosts database and manages it on application owner's behalf. For example, cloud provider Rackspace offers managed hosting for MySQL databases.

5.      Data Model

It is also important to differentiate between cloud databases which are relational as opposed to non-relational or NoSQL:
      SQL database, such as NuoDB, Oracle Database, Microsoft SQL Server, and MySQL .
      NoSQL databases, such as Apache Cassandra, CouchDB and MongoDB, are another type of database.

6.      Vandors

VIRTUAL MACHINE
      SQL
      No SQL

DATABASE AS A SERVICE
      SQL
      NO SQL

6.1 SQL as A Virtual Machine:

      Oracle Database
      IBM DB2
      Ingres (database)
      PostgreSQL
      MySQL
      NuoDB
      GaianDB

6.2 SQL as A Service:

      Amazon Relational Database Service (MySQL)
      Microsoft SQL Azure (MS SQL)
      Heroku PostgreSQL as a Service (shared and dedicated database options)
      Clustrix Database as a Service
      Xeround Cloud Database - MySQL front-end
      EnterpriseDB Postgres Plus Cloud Database
      GaianDB
      ClearDB ACID-compliant MySQL


6.3 NO SQL as A Virtual Machine:

      CouchDB on Amazon
      Hadoop on Amazon
      Apache Cassandra on Amazon
      Neo4J on Amazon EC2   or Microsoft Azure
      MongoDB on Amazon EC2 or Microsoft Azure

6.4 NO SQL as A Service:

      Amazon DynamoDB
      Amazon SimpleDB
      Cloudant Data Layer (CouchDB)
      Database.com by SalesForce
      Google App Engine Datastore
      MongoDB Database as a Service (several options)
      Cloudbase.io Cloud Database 


7.      Potential Concerns
Following are some potential concerns related to Cloud Databases:

      Attack Surface Area.
      Supplier Stability.
      Accessibility.
      Costs.
      Other Concerns.

7.1 Attack Surface Area: Outsourcing data storage increases the attack surface area.
      When data is distributed it is stored at more locations increasing the risk of unauthorised physical access to the data. For example, in cloud based architecture, data is replicated and moved frequently so the risk of unauthorised data recovery increases dramatically. (e.g. disposal of old equipment, reuse of drives, reallocation of storage space) The manner that data is replicated depends on the service level a customer chooses and on the service provided. Different cloud vendors offer different service levels. Risk of unauthorized access to data can be mitigated through the use of encryption.
      It increases the number of networks over which the data travels. Instead of just a local area network (LAN) or storage area network (SAN), data stored on a cloud requires a WAN (wide area network) to connect them both.
      By sharing storage and networks with many other users/customers it is possible for other customers to access your data. Sometimes because of human error, faulty equipment, a bug and sometimes because of criminal intent. This risk applies to all types of storage and not only cloud storage. The risk of having data read during transmission can be mitigated through encryption technology. Encryption in transit protects data as it is being transmitted to and from the cloud service.


7.1  Supplier Stability:
Companies are not permanent and the services and products they provide can change. Outsourcing data storage to another company needs careful investigation and nothing is ever certain. Contracts set in stone can be worthless when a company ceases to exist or its circumstances change.

Companies can:

      Go bankrupt.
      Expand and change their focus.
      Be purchased by other larger companies.
      Be purchased by a company headquartered in or move to a country that negates compliance with export restrictions and thus necessitates a move.
      Suffer an irrecoverable disaster.

7.3 Accessibility:
      Performance for outsourced storage is likely to be lower than local storage depending on how much a customer is willing to spend for WAN bandwidth.
      Reliability and availability depends on wide area network availability and on the level of precautions taken by the service provider.

7.4 Costs:
Cloud storage may be cost-efficient for many corporations and small businesses for everyday use, but for the average user of the computer and internet, the costs of cloud storage may outweigh its benefits. As a result users have other alternatives of storage such as:

      Local wired hard drive
      Local wireless hard drive
      External USB hard drive

There are a variety of free cloud storage options on the market. Many vendors want customers to sign up for their services. So, in return for a new account, many offer free cloud storage.

7.5 Other Concerns:
      Security of stored data and data in transit may be a concern when storing sensitive data at a cloud storage provider.
      Users with specific records-keeping requirements, such as public agencies that must retain electronic records according to statute, may encounter complications with using cloud computing and storage. For instance, the U.S. Department of Defense designated the Defense Information Systems Agency (DISA) to maintain a list of records management products that meet all of the records retention, personally identifiable information (PII), and security (Information Assurance; IA) requirements.
      Cloud storage is a rich resource for both hackers and national security agencies.

      Piracy and copyright infringement may be enabled by sites that permit filesharing. For example, the CodexCloud ebook storage site has faced litigation from the owners of the intellectual property uploaded and shared there, as have the GrooveShark and YouTube sites it has been compared to.

Thursday, April 25, 2013

Indexes in DBMS


1. Introduction

We all know that data entered in the tables are persisted in the physical drive in the form of database files. Think about a table, say Customer (For any leading bank India), that has around 16 million records. When we try to retrieve records for two or three customers based on their customer id, all 16 million records are taken and comparison is made to get a match on the supplied customer ids. Think about how much time that will take if it is a web application and there are 25 to 30 customers that want to access their data through internet. Does the database server do 16 million x 30 searches? The answer is no because all modern databases use the concept of index.


2. What is an Index

Index is a database object, which can be created on one or more columns (16 Max column combination). When creating the index will read the column(s) and forms a relevant data structure to minimize the number of data comparisons. The index will improve the performance of data retrieval and adds some overhead on data modification such as create, delete and modify. So it depends on how much data retrieval can be performed on table versus how much of DML (Insert, Delete and Update) operations.
In this article, we will see creating the Index. The below two sections are taken from my previous article as it is required here. If your database has changes for the next two sections, you can directly go to section 5.


3. First Create Two Tables

To explain these constraints, we need two tables. First, let us create these tables. Run the below scripts to create the tables. Copy paste the code on the new Query Editor window, then execute it.

CREATE TABLE Student(StudId smallint, StudName varchar(50), Class tinyint);
CREATE TABLE TotalMarks(StudentId smallint, TotalMarks smallint);
Go

Note that there are no constraints at present on these tables. We will add the constraints one by one.


4. Primary Key Constraint

A table column with this constraint is called as the key column for the table. This constraint helps the table to make sure that the value is not repeated and also no null entries. We will mark the StudId column of the Student table as primary key. Follow these steps:
  1. Right click the student table and click on the modify button.
  2. From the displayed layout, select the StudId row by clicking the Small Square like button on the left side of the row.
  3. Click on the Set Primary Key toolbar button to set the StudId column as primary key column.

Now this column does not allow null values and duplicate values. You can try inserting values to violate these conditions and see what happens. A table can have only one Primary key. Multiple columns can participate on the primary key column. Then, the uniqueness is considered among all the participant columns by combining their values.


5. Clustered Index

The primary key created for the StudId column will create a clustered index for the Studid column. A table can have only one clustered index on it.

When creating the clustered index, SQL server 2005 reads the Studid column and forms a Binary tree on it. This binary tree information is then stored separately in the disc. Expand the table Student and then expand the Indexes. You will see the following index created for you when the primary key is created:


With the use of the binary tree, now the search for the student based on the studid decreases the number of comparisons to a large amount. Let us assume that you had entered the following data in the table student:



The index will form the below specified binary tree. Note that for a given parent, there are only one or two Childs. The left side will always have a lesser value and the right side will always have a greater value when compared to parent. The tree can be constructed in the reverse way also. That is, left side higher and right side lower.


Now let us assume that we had written a query like below:

Select * from student where studid = 103;
Select * from student where studid = 107;

Execution without index will return value for the first query after third comparison.
Execution without index will return value for the second query at eights comparison.

Execution of first query with index will return value at first comparison.
Execution of second query with index will return the value at the third comparison. Look below:
  1. Compare 107 vs 103 : Move to right node
  2. Compare 107 vs 106 : Move to right node
  3. Compare 107 vs 107 : Matched, return the record
If numbers of records are less, you cannot see a different one. Now apply this technique with a Yahoo email user accounts stored in a table called say YahooLogin. Let us assume there are 33 million users around the world that have Yahoo email id and that is stored in the YahooLogin. When a user logs in by giving the user name and password, the comparison required is 1 to 25, with the binary tree that is clustered index.

Look at the above picture and guess yourself how fast you will reach into the level 25. Without Clustered index, the comparison required is 1 to 33 millions.

Got the usage of Clustered index? Let us move to Non-Clustered index.

6. Non Clustered Index

A non-clustered index is useful for columns that have some repeated values. Say for example, AccountType column of a bank database may have 10 million rows. But, the distinct values of account type may be 10-15. A clustered index is automatically created when we create the primary key for the table. We need to take care of the creation of the non-clustered index.
Follow the steps below to create a Non-clustered index on our table Student based on the column class.
  1. After expanding the Student table, right click on the Indexes. And click on the New Index.

  1. From the displayed dialog, type the index name as shown below and then click on the Add button to select the column(s) that participate in the index. Make sure the Index type is Non-Clustered.

  1. In the select column dialog, place a check mark for the column class. This tells that we need a non-clustered index for the column Student.Class. You can also combine more than one column to create the Index. Once the column is selected, click on the OK button. You will return the dialog shown above with the selected column marked in blue. Our index has only one column. If you selected more than one column, using the MoveUp and MoveDown button, you can change order of the indexed columns. When you are using the combination of columns, always use the highly repeated column first and more unique columns down in the list. For example, let use assume the correct order for creating the Non-clustered index is: Class, DateOfBirth, PlaceOfBirth.

  1. Click on the Index folder on the right side and you will see the non-clustered index based on the column class is created for you.


7. How Does a Non-Clustered Index Work?

A table can have more than one Non-Clustered index. But, it should have only one clustered index that works based on the Binary tree concept. Non-Clustered column always depends on the Clustered column on the database.

This can be easily explained with the concept of a book and its index page at the end. Let us assume that you are going to a bookshop and found a big 1500 pages of C# book that says all about C#. When you glanced at the book, it has all beautiful color pages and shiny papers. But, that is not only the eligibility for a good book right? One you are impressed, you want to see your favorite topic of Regular Expressions and how it is explained in the book. What will you do? I just peeped at you from behind and recorded what you did as below:
  1. You went to the Index page (it has total 25 pages). It is already sorted and hence you easily picked up Regular Expression that comes on page Number 17.
  2. Next, you noted down the number displayed next to it which is 407, 816, 1200-1220.
  3. Your first target is Page 407. You opened a page in the middle, the page is greater than 500.
  4. Then you moved to a somewhat lower page. But it still reads 310.
  5. Then you moved to a higher page. You are very lucky you exactly got page 407. [Yes man you got it. Otherwise I need to write more. OK?]
  6. That’s all, you started exploring what is written about Regular expression on that page, keeping in mind that you need to find page 816 also.
In the above scenario, the Index page is Non-Clustered index and the page numbers are clustered index arranged in a binary tree. See how you came to the page 407 very quickly. Your mind actually traversed the binary tree way left and right to reach the page 407 quickly.

Here, the class column with distinct values 1,2,3..12 will store the clustered index columns value along with it. Say for example; Let us take only class value of 1. The Index goes like this:

1: 100, 104, 105

So here, you can easily get all the records that have value for class = 1. Map this with the Book index example now. See you all in the next article.