Translate

Total Page Views


Featured 1

Curabitur et lectus vitae purus tincidunt laoreet sit amet ac ipsum. Proin tincidunt mattis nisi a scelerisque. Aliquam placerat dapibus eros non ullamcorper. Integer interdum ullamcorper venenatis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Featured 2

Curabitur et lectus vitae purus tincidunt laoreet sit amet ac ipsum. Proin tincidunt mattis nisi a scelerisque. Aliquam placerat dapibus eros non ullamcorper. Integer interdum ullamcorper venenatis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Featured 3

Curabitur et lectus vitae purus tincidunt laoreet sit amet ac ipsum. Proin tincidunt mattis nisi a scelerisque. Aliquam placerat dapibus eros non ullamcorper. Integer interdum ullamcorper venenatis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Featured 4

Curabitur et lectus vitae purus tincidunt laoreet sit amet ac ipsum. Proin tincidunt mattis nisi a scelerisque. Aliquam placerat dapibus eros non ullamcorper. Integer interdum ullamcorper venenatis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Featured 5

Curabitur et lectus vitae purus tincidunt laoreet sit amet ac ipsum. Proin tincidunt mattis nisi a scelerisque. Aliquam placerat dapibus eros non ullamcorper. Integer interdum ullamcorper venenatis. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.

Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Friday, February 1, 2013

Fourth Generation Computer Languages

When you use a third generation language to perform a task you need to provide a detail description of how this task should be carried out. For very narrow domains (specific areas) fourth generation programming languages have been developed, where you only needed to describe what is required. The most famous example of a fourth generation language is the Structured Query Language (SQL) which is used with databases.

Using SQL you can retrieve data from a database in different formats for various conditions just by specifying the headings you need, where they are stored (tables), and the conditions.

Fig 4.3 compares the differences when instructing a computer using SQL and Visual Basic (Third Generation Language) to retrieve data from a database. The example prints a list of students who have obtained an Avg above 75 from a database. In the Visual Basic example you are required to write all the details on how the data should be retrieved. In the SQL example only the requirements need to be specified.

Computer Languages
Third Generation vs Fourth Generation

Fifth Generation Computer Languages

Computer Languages which are related to Artificial Intelligence e.g. Prolog is an example of Fifth Generation Languages. Prolog is used to develop Expert Systems.

Wednesday, January 30, 2013

Introduction to Programming

Languages

In Sri Lanka people use three languages Sinhala, Tamil and English. The purpose of a language is to allow people to communicate. If we want to communicate with a computer it would be ideal if you could use a language like English. Unfortunately computers at present are not intelligent enough to understand human languages. Because of this computer scientists have developed computer friendly languages. These computer languages could be learnt relatively easily by people. Using such a computer language you can communicate with a computer. More specifically you could instruct the computer to perform a particular task.

Computer Languages Generations

First Generation Computer Languages
In the computer there is a component called the central processing unit (CPU). The main purpose of the CPU is to execute instructions given to the computer. The instructions even a modern day computer can understand directly are numbers given in binary format. This language is called machine code (See Fig 4.1). This is the language that a computer really understands. Machine code is dependent on the type of CPU your computer has. The Intel Pentium IV is the CPU used in new personal computers. There are older versions of this CPU, e.g. Pentium III, Pentium II, 80486, etc. These belong to a family of processors called the Intel 80x86. The machine code in these processors are similar. There are other types of CPUs like the PowerPC used in Apple computers, UltraSparc used in Sun Workstations. The internal design of these CPUs are very different from the Intel 80x86 family of processors. Because of this, machine code of these processors are different from the Intel processors.

If you think of a calculator it could add, substract, multiply. These are the operations it can perform. A CPU of a computer has instructions to mainly perform arithmetic calculations such as add and logical operations such as or, and etc.. The instructions supported by the CPU are called the instruction set. People do not instruct computers using machine code today. But when the first electronic computers were developed during the 1940s, the only type of computer language that was available was machine code. Computer scientists had to literally write all instructions using numbers. Machine Code is an example of a first generation computer language.

Second Generation Computer Languages

Using machine code was very difficult and error prone so in the 1950s they came up with the idea of using simple English words to replace the numerical instruction codes. These words were called mnemonics, and this computer language was named as Assembly. 

Now the computer scientists could give instructions using simple words. They next converted these instructions into machine code so that the CPU could understand them using a software developed called an Assembler.

In Assembly every assembly instruction corresponds to a machine code instruction. Since Assembly languages corresponded to machine code, each different type of CPU has its own type of assembly. Assembly is still used today to program small electronic devices because assembly programs are more efficient in speed and requires the least amount of memory compared to programs developed using third generation languages (See 41.2.3).. Assembly is classified as a second generation computer language. Both machine code and assembly are called low level languages.

                                   Machine Code                                           Assembly
Assembly, machine code 

Saturday, January 26, 2013

What is object oriented programming ?

This question is a little difficult to answer because the computer industry has a fascination for terminologies and catch words. Not long ago words like “artificial intelligence”, ‘’gui” and “net surfing” were used as if they were to offer a path to heavens. The same overuse seems to be happening to the phrase “object oriented” Since it has been proven that object-oriented techniques offer a way to write better programs, every body seems to be slipping the label “object oriented” on their software products.

So it is important for us to understand what is OOP, why do we need it, what does it do that traditional languages like C , Pascal nd Basic don’t and what are the principles behind OOP. This chapter addresses these issues and provides an overview of the features to be discussed in the rest of the book. What we say here will necessarily be general and brief . Don’t worry if you don’t catch everything in this chapter on the first pass; OOP is a complicated beast and learning about it takes time. We will be going over these features again in subsequent chapter . There’s lot of ground to cover here , so let’s get started .

While designing software a guideline that should be followed is ‘The Expression of an algorithm should model the application domain that it support ‘. Or in other words the solution to a problem should resemble the problem that it solves. That is, the observer should be able to recognize that purpose  of the solution without necessarily knowing the problem in advance. For example, when you see a properly designed word processor , you intuitively understand that the problem being solved is one of receiving and manipulating text. Similarly , when you see a properly designed inventory control system , you recognize that its purpose is to maintain a record of stock quantities and locations. 

You recognize those things because the solutions resemble and therefore remind you of the problems that they solve . In a similar sense the purpose of a programming language is to express with algorithms the solution to a data processing problem. The techniques used in that expression determine how  successfully the solution models its problem domain . Earlier , procedural programming was used for expression of a algorithm. Of late it is being replaced by object – oriented programming . To understand why this is so let’s begin by looking at the history of programming methodologies.