Are you ready to embark on the functional programming journey? You’ve come to the right place. We’ll learn about the benefits of learning functional programming languages along with examples of how tech giants have incorporated functional programming into their software development cycles.
But before we begin, what’s functional programming in the first place and why do you need to know about it?
The reality is that there isn’t any fixed definition of functional programming, as it isn’t something that’s set in stone. But one can certainly think about it as a ‘paradigm’, a unique approach or a ‘way’ to do programming.
Wikipedia defines it as ‘a style of building structure and elements’ of a computer program that treats computation as the evaluation of mathematical functions and avoids changing state and mutable data. Making sense yet?
This quora definition makes it simpler to understand as it defines functional programming as a paradigm that focuses on ‘computing results’ not performing actions. Yet, it’s not easy to define functional program, as it really isn’t definitive in nature!
If you’re struggling with coding large applications, you’re not alone. While coding smaller functional applications or MVPs can be done using other methodologies, functional programming is what you’d use to simplify the larger, more complex projects.
The key difference is in using a ‘declarative’ approach, versus an ‘imperative approach’used in other programming methodologies. An imperative approach can be hard to read and revolves around telling the software how to do what we want it to do, rather than telling it exactly what we want it to do.
Here’s an example of the imperative approach:
This code is/does XYZ. But see how hard it is to read? It seems clunky, and can exhaust your brain while making sense of it all!
Compare this with the declarative style used in functional programming:
That’s just elegant.
The above code snippet does the exact same thing that the imperative style code snippet does, i.e. triples the value, and sums up every item in a given array.
Yet, it’s so much cleaner, crisper and easy to follow. That’s why functional programming can be empowering and effective.
Having said that, functional programming isn’t without it’s ‘myths’. Could they be real?
To find out more about functional programming, we reached out to senior and leadership at a mix of tech giants — Telstra, REA Group, Contino, ICM Consulting Pty Ltd, and The Big Red Group.
Let’s dig in.
The leading myth in functional programming is that there’s one standard definition. I’m afraid to tell you that there isn’t.
While functional programming can be loosely defined as a style of building the basic components of a computer program, there’s no standard, or widely accepted understanding of what functional programming is and how it can be defined.
What most professionals agree on is that functional languages use a different philosophy, compared to other types of languages. This means that they represent and value a specific way of looking at software structure.
Can Anyone Get Started?
Contrary to popular belief, functional programming isn’t impossible to learn, even if you’re just starting out as a software developer. Functional programming is a new skill and you’ll feel like a newbie programmer as you learn it. However, it’s just like any new skill– it’s always difficult to understand from the onset, but as you learn the rules, you’ll start to get more comfortable.
Telstra’s Big Data Analytics GM, Mark Moloney enlightens: “One myth is that functional programming is hard or too academic. It is just another skill to learn. It takes time and practice to master — no different to the journey that developers went through to learn object-oriented programming in the late 80s / early 90s. Technology continues to evolve. It is one of the reasons I love software. Learning how to learn is as important as what you know.”
What’s the best language to learn if you want to work for a great tech company?
A great choice of language would be Haskell, since it’s used widely across many tech companies. It’s certainly not the easiest language to learn, but it is a purely functional programming language. It’s also ‘lazy’ as a language, as in, it won’t execute functions until it’s specifically instructed to show you a result.
One of the most commonly used but also hardest languages to learn is APL which requires its own unique keyboard. The thought of learning to use a new type of keyboard can be daunting!
So, which languages can you learn? Consider some of the following strong contenders:
Mark Moloney shares more about which languages he’s used over the span of his career. “It might have been the case once that a developer could pick a language, say C# or Java, and within that ecosystem fulfill their role as a software developer. A polyglot approach is required today. In other words, use of multiple languages depending on the task.
Contino’s VP of Engineering, Yun Zhi Lin, offered his insight, with 15 years of experience up his sleeve: “My preference has always been towards compiled and strongly typed languages. I’ve moved from higher level, VM based languages such as Java, Groovy and Scala to simpler, lower level and statically compiled languages such golang and at times C++.”
REA Group software developer Jack Low also sees the benefit of Scala, Haskell, and also Idris. “I’m interested in learning ways to detect as many potential bugs as possible at compile time, using a strong type system. So far this has led me to languages such as Scala, Haskell, and Idris. Idris in particular, with its dependent type system, is very fascinating to me. I think its success will be measured by the number of concepts that carry over to mainstream languages in future. Functional programming languages have influenced many mainstream languages in recent times and I expect this to continue.”
With all that in mind — what’s the most difficult programming language?
As you might’ve guessed, the answer depends, largely on your ability to problem solve and access the resources that are readily available on the Internet.
The good news is that learning programming languages can be done relatively quickly because of the cooperative nature of the profession.
Moloney shares his two favorite resources, Github and Coursera. He elaborates, “Github because side projects allow me to experiment and try new languages. Each new language you learn gets easier because more learning is transferred from previous languages.
“Coursera’s ‘Functional Programming Principles in Scala’ is an excellent introduction to Scala and functional programming in general.”
ICM Consulting’s Chief Technology Officer Brendan Bates shares practical advice, “I like to practice my skills on personal projects — most I never finish and some I do but then never look at again. In the past, I used to enjoy running through some problems on Project Euler.”