Download Programming paradigms

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts
no text concepts found
Transcript
Programming paradigms
Families of programming
languages
Programming languages
1
Objected programming
• Important language concepts
– Classes and objects
– Methods
– Encapsulation
• Private and protected
– Inheritance
– Polymorphism
• Some languages
–
–
–
–
Java
C++
C#
Smalltalk
Programming languages
2
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
3
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
4
Functional programming
• Important language concepts
– Lists
• Programs are represented as lists
– Functions
– Recursion
• Some languages
– LISP
– SML
– Haskell
Programming languages
5
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
6
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
7
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
8
References
• Wikipedia
– Programming Paradigm
http://en.wikipedia.org/wiki/Programming_par
adigm
• Bruce J. MacLennan Principles of
Programming Languages, Holt Rinehart
and Winston
Programming languages
9
Related documents