Programming paradigms
Styles of programming: imperative, object-oriented, functional and logic.
Edited by Alex C, EduAlx · Sources cited below
Explanation
Imperative/procedural (FORTRAN, Backus 1957; C, Ritchie 1972) changes state step by step. Object-oriented (Simula 67, Smalltalk by Kay; C++, Java, Python) bundles data and behaviour. Functional (Lisp by McCarthy 1958; Haskell) uses pure functions and immutability. Logic (Prolog) states facts and rules. Hopper's work led to COBOL and compilers.
Example
Code
class Account:
def __init__(self, owner, balance=0):
self.owner, self.balance = owner, balance
def deposit(self, amt):
self.balance += amt
return self.balance
How it works, step by step
- Pick a model of computation
- Express problems in its terms
- Use language features (classes, closures, rules)
- Combine paradigms where helpful
Open the interactive page with diagrams →
People behind it
- John Backus
- John McCarthy (1927–2011), Artificial intelligence, USA: Coined 'artificial intelligence' (1955), created Lisp and time-sharing ideas. Turing Award 1971.
- Grace Hopper (1906–1992), Computer science, USA: US Navy rear admiral; built the first compiler (A-0) and influenced COBOL.
- Alan Kay
- Dennis Ritchie (1941–2011), Computer science, USA: Created the C language and co-created Unix at Bell Labs. Turing Award 1983.
- Bjarne Stroustrup
References
- J. McCarthy, Commun. ACM 1960, 3, 184–195.
- O.-J. Dahl, K. Nygaard, Commun. ACM 1966, 9, 671–678.
Textbooks
- Structure and Interpretation of Computer Programs, Harold Abelson, Gerald Jay Sussman (MIT Press, 2nd ed. 1996). Classic on programming and abstraction.
- The C Programming Language, Brian W. Kernighan, Dennis M. Ritchie (Prentice Hall, 2nd ed. 1988). 'K&R', the definitive C book.
Related topics
CompilersPublic-key cryptography (Diffie–Hellman, RSA)Machine learningInformation theory and entropyNeural networks and backpropagationWorld Wide Web, HTTP and HTMLTransformers and large language modelsComputer networks and the TCP/IP modelArtificial intelligence: search and the Turing testRelational databases and SQL