Book contents
- Frontmatter
- Contents
- Source Code Listings
- Preface
- 1 Introduction
- 2 General Principles
- 3 Formatting Conventions
- 4 Naming Conventions
- 5 Documentation Conventions
- 6 Programming Principles
- 7 Programming Conventions
- 8 Input and Output
- 9 Packaging Conventions
- 10 Generic Programming
- 11 Object Orientation
- 12 Parallel Processing
- 13 Numerical Types, Kinds, and Operations
- 14 C Interoperability
- 15 Updating Old Programs
- A Source Code
- B Rule List
- Bibliography
- Index
11 - Object Orientation
Published online by Cambridge University Press: 05 December 2011
- Frontmatter
- Contents
- Source Code Listings
- Preface
- 1 Introduction
- 2 General Principles
- 3 Formatting Conventions
- 4 Naming Conventions
- 5 Documentation Conventions
- 6 Programming Principles
- 7 Programming Conventions
- 8 Input and Output
- 9 Packaging Conventions
- 10 Generic Programming
- 11 Object Orientation
- 12 Parallel Processing
- 13 Numerical Types, Kinds, and Operations
- 14 C Interoperability
- 15 Updating Old Programs
- A Source Code
- B Rule List
- Bibliography
- Index
Summary
Until the advent of modern Fortran, the language could be classified as a strictly procedural one, built from subroutines and functions. A procedural program could be thought of as a series of calls to these procedures in which the desired computations are performed. Object-oriented programming, on the other hand, can be thought of as the interaction of independent entities, whereby the computations are carried out by means of messages sent and received by procedures (methods) bound to the entities (see Reference [8]).
Object-oriented programming (OOP) is a paradigm for programming that emphasizes the construction of objects that group related data. The objects are grouped with associated procedures and placed into a program unit, the module beginning with Fortran 90. Fortran 90 provided a limited capability for OOP, often referred to as “object-based” programming. Fortran 2003 provides the additional features that allow a programmer to program using object-oriented techniques. Some of the key features of OOP are (a) entities are constructed as objects. All objects are “instances” of what is commonly referred to as a “class,” which Fortran 90 introduced as “derived types.” These types define templates for the type data and its procedures. The placing of data in derived types is called “encapsulation.” (b) The procedures are referred to as “methods.” Execution of a program is carried out by objects communicating with each other by invoking the methods of other objects. This process is called “sending and receiving messages.”
- Type
- Chapter
- Information
- Modern FortranStyle and Usage, pp. 183 - 215Publisher: Cambridge University PressPrint publication year: 2011