CSC/ECE 517 Fall 2011/ch1 1e sa

From Expertiza_Wiki
Revision as of 00:38, 8 September 2011 by Ajdavis7 (talk | contribs) (Added sections on block structure)
Jump to navigation Jump to search

"Block and Object-Oriented Programming Languages" by Andrew Davis and Srikanth Ramachandran

In computer science, computer programming languages exhibit variance in syntax and structure in order to effectively solve problems. Two of these variances can be seen between block structure and object-oriented structure. A programming language with block structure allows the programmer to group lines of code so that they may be accessed as a single entity. Meanwhile, object-oriented structure allows the programmer to associate data with its actions in a hierarchical manner. Object-oriented structure has many advantages which generally make it more effective and durable than block-structured languages, but object-oriented languages also benefit from ideas present in block structure programming.

Block structure

Definition

Block-structured programming languages are task-centric, high-level languages. Operations on data sets are emphasized rather than the data itself in an attempt to logically organize program operation. The design and implementation involves breaking down the problem into discrete blocks, or units, which can be nested to any depth or not at all. Each block generally consists of a set of delimiters such as braces, indentation, and the like that separate them from other blocks. Each of these blocks contains a set of (optional) declarations and logic to solve a particular problem. Declarations inside of nested blocks introduces the concept of variable scope, which frees the programmer from having to worry about name collisions and other variable maintenance tasks.<ref>Block (programming) at Wikipedia</ref>

History

Block-structured languages were first conceived in the 1950s with the advent of ALGOL, one of the first imperative programming languages. An evolution of block structuring was created as the “GOTO” logic of programs became more and more difficult to understand and maintain. In 1968, famed computer scientist Edsger Dijkstra wrote a letter and follow-up article on the ideas and motivation behind “structured programming,” where the program exhibits “separation of concerns,” single point of entry but multiple points of exit, and ideas of data structures. It was Dijkstra’s and others’ which helped propel this basic idea of block structure programming into the mainstream.<ref>Structured programming at Wikipedia</ref>

Programming languages

Block-structured programming languages dominate the general purpose, imperative programming language arena. Indeed most programming languages in modern use enjoy some of the benefits of block structure with grouping of code and scope of variables. Indeed, ignoring their object-oriented aspects, all of C, C++, C#, Java, PHP and Visual Basic – for example – contain elements of block structure.

Object-oriented structure

Definition

Description

Principles

Encapsulation
Inheritance
Polymorphism

History and transition

Programming languages

Structure comparison

Advantages, disadvantages, and limitation

Block Structured Languages

Advantages:

1. Simplicity. 2. Coding and turnover time is very small. 3. Dynamic lifetime of variables provide efficient usage of memory with allocation and deletion happening at the entrance and exit of each block.

Disadvantages:

1. When arrays are passed as parameters they are usually unbounded,hence it was easy to access an element out of bounds. 2. Large sized projects were very difficult to manage due to very large code bases. 3. There is very less code reuse.


Object Oriented Languages

Advantages:

1.The software objects model the real world objects. Hence the program composition is well defined and structured. 2.Since each object's definition and internal working is decoupled from other objects in the system the design becomes inherently modular. 3.Adding new features becomes very easy because of the inheritance feature. The new class can contain the new feature in addition to all old features from the inherited class. 4.Debugging is easier since each objects internal working is independent of each other. This helps in isolating errors easily and fixing them. 5.Code re usability.

Disadvantages:

1.The complexity of O-O design becomes prohibitive when working on small projects. 2.Object-oriented programming paradigm is preferable for dynamic environments rather than simple non complex environments. 3.The time efficiency is much less compared to block structured languages.

Effectiveness and durability

Applicability between paradigms

See also

References

<references/>

Further reading

External links