User:Engineer-1024/Sample page
Overview
[edit]The FOO (Function-Oriented with Objects) programming methodology uses particular kinds of objects. The FOO approach was codified by Gregory McPherran in 2024. [1]
Background
[edit]From the 1950s to 1970s, programming languages evolved thusly:
CPL -> BCPL-> B -> C -> C++, then Java (1990s) and C# (2000s )[2]
In the mid 20th century, "object" was a general term and often referred to a computer language data entity. Here we see the term "object" in the BCPL language manual: "variety of different kinds of objects such as integers, truth values, vectors or functions." Note that here, a function is called an "object". [3]
The development of what we today call "object-oriented" languages mainly started with Simula in the late 60s. [4]
C++ is a language that supports object-oriented programming and uses a "this" pointer (for non-static class members). [5]
FOO
[edit][6] The essence of FOO is avoidance of coupling data sets with function sets in the way that C++ does. Use of the "this" pointer is considered to be a core cause of inflexibility of class data and functions (brittleness, including inheritance). In FOO, the class code format is viewed as reducing clarity, pattern visibility, and productivity.
FOO Ideas (proposals):
Data models are generally useful beyond the role given them by a small set of functions. Thus FOO eliminates use of the "this" pointer, such that data can be separated from the class. Then, data models and functions can be mixed and matched freely. This broad flexibility applies to data composition, data as function arguments, and functions with other functions. Importantly, you can still control access by any function to any _instance_ of a data model / struct (see below).
In FOO interfaces with no data are allowed. Interfaces, functions that accept functions (and lambdas) as arguments, and data composition, are elements of polymorphism and abstraction in FOO.
With regards to data protections as compared to class-based OO, FOO protects data using: a.) Stack-resident data and data pointers that are only visible to the main() and other top-level thread functions, b.) Syntax e.g. "mutable" and "const" and c.) Language scoping mechanisms.
Reference section
[edit]- ^ "FOO Source Article (see "Use FOO")".
- ^ "History of programming languages", Wikipedia, 2024-06-19, retrieved 2024-06-23
- ^ "BCPL Manual" (PDF).
- ^ "Simula", Wikipedia, 2024-02-12, retrieved 2024-06-23
- ^ "The this pointer - cppreference.com". en.cppreference.com. Retrieved 2024-06-23.
- ^ "FOO Source Article (see "Use FOO")".