Danh mục

Lập trình Fortran 90 và hướng đối tượng

Số trang: 46      Loại file: pdf      Dung lượng: 598.13 KB      Lượt xem: 16      Lượt tải: 0    
Thư viện của tui

Xem trước 5 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Tài liệu giới thiệu về ngôn ngữ Fortran, cú pháp cùng các khả năng của Fortran 90, so sánh các đặc tính tiêu biểu với C++, F77, và Matlab.
Nội dung trích xuất từ tài liệu:
Lập trình Fortran 90 và hướng đối tượng 1Fortran 90 OverviewJ.E. Akin, Copyright 1998 This overview of Fortran 90 (F90) features is presented as a series of tables that illustrate the syntaxand abilities of F90. Frequently comparisons are made to similar features in the C++ and F77 languagesand to the Matlab environment. These tables show that F90 has significant improvements over F77 and matches or exceeds newersoftware capabilities found in C++ and Matlab for dynamic memory management, user defined datastructures, matrix operations, operator definition and overloading, intrinsics for vector and parallel pro-cessors and the basic requirements for object-oriented programming. They are intended to serve as a condensed quick reference guide for programming in F90 and forunderstanding programs developed by others. Object Oriented Programming via Fortran 90 (Preprint: Engineering Computations, v. 16, n. 1, pp. 26-48, 1999) J. E. Akin Rice University, MEMS Dept. Houston, TX 77005-1892 Keywords object-oriented, encapsulation, inheritance, polymorphism, Fortran 90 Abstract There is a widely available object-oriented (OO) programming language that is usually overlooked in the OO Analysis, OO Design, OO Programming literature. It was designed with most of the features of languages like C++, Eiffel, and Smalltalk. It has extensive and efficient numerical abilities including concise array and matrix handling, like Matlab®. In addition, it is readily extended to massively parallel machines and is backed by an international ISO and ANSI standard. The language is Fortran 90 (and Fortran 95). When the explosion of books and articles on OOP began appearing in the early 1990s many of them correctly disparaged Fortran 77 (F77) for its lack of object oriented abilities and data structures. However, then and now many authors fail to realize that the then new Fortran 90 (F90) standard established a well planned object oriented programming language while maintaining a full backward compatibility with the old F77 standard. F90 offers strong typing, encapsulation, inheritance, multiple inheritance, polymorphism, and other features important to object oriented programming. This paper will illustrate several of these features that are important to engineering computation using OOP.1. Introduction The use of Object Oriented (OO) design and Object Oriented Programming (OOP) is becoming increasingly popular (Coad, 1991; Filho, 1991; Rumbaugh, 1991), and today there are more than 100 OO languages. Thus, it is useful to have an introductory understanding of OOP and some of the programming features of OO languages. You can develop OO software in any high level language, like C or Pascal. However, newer languages such as Ada, C++, and F90 have enhanced features that make OOP much more natural, practical, and maintainable. C++ appeared before F90 and currently, is probably the most popular OOP language, yet F90 was clearly designed to have almost all of the abilities of C++ (Adams, 1992; Barton, 1994). However, rather than study the new standards many authors simply refer to the two decades old F77 standard and declare that Fortran can not be used for OOP. Here we will try to overcome that misinformed point of view.Copyright © 1999, 2000 J. E. Akin. All rights reserved. Page 1 of 23 Object Oriented Programming via Fortran 90 Modern OO languages provide the programmer with three capabilities that improve and simplify the design of such programs: encapsulation, inheritance, and polymorphism (or generic functionality). Related topics involve objects, classes, and data hiding. An object combines various classical data types into a set that defines a new variable type, or structure. A class unifies the new entity types and supporting data that represents its status with subprograms (functions and subroutines) that access and/or modify those data. Every object created from a class, by providing the necessary data, is called an instance of the class. In older languages like C and F77, the data and functions are separate entities. An OO language provides a way to couple or encapsulate the data and its functions into a unified entity. This is a more natural wa ...

Tài liệu được xem nhiều: