Demystifying Design Pattern in a Functional Way
As functional programming is taking pace in current software development. There is always a question what is the difference and why on the earth I should bother about it.
Most of the time reason of the question comes because of human nature of resistance towards learning new things. And then there are people who can easily learn new things but even for them unlearning something and re-learning new things is pretty tough. And this makes a problem every time.
Here I am not saying I am going to explain anything as expert. I am no where near expert and I also faces same problems as above. But I guess new things are always worth trying.
Now one the things that get projected as silver bullet for every software solutions is Design Patterns. Now for the facts they are good, very good. May be best thing that can happen to Object Oriented Programming. But it is showing a concept and most of the time we loose that concept in an implementation.
If we go into history, there are two ways of solving problem one is Turing way (OOP) and other is Church way (FP). That is it. They both are ways and you can achieve goals both ways.
Now here comes the personal choice what way you like to choose based on given circumstances. Turing way is good when I have limited resources to process details/data. While Church way is good when I have good number of resources to process details/data.
For me or I guess for all the people from functional programming community Church ways is a choice. And visible benefit of selecting that is readability and representation of code I am doing. It is more like what I am saying is I am writing. And now it is up to computer to process that. Now, computer need to be that powerful to process almost natural language.
I am not considering natural / logic language here. It is out of scope of this article, blog and also my brain for now.
And that is reason it is getting pace now a days. We are having hardware resources to process that. Or may be we can say on reverse way that to utilize this much hardware church based approach is far better. As it is having benefit towards making things simple.
Now, here comes the problem. I need to unlearn or relearn the concepts I have learn. And I have made it easy for me after working so hard.
Practically speaking I don’t see any way out. But there is no need to completely unlearn it but may be can be used in some other way. Like the Design Pattern from Object Oriented world.
I guess that was easy and simple both. Everything is just a functions. Ok, that is said I am sharing a video everyone in functional programming just loves from Scott Wlaschin
Now, in coming post I will try to take every pattern one by one and try to demystify it. Obviously in a functional way. And also try to explore some functional patterns also. Stay tuned.