PROJECT 2

CS 441

November 18, 2002

Group Members:

Hibo Musse Rabile
Jeffrey Shoemaker
Javan Sanjay Teixeira
Karina Terreros

Project 2 – Analyze Simple Procedural

History & Overview – Simple Procedural

FORTRAN is a language more suited for scientific purposes or mathematics. FORTRAN was a significant step towards all the programming languages we have today. Simple procedural languages first came to be in 1957 with FORTRAN, developed for scientific applications (numerical computing). FORTRAN designed by IBM for use on the IBM 704 systems.

FORTRAN (Formula Translator) was developed in 1957 by John Backus at IBM to be used on the IBM704 for the development of scientific applications. Simple procedural languages were the first set of languages designed to allow programming at a higher level of abstraction than that of assembly languages. Initially, they were developed for use exclusively on systems with specific hardware configurations, but later were developed to be used on a multitude of platforms.

In the mid 1970's, Niklaus Wirth was experimenting with concurrency, which led to the design of Modula. Modula was never released and its development was discontinued after its publication. Block Structured, procedural languages were first introduced in the 1970's. Wirth then built a language that was meant to be the single language for the new computer system called Lilith. Even though the computer was never a success, his new language Modula-2 was released in 1980.

The main aspect of simple procedural programming languages is the blocks. Every program written in a procedural programming languages must obey to the format of a main program and subprograms. In addition, some of the features of the procedural language are the use of block structure, passing of parameters by value and name, recursion, and stack-dynamic arrays. These are functions that have been adopted by several other languages and language families. Simple procedural languages have been mainly used for scientific computations and business purposes.

Simple Procedural Languages were used for mathematics, by researchers, and by mathematicians. FORTRAN utilized the IBM 704’s floating-point hardware, which increased the speed of these operations dramatically.

Both simple procedural and block structured procedural languages have a similar block structure - a main program and subprograms. The Simple Procedural Block Structured Languages began with Pascal. The Simple Procedural Languages, were popular due to run-time efficiency. Call-by-name parameters used by the Simple Procedural Languages were hard to implement, there was no input-output statement, since those were considered "implementation dependent" at the time, and own static storage was also difficult to implement. In addition, more modern practices like data types and structured programming were developing during the 1960s.

History & Overview – Block Structured, Procedural

Block structured, procedural languages were an extension of simple procedural languages. Whereas simple procedural languages were originally designed in the 1950's for scientific and business-based applications, block structured languages, such as Pascal, were developed later and used for programming in education and related areas. In 1971, Nicklaus Wirth combined the tools from the most powerful languages of the time and combined them to create Pascal, which was primarily a modified version of ALGOL 60. Wirth created this language with the intent of providing a language that was easy to teach and practical for writing system and application programs. His objective was to take some of the fundamental programming concepts that would be suitable for teaching programming and that would also be capable of efficient implementation on most computers. The block-structured class of languages perpetuated the rise of sub-programs.

Simple procedural languages were developed earlier than block-structured languages and therefore took into consideration slow computers, high cost, and unreliable existing languages. Block structured procedural languages; however, were developed in the environment of existing, proven, high-level languages such as FORTRAN. This provided for more power and flexibility in developing the languages because of advancements in technology.

Modula have been extensively used in the area of teaching computer science and programming. Modula-2 corrects many of the deficiencies in Pascal and adds important new features, yet remains small, compact, and teachable. It is suitable for disciplined production of large projects, real time programming, and general-purpose work. In its ISO standard version, it has exceptions, termination, complex number types, standardized libraries, and object oriented and generic programming facilities.

Object-based programming languages came much later than the earliest Simple Procedural languages. They were developed to exploit the object-based/object-oriented paradigm. Wirth later invented the MODULA series of programming languages, the next step in block-structured languages. Modula-2 emerged from careful design deliberations as a language that includes all aspects of Pascal and extends them with the important module concept and those of multiprogramming. Since its syntax was more in line with that of Modula than with Pascal's, the chosen name was Modula-2.

