Objectoriented Versus Other Programming Paradigms

The most common ways to approach modeling of a software problem are the following: From an algorithmic perspective and from an object-oriented perspective.

The first approach is represented by structured programming, known nowadays as traditional programming. Structured programming is characterized by the use of the top-down approach in design and software construction. According to this paradigm every system is characterized, at the most abstract level, by its main function [Mey88]. Later, through an iterative process, the top function is decomposed into simpler tasks until the level of abstraction provided by a programming language is reached. Each of the steps of the iteration can be considered as a transformation process of the input task into a more suitable one required by the next iteration step. The main building block is the function or procedures. The expected behavior of a system is represented by a set of functions or procedures.

Data flow diagrams are used to represent a functional decomposition. A data flow diagram can be considered as a graph, with nodes representing the data transformations that occur at each step of the iteration. Structural programming is data-centric; functional components are closely related and dependent to the selected data structure. Therefore, changes to the data representation or the structure of the algorithm used may have unpredictable results. The entire data model needs to be considered when designing functionalities for the system. Changes to the data structure or to procedures, usually affect the entire system.

As data are the center of the traditional programming approach, the analysis and design phases of software construction deal with what is referred to as the data model. A data model is conceived as a flat structure, viewed from above. Data are distributed into tables and relationships between data are represented by relationships between tables. Relationships are implicit, using the foreign keys. Two tables are related among them if both have at the least a field in common, that contains the same type of data. Therefore, relationships in a data model are bidirectional.

The reasons why the structured programming approach is not a well-suited approach for software development has been widely discussed in the software engineering literature [Mey88], [B0086], to name a few. Although the list of disadvantages of using the structured programming paradigm is rather long, we would like to point out one particular handicap of this approach that has important consequences in modeling agricultural systems: Its lack of support for concurrency. There are many agricultural systems that coexist and interchange information between them. Intercropping, one of most relevant examples that use concurrency, is the process when two or more crops share the same natural resources (i.e., water, soil, and weather). In order to simulate the growth of one of the crops, other participating crops must be considered at the same time, as they compete for the same resources.

It is difficult to develop a software system that allows for concurrency using traditional programming languages such as FORTRAN. Complex and difficult-to-use data structures need to be created to allow for developing an intercropping system. The number of crops simultaneously used by the system has to be known in advance to be adequately represented in the data structures. Furthermore, transforming an existing system that does not allow intercropping into a system that allows for it would certainly require the reexamination of the entire existing system.

The software industry has embraced, for more than a decade, a more revolutionary approach to software development, the object-oriented paradigm. [Mey88] defines the object-oriented software construction as: Object-oriented construction is the software development method which bases the architecture of any software system on modules deduced from the types of objects it manipulates (rather than the function or functions that the system is intended to ensure). The modularity in the object-oriented approach is the class.

The focus of this new programming paradigm is the class that directly represents concepts (abstract or concrete) of a particular domain to which the software applies. Objects created from classes are the best way to mimic reallife problems; an object can represent an abstract concept, such as a photosynthesis process or a real concept such as plant, soil, or weather. Objects are provided with data and behavior and interact with each other. Functionality is achieved through dialog amongst objects. The dialog between objects is represented by relationships. Two objects are related if they need to access data and behavior from the other object. Relationships between objects are represented by object diagrams in an object model The activity of describing relationships between objects in a problem domain is referred to as object modeling.

The power of the object-oriented approach as modeling tool is the subject of the following chapters of this book.

Chapter 2

0 0

Post a comment