Functional And Dysfunctional Programming
Written by Mike James   
Thursday, 15 November 2018
Article Index
Functional And Dysfunctional Programming
State and Stateless
Monads

Perhaps the most notorious of all functional programming mechanisms for getting things done that are natural in dysfunctional languages is the monad.

To explain the subtleties of the monad would take another article, but what you really need to know is that the monad puts the sequence of operations idea back into functional programming. Monads provide the facilities to implement side effects, I/O, variable assignment and so on in a way that looks static - unless you look very carefully that is. 

So is all of this just magic for the dysfunctional programmer to worry about?

Well yes - and no.

It is sadly true that functional programmers have a tendency to use math - category theory in particular - to make simple ideas seem very much more sophisticated. 

You need to always keep in mind that programming is essentially practical and hence cannot be as complicated as abstract mathematics.

However there are times when functional programming just seems right. There is also no doubt that some of the tools of functional programming are hard to give up once you have experienced their advantages. 

For example, every programming language should have first class and higher functions - it just makes things so much simpler and so much more powerful. Every language should also have some of the handy toolkit of higher order functions that functional languages have - things like map, reduce, filter and so on, the sort of thing you find in say Ruby's functools.

When it comes to some types of computation then a functional approach does seem to work well but when it comes to needing side effects dysfunctional programming does the job. If you want to build a UI there is a lot to be said for object oriented procedural programming. 

Finally - should you learn a functional programming language?

Yes.

After all, what harm can it do and tail recursion would be your reward. 

 

 Functional

 

Banner

 

Related Articles

Programming Paradigms for Languages

Guide to F#

Why Do We Try To Make Programming Like Something Else?     

Crockford On Monads And Gonads       

What makes a programmer

A Better Way To Program

     

What Programmers Know

knowcover

Contents

  1. The Computer - What's The Big Idea?*
  2. The Memory Principle - Computer Memory and Pigeonholes*
  3. Principles of Execution - The CPU
  4. The Essence Of Programming
  5. Variables - Scope, Lifetime And More*
  6. Binary Arithmetic
  7. Hexadecimal*
  8. Binary - Negative Numbers
  9. Floating Point Numbers
  10. Inside the Computer - Addressing
  11. The Mod Function
  12. Recursion
  13. The Lost Art Of The Storage Mapping Function *
  14. Hashing - The Greatest Idea In Programming
  15. Advanced Hashing
  16. XOR - The Magic Swap
  17. Programmer's Introduction to XML
  18. From Data To Objects*
  19. What Exactly Is A First Class Function - And Why You Should Care*
  20. Stacks And Trees*
  21. The LIFO Stack - A Gentle Guide*
  22. Data Structures - Trees
  23. Inside Random Numbers
  24. The Monte Carlo Method
  25. Cache Memory And The Caching Principle
  26. Data Compression The Dictionary Way
  27. Dates Are Difficult*
  28. Sequential Storage*
  29. Magic of Merging*
  30. Power of Operators
  31. The Heart Of A Compiler*
  32. The Fundamentals of Pointers
  33. Functional And Dysfunctional Programming*

* Recently revised

pythondata

 



 

Comments




or email your comment to: comments@i-programmer.info

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Prime Numbers And Primality Testing

Testing to see if a number is a prime or not is the basis of many encryption and security methods. It has long been assumed that there is no fast way, i.e no polynomial time method, to determine if a  [ ... ]



Advanced Hashing

Hashing is arguably one of the great ideas of computing and it has hidden depths. Extensible hashing and perfect hashing are ideas that are worth exploring.


Other Articles



Last Updated ( Monday, 26 November 2018 )