1 / 25

Programming Paradigms and Languages

Programming Paradigms and Languages. Introduction. What is a programming paradigm ?. A programming paradigm is a fundamental style of computer programming, a way of building the structure and elements of computer programs.

simpsonf
Télécharger la présentation

Programming Paradigms and Languages

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ProgrammingParadigms and Languages Introduction dr Robert Kowalczyk WMiIUŁ

  2. Whatis a programmingparadigm? A programming paradigm is a fundamental style of computer programming, a way of building the structure and elements of computer programs. There are two main programmingparadigms: imperativeprogramming and declarativeprogramming. source: www.wikipedia.com dr Robert Kowalczyk WMiI UŁ

  3. Definitions Imperative programming: telling the "machine” (computer) how to do something, and as a result what you want to happenwill happen. Declarative programming: telling the "machine” (computer) what you would like to happen, and let the computer figure out how to do it. dr Robert Kowalczyk WMiI UŁ

  4. Declarativevs. imperativeprogramming dr Robert Kowalczyk WMiI UŁ

  5. Imperativevs. declarativeprogramming - example We wish to double all the numbers in an array. Imperative style of programming: varnumbers = [1,2,3,4,5] vardoubled = [] for(var i = 0; i < numbers.length; i++) { varnewNumber = numbers[i] * 2 doubled.push(newNumber) } console.write(doubled) //=> [2,4,6,8,10] Declarative style of programming: var numbers = [1,2,3,4,5] var doubled = numbers.map(function(n) { return n * 2 }) console.log(doubled) //=> [2,4,6,8,10] dr Robert Kowalczyk WMiI UŁ

  6. Programminglanguages Imperative Declarative Structured Logical Functional SQL, XML Generic Object-oriented Concurrent Distribution of programmingparadygms Procedural dr Robert Kowalczyk WMiIUŁ

  7. Fourmainprogrammingparadyms Procedural/Structuredprogramming Object-orientedprogramming Functionalprogramming Logicalprogramming dr Robert Kowalczyk WMiIUŁ

  8. Procedural/structuredprogramming Proceduralprogrammingis a computer programming language thatorganises ourcodeinto small „programs" that use and change our datas. Structuredprogrammingis a programming paradigm recommending hierarchical division into blocks of code with one entry point and one or more exit points. In structured programming we use three main structures : - sequences (instruction _1; instruction _2;…; instruction _n), - choices (if, if...else, switch, case), - iterations (while, repeat, for). Keywords: variables, types, procedures and abstractdatas. Using: network systems, operating systems, etc. Procedural/structuredlanguages: • Fortran • Cobol • Pascal • C • C++ • others. dr Robert Kowalczyk WMiIUŁ

  9. Procedural/structuralprogramming - example dr Robert Kowalczyk, Katedra Analizy Nieliniowej, WMiI UŁ

  10. Object-orientedprogramming Object-orientedprogrammingis a programming paradigm in which programs are defined using objects - the state of the connecting elements (orfields) and behavior (or method). Object-oriented computer program is expressed as a set of such objects, which communicate with each other in order to perform tasks. Keywords: classes and objects, inheritance, encapsulation, polymorphism. Using: www and stand-aloneapplications. Object-orientedlanguages Simula, Smalltalk, C++, C#, Java, others. dr Robert Kowalczyk WMiI UŁ

  11. Obcject-orientedprogramming - example dr Robert Kowalczyk WMiI UŁ

  12. Functionalprogramming Functional programming is a programming paradigm in which the functions are the core values ​​and the emphasis is on valuation (often recursive) function, and not to execute commands. Theoretical basis for functional programming was developed in the 19330s of theTwentieth century by Alonzo Church's lambda calculus, called lambda calculus with types. Keywords: functions, lambda calculus, parametricpolymorphism. Using: theoretical, in telecommunications, infinancial calculations. Functionallanguages: Lisp, ML, Haskell, H#, Erlang others. dr Robert Kowalczyk WMiI UŁ

  13. Functionalprogramming - example dr Robert Kowalczyk WMiI UŁ

  14. Functionalprogramming - example dr Robert Kowalczyk, Katedra Analizy Nieliniowej, WMiI UŁ

  15. Logicalprogramming The paradigm of logic programming is a programming method in which the program is given as a set of relations, and the relationship between these dependencies. Keywords: facts, reports, queries. Using: theoretical, artificialintelligence. Logicallanguages: Gödel, Fril, Prolog, others. dr Robert Kowalczyk WMiI UŁ

  16. Logicalprogramming - example dr Robert Kowalczyk, Katedra Analizy Nieliniowej, WMiI UŁ

  17. Logicalprogramming - example dr Robert Kowalczyk, Katedra Analizy Nieliniowej, WMiI UŁ

  18. TIOBE – indexpopularity of programminglanguages źródło: www.tiobe.com dr Robert Kowalczyk, Katedra Analizy Nieliniowej, WMiI UŁ

  19. ProgrammingParadigms • Introductionthecourse (26-02-2019) dr Robert Kowalczyk WMiI UŁ

  20. Haskell (schedule) • Introducing to Haskell(me) • Types and Typeclasses + Syntax in Functions(Adam - Andrii) • Recursion(Manuel - Nageshwar) • Higher order functions and modules(Sofiane - Joanna) • Input/Output(Ayaz-Smith) • RevisionHaskelllanguage(student) • We refer thesechaptersfromthe bookLearn You a Haskell for Great Good! By Miron Lipovaca dr Robert Kowalczyk WMiI UŁ

  21. Prolog (schedule) • Introducing to Prolog (me) • Tutorial Introduction and A Closer Look(Nageshwarsingh ) • Using Data Structures(JovanKanevche) • Backtracking and the ”Cut”(ManojJayakumar) • Input and Output and Built-in Predicates (Ines San Luis ) • Revision Prolog language(RubenMourino, GurcanKaynak) • We refer thechapters of the bookProgramming in Prolog by William Clocksin, Christopher S. Mellish dr Robert Kowalczyk WMiI UŁ

  22. Exam • Exam – term 0 dr Robert Kowalczyk WMiI UŁ

  23. How to get course credit • To pass theclass: 2 tests (Haskell+Prolog) • To pass thelecture: Exam = 15 closequestions and 4 openquestions + lecture dr Robert Kowalczyk WMiI UŁ

  24. Literature • Learn You a Haskell for Great Good!by Miron Lipovaca • Programming in Prologby William Clocksin, Christopher S. Mellish • Any wwwsites and booksdedicated to Haskell and Prolog languages dr Robert Kowalczyk WMiI UŁ

  25. Any Questions?  dr Robert Kowalczyk WMiI UŁ

More Related