Programming language categories
Here, we can see four categories of programming languages. The two big categories are imperative and declarative. When programming in a declarative language, we tell the computer what we want. For example, in the following declarative code, we tell the computer that we want to find a Highlander
car.
A declarative example
The following is an example of declarative programming language:
car, err := myCars.Find("Highlander")
Contrast that with an imperative language with all code ceremony where we must construct a for
loop.
An imperative example
The following is an example of an imperative programming language:
func (cars *Cars) Find(model string) (*Car, error) { for _, car := range *cars { if car.Model == model { return &car, nil
} } return nil, errors.New("car not found") }
An OOP example
Object-oriented programs (OOP) consists of stateful objects that support object-related operations, called methods, whose implementation and internal structure...