Programmers had new tools like libraries of functions, powerful operators, and an elegant syntax to control hardware. As the use of computers increased worldwide the demand for easier coding became inevitable and thus Object based Programming was developed. In the Simple Procedural Languages, activationrecords and scope rules are minimal, and run-time descriptors for structured data are not necessary.

Handling data objects - Simple Procedural and Block Structured, Procedural

Objects that are used in these languages are a representation of the data that a program tries to process and manipulate, whereas the concept used to focus on logic verses objects. Now just to point out, the data types defined within FORTRAN are real, integers, complex, logical, and characters, whereas in Modula the types are integers, real, characters, Boolean, pointers, arrays, and records. The data objects are utilized as records, which are like simple structs in the language of C/C++. Again with FORTRAN, the data objects are defined as either an array or a character string and are generated by subprograms and are useful when a temporary array or character string is utilized. When the execution of the subprogram completes the automatic data object is therefore discarded. One big feature that FORTRAN does have is that it has the ability to include dynamic data objects, which include pointers, arrays that can be allocated and automatic data objects.

Lastly, of all the languages that are being utilized today, FORTRAN continues to adapt to the ever-changing programming world and thus has remained in use when many other languages have either failed or been obsoleted. The overall trend towards object-orientation has forced a change in that some languages just could not survive. FORTRAN however seems to still be going strong and new adaptations are still underway. But with Modula, the versatility that it has, just has not kept up with the growth of programming.

Handling of sequence control - Simple Procedural and Block Structured, Procedural

Sequence Control can be defined as basically the order of statements in a language that is being executed, or in other words, it tells us how a program flows from one statement to the next. FORTRAN follows a very basic program flow, where the code is very sequential all the way down, unless altered by the some sort of Control. These controls are grouped into three categories: Expression, Statements, and Subprograms.

Now with Modula, it is considered to be a structured procedural language. With this type of language, it operates in a little different fashion. It executes in separately defined program modules where each module is broken down into smaller executable procedures. Then the sequence of control will move down a module block to a procedure sub-block through the program execution. Modula language does not utilize any kind of ‘GOTO’ branching statements. Basically the modules just make calls between their selves and then return control back over to the module that called them after the module gets through with its execution. Then control is then turned back over to the operating system once all the modules have completed.

Handling subprograms/storage management - Simple Procedural and Block Structured, Procedural

** This was to be done by Hibo Musse Rabile, but was not submitted. **

Handling subprograms/storage management - Simple Procedural and Block Structured, Procedural

Subprograms are the fundamental building blocks of programs and are therefore among the most important concepts in a programming language design.

In this area, Simple Procedural (e.g. FORTRAN) and Block Structured, Procedural (e.g. MODULA), have some main similarities. For instance Simple Procedural normally has two types of subprograms. For example in FORTRAN there are Internal subprograms and External Subprograms. Internal subprograms appear within the main program. External Subprograms appear in a separate program section after the main program END statement.

Block Structured Procedural also has two types of subprograms, called procedures and functions. But here both of these are written before the main program.

For Simple Procedural languages subprograms can call other subprograms, but a subprogram can’t call itself directly or indirectly, therefore no recursive calling. Recently though, some modern compilers allow the recursive calling. But in the Block Structured Procedural language group there are no limitations as to which functions in the program can call which other functions.

Although many programming languages allow dynamic memory allocation, Simple Procedural languages like FORTRAN contain the inability to dynamically allocate storage. The programmer must foresee the maximum size the user might want.

This is very different for a Block Structured, Procedural language that boasts both static and dynamic allocation.

Handling abstraction/encapsulation - Simple Procedural and Block Structured, Procedural

An abstraction is a view or representation of an entity that includes only the attributes of significance in a particular context. An encapsulation is a grouping of subprograms and the data they manipulate.

