Custom Search

Wednesday, March 17, 2010

Programming paradigm

A programming paradigm is a fundamental style of computer programming. Paradigms differ in the concepts and abstractions used to represent the elements of a program and the steps that compose a computation .

Programming model. Abstraction of a computer system, for example the "von Neumann model" used in traditional sequential computers. For parallel computing, there are many possible models typically reflecting different ways processors can be interconnected. The most common are based on shared memory, distributed memory with message passing, or a hybrid of the two.

A programming language can support multiple paradigms. For example programs written in C++ or Object Pascal can be purely procedural, or purely object-oriented, or contain elements of both paradigms. Software designers and programmers decide how to use those paradigm elements.

In object-oriented programming, programmers can think of a program as a collection of interacting objects, while in functional programming a program can be thought of as a sequence of stateless function evaluations. When programming computers or systems with many processors, process-oriented programming allows programmers to think about applications as sets of concurrent processes acting upon logically shared data structures.

Just as different groups in software engineering advocate different methodologies, different programming languages advocate different programming paradigms. Some languages are designed to support one particular paradigm (Smalltalk supports object-oriented programming, Haskell supports functional programming), while other programming languages support multiple paradigms (such as Object Pascal, C++, C#, Visual Basic, Common Lisp, Scheme, Perl, Python, Ruby,Oz and F Sharp).

Many programming paradigms are as well known for what techniques they forbid as for what they enable. For instance, pure functional programming disallows the use of side-effects; structured programming disallows the use of the goto statement. Partly for this reason, new paradigms are often regarded as doctrinaire or overly rigid by those accustomed to earlier styles. Avoiding certain techniques can make it easier to prove theorems about a program's correctness—or simply to understand its behavior.

Multi-paradigm programming language


A multi-paradigm programming language is a programming language that supports more than one programming paradigm. As Leda designer Timothy Budd holds it: The idea of a multiparadigm language is to provide a framework in which programmers can work in a variety of styles, freely intermixing constructs from different paradigms. The design goal of such languages is to allow programmers to use the best tool for a job, admitting that no one paradigm solves all problems in the easiest or most efficient way.

An example is Oz, which has subsets that are a logic language (Oz descends from logic programming), a functional language, an object-oriented language, a dataflow concurrent language, and more. Oz was designed over a ten-year period to combine in a harmonious way concepts that are traditionally associated with different programming paradigms.


Initially, computers were hard-wired and then later programmed using binary code that represented control sequences fed to the computer CPU. This was difficult and error-prone. Programs written in binary are said to be written in machine code, which is a very low-level programming paradigm.

To make programming easier, assembly languages were developed. These replaced machine code functions with mnemonics and memory addresses with symbolic labels. Assembly language programming is considered a low-level paradigm although it is a 'second generation' paradigm. Even assembly languages of the 1960s actually supported library COPY and quite sophisticated conditional macro generation and pre-processing capabilities. They also supported modular programming features such as CALL (subroutines), external variables and common sections (globals), enabling significant code re-use and isolation from hardware specifics via use of logical operators as READ/WRITE/GET/PUT. Assembly was, and still is, used for time critical systems and frequently in embedded systems.

The next advance was the development of procedural languages. These third-generation languages use vocabulary related to the problem being solved. For example,

COBOL (Common Business Oriented Language) - uses terms like file, move and copy.
FORTRAN (FORmula TRANslation) and
ALGOL (ALGOrithmic Language) - both using mathematical language terminology,
were developed mainly for commercial or scientific and engineering problems, although one of the ideas behind the development of ALGOL was that it was an appropriate language to define algorithms.

PL/1 (Programming language 1) - a hybrid commercial/scientific general purpose language supporting pointers
BASIC (Beginners All purpose Symbolic Instruction Code) - was developed to enable more people to write programs.
All these languages follow the procedural paradigm. That is, they describe, step by step, exactly the procedure that should, according to the particular programmer at least, be followed to solve a specific problem. The efficacy and efficiency of any such solution are both therefore entirely subjective and highly dependent on that programmer's experience, inventiveness and ability.

Later, object-oriented languages (like Simula, Smalltalk, Eiffel and Java) were created. In these languages, data, and methods of manipulating the data, are kept as a single unit called an object. The only way that a user can access the data is via the object's 'methods' (subroutines). Because of this, the internal workings of an object may be changed without affecting any code that uses the object. There is still some controversy by notable programmers such as Alexander Stepanov, Richard Stallman and others, concerning the efficacy of the OOP paradigm versus the procedural paradigm. The necessity of every object to have associative methods leads some skeptics to associate OOP with Software bloat. Polymorphism was developed as one attempt to resolve this dilemma.

Since object-oriented programming is considered a paradigm, not a language, it is possible to create even an object-oriented assembler language. High Level Assembly (HLA) is an example of this that fully supports advanced data types and object-oriented assembly language programming - despite its early origins. Thus, differing programming paradigms can be thought of as more like 'motivational memes' of their advocates - rather than necessarily representing progress from one level to the next. Precise comparisons of the efficacy of competing paradigms are frequently made more difficult because of new and differing terminology applied to similar (but not identical) entities and processes together with numerous implementation distinctions across languages.

Independent of the imperative branch based on procedural languages, declarative programming paradigms were developed. In these languages the computer is told what the problem is, not how to solve the problem - the program is structured as a collection of properties to find in the expected result, not as a procedure to follow. Given a database or a set of rules, the computer tries to find a solution matching all the desired properties. The archetypical example of a declarative language is the fourth generation language SQL, as well as the family of functional languages and logic programming.

Functional programming is a subset of declarative programming. Programs written using this paradigm use functions, blocks of code intended to behave like mathematical functions. Functional languages discourage changes in the value of variables through assignment, making a great deal of use of recursion instead.

The logic programming paradigm views computation as automated reasoning over a corpus of knowledge. Facts about the problem domain are expressed as logic formulas, and programs are executed by applying inference rules over them until an answer to the problem is found, or the collection of formulas is proved inconsistent.



Programming Fundamentals

What is programming?

When we want a computer to perform a specific task, such as generating a marks sheet or a salary slip, we have to create a sequence of instructions in a logical order that a computer can understand and interpret. This sequence of instructions is called a program. The process of writing programs is called programming.

The task of programming involves a lot of effort and careful planning. Without this, the computer will produce erroneous results. The following steps should go into the planning of program:

Ø Defining and analyzing the problem

Ø Developing the solution logically using an algorithm

Defining and analyzing the problem

Before writing a program, we have to define exactly what

1. data we need to provide (input) and

2. information we want the program to produce (the output).

Once we know these, we can figure out how to develop the solution.

Deciding on input

Suppose we want to write a program to work out the total and average of a student’s marks in five subjects, we would need to mention the marks in the five subjects as input.

Deciding on output

Next, we have to think of the output — the elements that should be displayed and those that should not. In the marks example, since the task is to prepare a marks sheet, the marks in all the five subjects, their total and average should be displayed on the screen.

Developing a solution logically

Once we have defined and analyzed the problem — decided on the output and the input — we can go on to develop the solution.

The most important aspect of developing the solution is developing the logic to solve the problem. This requires creating a set of step-by-step instructions and/or rules called an algorithm. Each step performs a particular task. We can write these steps in plain English.. The algorithm for the example on finding total marks and average would look like this:

1. Note down the student’s marks in different subjects.

2. Find the total marks scored by the student.

3. Compute the average marks.

4. Assign grade.

5. Display average percentage of marks and grade.

6. End.

For any computer program to work well, it has to be written properly. Formulating an effective algorithm will make writing an effective program easier. For an algorithm to be effective, it has to have the following characteristics:

1. Finiteness: An algorithm should terminate after a fixed number of steps.

2. Definiteness: Each step of the algorithm should be defined precisely. There should be no ambiguity.

3. Effectiveness: All the operations in the algorithm should be basic and be performed within the time limit.

4. Input: An algorithm should have certain inputs.

5. Output: An algorithm should yield one or more outputs that are the result of operations performed on the given input.

The famous mathematician, D.E. Knuth, first expressed these characteristics.

Programming: The next step after developing an algorithm

Once we develop the algorithm, we need to convert it into a computer program using a programming language (a language used to develop computer programs). A programming language is entirely different from the language we speak or write. However, it also has a fixed set of words and rules (syntax or grammar) that are used to write instructions for a computer to follow.

Programming languages can be divided into three types. They are:

1. Machine language

This is the basic language understood by a computer. This language is made up of 0’s and 1’s. A combination of these two digits represents characters, numbers, and/or instructions. Machine language is also referred to as binary language.

2. Assembly language

This language uses codes such as ADD, MOV, and SUB to represent instructions. These codes are called mnemonics. Though these codes have to be memorized, assembly language is much easier to use than machine language.

3. High-level languages

High-level languages such as BASIC, FORTRAN, C, C++, and JAVA are very much easier to use than machine language or assembly language because they have words that are similar to English.

A quick comparison of programming languages

Machine Language

Assembly Language

High-level Languages

Time to execute

Since it is the basic language of the computer, it does not require any translation, and hence ensures better machine efficiency. This means the programs run faster.

A program called an ‘assembler’ is required to convert the program into machine language. Thus, it takes longer to execute than a machine language program.

A program called a compiler or interpreter is required to convert the program into machine language. Thus, it takes more time for a computer to execute.

Time to develop

Needs a lot of skill, as instructions are very lengthy and complex. Thus, it takes more time to program.

Simpler to use than machine language, though instruction codes must be memorized. It takes less time to develop programs as compared to machine language.

Easiest to use. Takes less time to develop programs and, hence, ensures better program efficiency.

Developing a computer program

Follow the steps given below to become a successful programmer:

  1. Define the problem: Examine the problem until you understand it thoroughly.
  1. Outline the solution: Analyze the problem.
  1. Expand the outline of the solution into an algorithm: Write a step-by-step procedure that leads to the solution.
  1. Test the algorithm for correctness: Provide test data and try to work out the problem as the computer would. This is a critical step but one that programmers often forget.
  1. Convert the algorithm into a program: Translate the instructions in the algorithm into a computer program using any programming language.
  1. Document the program clearly: Describe each line of instruction or at least some important portions in the program. This will make the program easy to follow when accessed later for corrections or changes.
  1. Run the program: Instruct the computer to execute the program. The process of running the program differs from language to language.
  1. Debug the program: Make sure that the program runs correctly without any errors or bugs as they are called in computer terminology. Finding the errors and fixing them is called debugging. Don’t get depressed when bugs are found. Think of it as a way to learn.

Saturday, January 30, 2010

What are Some of the Different Computer Programming Languages?

There are thousands of computer programming languages. These languages are used to control the way computers behave, process information, express algorithms, and handle tasks. Some computer programming languages have been around for many years while new languages, or variations on old ones, are developed every year. Computer programming languages range from the simple and easy to use to very complicated languages used by only the most technologically proficient programmers.

One well-known computer programming language is called Visual BASIC. Microsoft Visual BASIC is considered a high level programming language. It is descendant from Beginners' All-purpose Symbolic Instruction Code (BASIC), a Disk Operating System (DOS) programming language. Visual BASIC is considered simple to learn, featuring codes that bear a similarity to written English. Visual BASIC is both visual and events driven, featuring a graphical environment for programming.

Pascal is also well known among those with interest in computer programming languages. Developed in 1970, by Professor Niklaus Wirth, Pascal is an imperative language. An imperative language is one that uses computations as statements, changing program states through sequences of commands. Professor Wirth developed Pascal to fill feature gaps left by other computer programming languages. His development goals included designing a programming language that would facilitate the creation of well-structured programs, allow for implementation efficiency, and prove helpful in teaching computer-programming concepts.

Fortran is a general-purpose computer programming language that was first introduced by IBM in the early 1950s. It is one of the most frequently used computer programming languages for numerical-based and scientific-computing applications. Fortran fits into categories reserved for general purpose and imperative computer programming languages; it is also considered procedural. It is frequently used in computation-heavy areas, such as computational sciences and climate modeling.

C++ is a high-level computer programming language. It is considered general purpose and is widely used for modern computers. Developed by Bjarne Stroustrup, at Bell Labs, C++ was first introduced in 1985. This programming language was developed for the UNIX environment, allowing programmers to enjoy an easier process for writing code and improving code quality. Additionally, C++ makes it possible to modify existing code without changing it.


Often considered a superset of the C programming language, C++ includes some features of the earlier language. It also boasts compilers capable of running C programs. However, there are major differences. For example, the C programming language, developed in the early 1970s, employs structured programming concepts while C++ is object oriented. C++ was designed with the goal of enhancing the C programming language.

Language development

Language development is a process starting early in human life, when a person begins to acquire language by learning it as it is spoken and by mimicry. Children's language development moves from simple to complex. Infants start without language. Yet by four months of age, babies can read lips and discriminate speech sounds. The language that infants speak is called babbling.

Usually, language starts off as recall of simple words without associated meaning, but as children grow, words acquire meaning, with connections between words being formed. As a person gets older, new meanings and new associations are created and vocabulary increases as more words are learned.

Infants use their bodies, vocal cries and other preverbal vocalizations to communicate their wants, needs and dispositions. Even though most children begin to vocalize and eventually verbalize at various ages and at different rates, they learn their first language without conscious instruction from parents or caretakers. In fact research has shown that the earliest learning begins in utero when the fetus can recognize the sounds and speech patterns of its mother's voice.

Theoretical frameworks of language development

There are four major theories of language development.

The behaviorist theory, proposed by B. F. Skinner suggests that language is learned through operant conditioning . This perspective sides with the nurture side of the nature-nurture debate. This perspective has not been widely accepted in either psychology or linguistics for some time, but by many accounts, is experiencing a resurgence. Some empiricist theory accounts today use behaviorist models.

The nativist theory, proposed by Noam Chomsky, argues that language is a unique human accomplishment. Chomsky says that all children have what is called an LAD, an innate language acquisition device that allows children to produce consistent sentences once vocabulary is learned. His claim is based upon the view that what children hear - their linguistic input - is insufficient to explain how they come to learn language. While this view has dominated linguistic theory for over fifty years, it has recently fallen into disrepute.

The empiricist theory suggests, contra Chomsky, that there is enough information in the linguistic input that children receive, and therefore there is no need to assume an innate language acquisition device . This approach is characterized by the construction of computational models that learn aspects of language and/or that simulate the type of linguistic output produced by children. The most influential models within this approach are statistical learning theories such as connectionist models and chunking theories.

The last theory, the interactionist perspective, consists of two components. This perspective is a combination of both the nativist and behaviorist theories. The first part, the information-processing theories, tests through the connectionist model, using statistics. From these theories, we see that the brain is excellent at detecting patterns. The second part of the interactionist perspective, is the social-interactionist theories. These theories suggest that there is a native desire to understand others as well as being understood by others.

Computer programming languages and generations

Programming languages are use to write application programs which are used by end users. The programming languages are generally used only by professional programmers to write programs. The development of programming languages has improved considerably with the ease and ability of programmers to write powerful applications programs that can solve any task in the world today.

Each computer programming language has its own distinctive grammars and syntax and its own manner of expressing ideas. In principle most computational task could be accomplish by any of the languages but the programs would look very different moreover, writing a program for a particular task could be easier with some languages than the others. The various generations of computer programming languages are discussed below.

1st generation languages
The first generation computer language was machine language, all the machine used machine code which consisted of 0s and 1s. Machine language is highly efficient and allows direct control of each operation; however programmers had to write computer programs using 0 and 1. Some of the drawbacks of the first generations languages were

· Programs were difficult to write and debug

· Programming process was tedious

· Programming was time confusing

· Programs were error prone

2nd generation languages
These were developed in the early 1950s with the ability to use acronyms to speed programming and coding of programs. They were known generational languages were called assembly languages. They had the capability to performs operation such like add, sum. Like machine languages, assembly languages were designed for specific machine and microprocessor, this implies that the program cannot be move from one computer architecture without writing the code which means learning another language where you are to transfer the programs.

3rd generation languages
These were introduced between 1956 and 1963 which saw a major breakthrough in computing history with the development of high level computer languages popularly known as 3rd(3GLS). Example of the 3rd generation languages includes the following

FORTRAN – Formula Translation

FORTRAN was developed in 1956 to provide easier way for scientific and engineering application and these were especially useful for processing Numeric data.

COBOL – Common Business Oriented Languages

COBOL came into use in the early 1960. It was designed with business administration in mind for processing large data types with alphanumeric characters which were mixture of alphabet and data and does repetitive tasks like payroll. The other language was BASIC. These were the early computer programming languages in the early history of computers, since then there has been improvement and this will be discuss later.

Computer animation



Computer animation is the art of creating moving images with the use of computers. It is a subfield of computer graphics and animation. Increasingly it is created by means of 3D computer graphics, though 2D computer graphics are still widely used for stylistic, low bandwidth, and faster real-time rendering needs. Sometimes the target of the animation is the computer itself, but sometimes the target is another medium, such as film. It is also referred to as CGI , especially when used in films.

To create the illusion of movement, an image is displayed on the computer screen and repeatedly replaced by a new image that is similar to the previous image, but advanced slightly in the time domain . This technique is identical to how the illusion of movement is achieved with television and motion pictures.

Computer animation is essentially a digital successor to the art of stop motion animation of 3D models and frame-by-frame animation of 2D illustrations. For 3D animations, objects (models) are built on the computer monitor (modeled) and 3D figures are rigged with a virtual skeleton. For 2D figure animations, separate objects and separate transparent layers are used, with or without a virtual skeleton. Then the limbs, eyes, mouth, clothes, etc. of the figure are moved by the animator on key frames. The differences in appearance between key frames are automatically calculated by the computer in a process known as tweening or morphing. Finally, the animation is rendered.

For 3D animations, all frames must be rendered after modeling is complete. For 2D vector animations, the rendering process is the key frame illustration process, while tweened frames are rendered as needed. For pre-recorded presentations, the rendered frames are transferred to a different format or medium such as film or digital video. The frames may also be rendered in real time as they are presented to the end-user audience. Low bandwidth animations transmitted via the internet often use software on the end-users computer to render in real time as an alternative to streaming or pre-loaded high bandwidth animations.

A simple example
The screen is blanked to a background color, such as black. Then a goat is drawn on the right of the screen. Next the screen is blanked, but the goat is re-drawn or duplicated slightly to the left of its original position. This process is repeated, each time moving the goat a bit to the left. If this process is repeated fast enough the goat will appear to move smoothly to the left. This basic procedure is used for all moving pictures in films and television.

The moving goat is an example of shifting the location of an object. More complex transformations of object properties such as size, shape, lighting effects and color often require calculations and computer rendering instead of simple re-drawing or duplication.

Explanation
To trick the eye and brain into thinking they are seeing a smoothly moving object, the pictures should be drawn at around 12 frames per second (frame/s) or faster . With rates above 70 frames/s no improvement in realism or smoothness is perceivable due to the way the eye and brain process images. At rates below 12 frame/s most people can detect jerkiness associated with the drawing of new images which detracts from the illusion of realistic movement. Conventional hand-drawn cartoon animation often uses 15 frames/s in order to save on the number of drawings needed, but this is usually accepted because of the stylized nature of cartoons. Because it produces more realistic imagery computer animation demands higher frame rates to reinforce this realism.

Friday, January 22, 2010

Information Technology

In the 1960s and 1970s, the term information technology (IT) was a little known phrase that was used by those who worked in places like banks and hospitals to describe the processes they used to store information. With the paradigm shift to computing technology and "paperless" workplaces, information technology has come to be a household phrase. It defines an industry that uses computers, networking, software programming, and other equipment and processes to store, process, retrieve, transmit, and protect information.

In the early days of computer development, there was no such thing as a college degree in IT. Software development and computer programming were best left to the computer scientists and mathematical engineers, due to their complicated nature. As time passed and technology advanced, such as with the advent of the personal computer in the 1980s and its everyday use in the home and the workplace, the world moved into the information age.

By the early 21st century, nearly every child in the Western world, and many in other parts of the world, knew how to use a personal computer. Businesses' information technology departments have gone from using storage tapes created by a single computer operator to interconnected networks of employee workstations that store information in a server farm, often somewhere away from the main business site. Communication has advanced, from physical postal mail, to telephone fax transmissions, to nearly instantaneous digital communication through electronic mail (email).

Great technological advances have been made since the days when computers were huge pieces of equipment that were stored in big, air conditioned rooms, getting their information from punch cards. The information technology industry has turned out to be a huge employer of people worldwide, as the focus shifts in some nations from manufacturing to service industries. It is a field where the barrier to entry is generally much lower than that of manufacturing, for example. In the current business environment, being proficient in computers is often a necessity for those who want to compete in the workplace.