2.2 - 2.15
2.2
pseudocode
In the late 1940s and early 1950s, computers were slow, unreliable, and difficult to program because there were no high-level programming languages like today. Instead, programmers had to use machine code, which was tedious and error-prone. Machine code used numeric codes for instructions, making programs hard to read, and modifying them was difficult due to absolute addressing.
To address these issues, "pseudocodes" were developed as somewhat higher-level languages. One example is Short Code, developed by John Mauchly in 1949. Short Code used coded versions of mathematical expressions, making programming simpler, but it was slow compared to machine code.
Another example is Speedcoding, developed by John Backus for the IBM 701. Speedcoding extended machine languages to include floating-point operations and made programming easier, but it was limited by memory constraints and execution speed.
Grace Hopper's team at UNIVAC developed "compiling" systems that expanded pseudocode into machine code subprograms. This made programming shorter and more manageable.
Around the same time, assembly languages, which are closer to modern programming languages, were also evolving but had little impact on high-level language design at that time.
2.4
Functional programming languages are a category of programming languages that treat computation as the evaluation of mathematical functions and avoid changing state and mutable data. Key characteristics of functional programming languages include:
1. **First-class functions:** Functions in functional languages are treated as first-class citizens, meaning they can be passed as arguments to other functions, returned as values from functions, and assigned to variables.
2. **Immutability:** Functional programming encourages immutability, meaning once a value is assigned, it cannot be changed. Instead of modifying existing data, functional programs create new data structures.
3. **Higher-order functions:** Functional languages support higher-order functions, which are functions that can take other functions as arguments or return functions as results.
4. **Recursion:** Recursion is often favored over iteration for repetitive tasks in functional programming. It allows for concise and expressive solutions to many problems.
5. **Pure functions:** Pure functions are functions that produce the same output for the same input and have no side effects. They don't modify external state or rely on external state, making them easier to reason about and test.
Examples of functional programming languages include:
- **LISP:** One of the earliest functional programming languages, known for its simplicity and flexibility.
- **Scheme:** A dialect of LISP, characterized by its minimalist design and emphasis on functional programming principles.
- **Haskell:** A purely functional programming language with strong static typing and lazy evaluation, meaning expressions are only evaluated when their results are needed.
- **ML (MetaLanguage):** A family of functional programming languages, including Standard ML and OCaml, known for their strong type systems and pattern matching capabilities.
- **F#:** A multi-paradigm language in the .NET ecosystem, combining functional programming with object-oriented and imperative programming features.
Functional programming languages offer benefits such as easier parallelism, improved code readability, and robust error handling. They are particularly well-suited for tasks involving data transformation, concurrency, and mathematical computations.
2.13 and 2.14
Functional programming languages, like Prolog and Haskell, focus on expressing computations as mathematical functions without mutable state or side effects. They emphasize the evaluation of expressions and the application of functions to arguments, rather than sequential instructions. In functional programming, functions are treated as first-class citizens, meaning they can be assigned to variables, passed as arguments to other functions, and returned as results from functions.
Prolog is a logic programming language where programs are composed of collections of statements in predicate calculus. Prolog programs describe relationships and rules rather than specifying a sequence of steps to achieve a result. The language uses a formal logic notation, primarily predicate calculus, to communicate computational processes to a computer. Prolog's inferencing technique, called resolution, is used to derive conclusions from logical statements.
On the other hand, Haskell is a purely functional programming language that incorporates concepts from lambda calculus. It features lazy evaluation, which means that expressions are not evaluated until their values are needed. Haskell allows programmers to write concise and expressive code using powerful abstractions like higher-order functions, pattern matching, and type inference.
While both Prolog and Haskell are examples of functional programming languages, they serve different purposes and have distinct design principles. Prolog is suited for solving problems using logical inference and symbolic computation, while Haskell is well-suited for general-purpose functional programming tasks, including algorithmic problem-solving, web development, and scientific computing.
2.15
Smalltalk is a programming language that is often credited as being the first to fully support object-oriented programming (OOP). Here's an overview of its design process, language features, and evaluation:
**Design Process:**
- Smalltalk's concepts originated from Alan Kay's Ph.D. dissertation work in the late 1960s at the University of Utah.
- Kay envisioned powerful desktop computers with highly interactive and sophisticated graphics interfaces.
- He joined Xerox Palo Alto Research Center (PARC) and formed the Learning Research Group, where Smalltalk was developed.
- The development of Smalltalk started with an "Interim" Dynabook, consisting of a Xerox Alto workstation and Smalltalk-72 software, which evolved into Smalltalk-80.
- Smalltalk-80 matched Kay's early vision of powerful desktop computers and highly interactive interfaces.
**Language Overview:**
- In Smalltalk, everything is an object, including integer constants and complex software systems.
- All computing in Smalltalk is done by sending messages to objects to invoke their methods.
- Object abstractions are represented as classes, similar to SIMULA 67.
- Smalltalk syntax differs from most other programming languages due to its emphasis on messages rather than traditional arithmetic and logic expressions.
- Smalltalk features graphical user interfaces and heavily promotes object-oriented programming methodologies.
**Evaluation:**
- Smalltalk has significantly influenced graphical user interfaces and object-oriented programming.
- It played a crucial role in the development of windowing systems and modern software design methodologies.
- While some ideas of object-oriented languages originated from SIMULA 67, they matured in Smalltalk, making its impact extensive and long-lasting.
Comments
Post a Comment