Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Programming Paradigms

Programming Paradigms

The best software engineers are those who are not locked into a particular toolset, or the ecosystem thereof. This is one of my first presentations; an opinionated take on the different programming paradigms and the frameworks which implement them.

Igbanam

July 20, 2017
Tweet

More Decks by Igbanam

Other Decks in Programming

Transcript

  1. Name: Kayode Adeniyi Role: Software Developer Online: @kay on Slack

    @codekayy on Twitter @kayodeniyi on Medium @andela-kadeniyi on Github
  2. Programming Paradigms What are they? • A model • A

    way of doing things • Something which enables progress • Something to rally around • Basically belief backed
  3. List of Programming Paradigms …more will be created over time

    • Object-Oriented (Class-based) • Object-Oriented (Prototype-based) • Functional (Lambda) • Functional (Applicative) • Declarative • Imperative • Aspect-Oriented • Event Driven • Constraint • Logic • Flow Driven • Reflective • Symbolic • Procedural
  4. Object-Oriented (OOP) This paradigm allows objects to interact with one

    another so as to simulate a set of real world phenomena. The four major principles of object orientation: • Encapsulation • Data Abstraction • Inheritance • Polymorphism OOP is about encapsulating mutable state
  5. Functional • Bound immutable states • Functions are first class

    citizens • Purity. No side-effects. • Expression-based syntax • Applicative vs. Lambda
  6. Declarative • Programming for the programmer as instead of operations

    for the machine • Written by declaring how things should be. • Expresses the logic of a computation without defining or describing its control flow • Programming on an abstraction
  7. Imperative Programming • Programmer is focused on the order of

    operations. • There is state littered everywhere; mainly global state • Computer runs the instructions in the order it sees them • …comes from Latin’s impero ~ English’s emperor
  8. Aspect-Oriented • Aims to increase modularity by allowing the separation

    of crosscutting concerns. For example “log all function calls when the function's name begins with 'set'”
  9. Event-Driven • Flow of program execution is determined by events

    • Involves programming with emitters and listeners of asynchronous actions
  10. Constraint • Relations between variables are stated in the form

    of constraints • Do not specify a step or sequence of steps to execute • Concerned about the properties of a solution to be found.
  11. Logic • Based on logic • Represented by a set

    of facts and a set of axioms • The axioms and clauses may have arguments For example, one could define the relation consumes(A, B), meaning that A consumes B. One could then establish a set of facts [stored in a database], and query these facts for truth. Example of facts database food(rice). food(beans). fuel(firewood). food(gasoline). consumes(human, rice). consumes(car, gasoline). consumes(human, beans). /* What consumes gasoline? */ ?- consumes(What, gasoline). What = car.
  12. Flow Driven • Programming processes communicating with each other over

    predefined channels. • Concerned with data-flow • Each application is a self-sufficient component which receives messages (input) and performs some transformation NoFlo Analog Clock in Javascript
  13. Reflective • Code can read and modify itself • Metaprogramming

    • Changing behaviour on-the-go • Adaptive Systems
  14. Imperative • Everything step by step • Respect the order

    of the commands • Remember state somehow Functional • Mutable state is dangerous • Computation. Mathematics. Functions. Pure functions. Declarative • See my facts • This is what I want • Figure it out, computer! Baseline Irreducible Paradigms All others are derived from these
  15. Multiple Paradigms • Be open to shifts • Programming paradigms

    matter • Paradigms prescribe programming; and vice versa • Paradigms are more similar than they are different
  16. Resources • Programming Paradigm <> https://en.wikipedia.org/wiki/Programming_paradigm • LMU <> http://cs.lmu.edu/~ray/notes/paradigms/

    • AAU <> http://people.cs.aau.dk/~normark/prog3-03/html/notes/paradigms.html • Birmingham <> http://www.cs.bham.ac.uk/research/projects/poplog/paradigms_lectures/lecture1.html • Discussion on StackExchange <> https://softwareengineering.stackexchange.com/questions/117119/learning-each-type-of-programming-language • UToronto <> http://www.eecg.toronto.edu/~jzhu/csc326/csc326.html • Eudonix <> https://www.eduonix.com/blog/web-programming-tutorials/learn-event-driven-programming-node-js/ • METU <> http://ocw.metu.edu.tr/pluginfile.php/2986/mod_resource/content/0/lectures/14-lp-paradigm.pdf • Faculdade de Ciencias <> https://www.dcc.fc.up.pt/~ines/talks/clp-v1.pdf