programming languages1 programming paradigms families of programming languages
TRANSCRIPT
Programming languages 2
Objected programming
• Important language concepts– Classes and objects– Methods– Encapsulation
• Private and protected– Inheritance– Polymorphism
• Some languages– Java– C++– C#– Smalltalk
Programming languages 3
Declarative programming
• Important language concepts– You say what you want, not how to do it.– An interpreter executes your “wish”
• Some languages– SQL (Structured Query Language)
• A DBMS (Database Management System) executes your SQL query.
Programming languages 4
Structured programming
• Important language concepts– Procedures and functions– Selections statements
• If…else, switch, etc.– Looping statements
• While, for, etc.
• Remarks– Opposed to unstructured programming
• Lots of goto statements– Object-oriented programming languages has many elements
borrowed from structured programming• Some languages
– Pascal– C
Programming languages 5
Functional programming
• Important language concepts– Lists
• Programs are represented as lists
– Functions– Recursion
• Some languages– LISP– SML – Haskell
Programming languages 6
Logic programming
• Important language concepts– Saying “what” instead of “how”
• The inference machine knows “how”• Non-procedural
– Programmer state “facts”– Programmer asks “questions”
• Answered by the inference machine, using the facts
• Some languages – Prolog
Programming languages 7
Programming language development
• Programming languages are developed with inspiration from other programming languages.– Java was inspired by C++ and Smalltalk– C# was inspired by C++ and Java
• Some languages are single paradigm– Meant to be used within a single paradigm
• Some languages are multi paradigm– Meant to be used with 2 (or more) paradigms
Programming languages 8
Using programming languages outside the paradigm
• Many programming languages can be used with more than a single paradigm
• Example– Java can be used for
• Object-oriented programming• Structured programming
– Using only static constructs
• Using a programming language outside its natural paradigm is awkward and error-prone– Find a programming language which suits the
paradigm you like.
Programming languages 9
References
• Wikipedia– Programming Paradigm
http://en.wikipedia.org/wiki/Programming_paradigm
• Bruce J. MacLennan Principles of Programming Languages, Holt Rinehart and Winston