Block Structured Procedural languages provide several levels of abstraction and encapsulation. This group of languages fall in the range from almost fully object-oriented down to some examples that have very few of these capabilities. Most of its languages provide some sort of capability for encapsulation, since encapsulation is a necessary component of data abstraction. This is because one of its goals is to include support for data abstraction

In terms of Abstraction, a Simple Procedural language allows the user to define new data types derived from any combination of inherent and derived types. The derived type can be accessed directly, whether accessed as a whole or in individual components. This language group presents the idea of collectively introducing various data types, while granting the freedom to address them as one. It also provides a protection for the data types by incorporation private and public definitions.

Block Structured Procedural languages also provide this type protection and also allow for encapsulation by incorporating separate compilation units in the form of a class and header files.

In terms of Simple Procedural languages, encapsulation is closely aligned with data hiding.

History & Overview - Object Based

The Object-Based languages came much later than the earliest Simple Procedural languages. They were developed to exploit the object-based/object-oriented paradigm. The need for an object-based language arose from the need for reuse and need for software to run large and complex systems on many different platforms. Object Oriented Programming is relatively a new development compared to simple procedural languages and for now, seems to be the most popular. Object based programs are best used when the programmer needs to create their own data type.

Smalltalk is an object based programming language. Smalltalk arose from the language SIMULA 67.In the 1970's researchers at Xerox PARC were exploring ways to make programming accessible to anyone interested in using a computer to solve their problems. This led to the invention of Smalltalk, the first true object-oriented programming language with tools that could assist the user in developing applications with graphical user interfaces. This technology became the model for the Macintosh and Windows user. Smalltalk is a general purpose, high level programming language. It was the first original "pure" object oriented language, but not the first to use the object oriented concept.

Behind the thought of Smalltalk was the idea that the individual human user should be the most important component of any computing system, and that programming should be a natural extension of thinking, and also a dynamic and evolutionary process consistent with the model of human learning activity. In Smalltalk, these ideas are embodied in a framework for human-computer communication.

Smalltalk's most powerful feature is easy code reuse. Smalltalk makes reuse of programs, routines, and subroutines (methods) far easier. Though procedural languages allow reuse too, it is harder to do, and much easier to cheat. The most essential part of support for object-oriented programming is the class/object mechanism, which originated in SIMULA 67 and is the central feature of Smalltalk.

Handling data objects - Object Based

Smalltalk is considered to be an object-based language whereas it is based or built around classes/data structures. Now as far as the types go, Smalltalk differs from the language of FORTRAN as was stated above. What this means is that it is basically typeless, which means that most all the code is effectively generic. Smalltalk is a very easy language as far as usability and the code is mostly composed of chains of messages sent to objects. With that being said, it is completely based on an object-oriented concept and cleanly supports the notion of classes, methods, messages and inheritance. Smalltalk further offers numbers, characters, strings, symbols, arrays, classes and objects as basic primitives in their inheritance. But with the messages, they are always dynamically bound to methods, and thus the farther away in the inheritance hierarchy the correct method is, the longer it takes for it to complete.

Then another language related is Simula. This language contains all the common facilities of high level third generation language, but each of its data types provides a range of values and operations that can be performed on them. Simula classes are made of parameters, attributes and methods. These types are considered to be heap-dynamic, meaning that they are created dynamically on the heap at the request of the user program. Although Simula’s classes are far less reliable than a true abstract data type, thus is not the most widely used concept.

Handling of sequence control - Object Based

Simula provides sequence selection with a typical ‘if-then-else’ statement. The ‘else-if’ statement is also used in Simula as a control sequence similar to the C++ except there is an ‘end’ statement at the end to terminate the control structure. Another control structure that may be utilized is the ‘while-do’ that usually contains a compound structure. As with the C++ language uses the ‘case’ statement, Simula uses the ‘inspect’ statement followed by an ‘end’ to terminate the structure. This type of statement is used to when there are multiple choices that are possible verses uses a series of nested ‘if-then’ statements. The general control structure of Simula is a very easy to follow code.