Skip to content

Instantly share code, notes, and snippets.

@tamizhvendan
Created March 17, 2018 06:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tamizhvendan/371a610e2884520a49637bfe22298d36 to your computer and use it in GitHub Desktop.
Save tamizhvendan/371a610e2884520a49637bfe22298d36 to your computer and use it in GitHub Desktop.
Adopting Functional Programming - Lightening Talk (Chennai Geeks)

Hi,

I am Tamizhvendan, a budding entrepreneur. I have also written two books on F#. Both are practical guides on how to apply functional programming in web development.

Before I get started, I would like to thank Mahesh and other organisers for organising this session. Thank you, Mahesh and Team.

Alright, Today I am here to talk about adopting functional programming principles in your day to day programming work. I have been practising FP for almost five years now.

It is a pleasant journey so far, and I also become a better software engineer in the process.

So, What is functional programming?

Well before getting into the definition, let me talk about what are all typical challenges that we face in software development?

From my experience, I feel the following four things are the most encountered problems.

  1. The complexity of the Domain and the tools that we use
  2. Requirement Change
  3. Time to Market
  4. Reliability (in other words - bug-free)

Let's see how functional programming can help us in each of these challenges.

To understand, how functional programming helps here, let's have a look at how we write software. We first create abstractions and then, we use them to solve the problem. We write classes, interfaces, add inheritance and include design patterns to define the business domain.

Why are we doing it? It is because of the underlying programming language which influences these abstractions. If it is offering something different, we'll be creating a different kind of abstractions. That's what we are experiencing in the market now.

Java 8 has introduced lambda and developers who are using it started solving problems in a different way which is better than their earlier ones. The same applies to other eco-system as well.

In a nutshell, FP offers a different set of abstractions using which we can write software in a better way, and it helps us to keep the complexity under control.

The core principles of FP follows the great Unix philosophy.

  • Make each program do one thing well. To do a new job, build afresh rather than complicate old programs by adding new "features".

  • Expect the output of every program to become the input to another, as yet unknown, program

The by-product that we get out following this principle is concise and lean programs that can help us to solve the problems with less complexity and accommodate the changes in the requirement.

As OOP revolves around objects, FP revolves around functions. The functions just map input to the output. The functions that perform the side effects, like writing/reading to/from the data are separated from the function that just operates on its input.

This separation of concern makes the code robust, and we can deliver the software faster with fewer bugs.

As a software engineer, our primary responsibility is adding value. The customer should trust the software; the stakeholders should getter better ROIs; the developers should have fun.

I firmly believe that FP principles help you to achieve this with less code!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment