Functional programming — A BitBakery Knowledge Nibble

Continuous learning is one of our core values. Every BitBaker brings their own unique experience to deliver for our customers’ projects.

Once a month, we get the team together for a lunch and learn series we call Knowledge Nibbles. We bring in catering from one of our favourite locals and take turns presenting a subject to the team.

The October learning session was lead by BitBakers Marcel Rusu and Pablo Morales. They presented an intro to functional programming with lunch from the Lancaster Smokehouse.

As a provider of outsourced software development, we work with a lot of different stacks. Two different customers might even use the same framework, but use different versions. We use continuous learning to build a deep understanding of the frameworks we use.

“You can learn a lot more by developing an understanding of the technology first.” said Pablo. “If you’re just running around asking questions because you don’t know the answers and not making time to learn, you’re not growing as much as you could be.”

Marcel has been following the concept of functional programming for a few years now. Both Marcel and Pablo studied computer science at Wilfrid Laurier University. “He kept talking to me about functional programming in second year and I didn’t really get it until I finally had the chance to work with React.” said Pablo.

Their talk focused on two principles of functional programming: declarative programming and immutability. Declarative programming is a shift from telling the program “what to do” instead of “how to do it”. You focus on the flow and structure of data before you type in your first line of code. Declarative programming makes it easier to see how data flows through your code. You’re also less likely to make simple errors that occur when you swap variables.

Immutability builds on the idea that state changes are the cause of most bugs. These changes can be implicit or accidental. An immutable date type is one that is never changed. Using immutable data types reduces and even eliminates these bugs. What can be an immutable data type? In Javascript, primitives like numbers, strings, and booleans all can be immutable. Other languages differ in the mutability of their standard types. Some allow for immutable arrays, others allow for mutable strings.

Marcel and Pablo chose the topic because of its rapid adoption in the industry. “What’s interesting is that web is leading this. It’s almost a decade ahead of mobile for moving into declarative.” Marcel feels that many people still have trouble explaining functional programming. “Many people use functional programming in frameworks like Angular and React, but I think it’s still hard for many front end devs to easily answer ‘what is functional programming?’”

Before diving into functional programming, Marcel recommends asking why are you using it. What benefits does it offer your development team?

“It’s really important to understand the technologies we use,” said Pablo. “We use a lot of different frameworks, and it’s important to build a deep understanding of them. Three months ago, I wouldn’t be comfortable explaining things to the team. Now I feel like I can really help Marcel and Edson.”

Marcel and Pablo both agreed that getting a chance to present was rewarding. “We’re both pretty passionate about talking and sharing. It’s exciting to do that here at BitBakery.” said Marcel.

Leave a Reply

Your email address will not be published. Required fields are marked *