My Journey towards Functional Programming and F#

December 5, 2024    Development .Net Functional Programming F#

My Journey towards Functional Programming and F#

A sunset on the Ham by Twekesbury, UK in September 2024

Thank you to Sergey Tihon for another year of F# Advent 2024 and for adding me to the calendar. Be sure to catch the other articles.

May you know the Truth and the Reason for the Christmas Season !

During my 20+ years of development experience (counting college), I have been on a learning journey. These have been experiences, struggles, successes, changes of approaches and technologies. I’ve been able to work with many teams in small and large software products through consulting for Omnitech clients, while learning from other Omnitech colleagues’ experiences.

Pain Points with Object Oriented Programming (OOP)

I’ve enjoyed and used C# OOP for a long time. It’s a great language! However, I’ve been noticing that mutatable state in large solutions leads to frequently finding myself using Visual Studio’s F12 to definition and tracking down how a property on an object is set (usually in multiple places). This is difficult to reason about and takes a lot of time to track down, when someone asks “how does this actually work when x and y happen?”. The business logic is usually scattered over years, as it is much easier and quicker to fix the current issue than to think about avoiding real duplication and centralizing.

In the last few years, I’ve been thinking there has to be a better way….

History

In the early 2000s, at UMM Morris, we learned OOP with Java using A Practical guide to eXtreme Programming . I also used PHP to build some software for an on-campus group. I was excited when I realized I could use objects in PHP.

We’ve had a lot of book clubs at Omnitech. In 2014, The Phoenix Project (go read it!) introduced me to Gene Kim. We’ve read many of his books . I’m thankful for his insights and I’ve been greatly influenced by his content.

A watershed idea was reading Clean Architecture by Uncle Bob Martin. This lead to many discussions and improvements how we approached building software systems. I even presented several times on the topic .

Inspiration In 2019

IT Revolution Podcast (Dispatch from the Scenius) Fabulous Fortunes, Fewer Failures, and Faster Fixes from Functional Fundamentals Episode 22 | Scott Havens

I heard Gene Kim talk about Clojure (in the Unicorn Project book), in his IT Revolution podcasts and love letter to Clojure . Maybe there is something to this Functional approach….

The real hook for me was listening to the Gene Kim and Scott Haven conversations in episode 22 and 23 and then watching Scott Haven at DOES 2019. Forging a Functional Enterprise: How thinking Functionally Transforms Line-of-Business Applications . You can apply these at a system level too! These are First Principles we can apply at multiple levels!!

πŸ’‘ “mind blown” 🧠

Then Gene Kim’s “who filled my cup?!?” in his introduction to Fabulous Fortunes, Fewer Failures, and Faster Fixes from Functional Fundamentals - Scott Havens

Who filled my cup!?!

🎧 Go listen/watch these, it’s worth your time. I can wait 😊.

What do others say?

F# Testimonials says much more than I can with real experience using F#.

Microsoft CoPilot generated - an image of something shinning just over the hill on a path through hills with trees

Domain Modeling - Leveling Up

I read Domain Modeling Made Functional by Scott Wlaschin after it being recommended by a colleague. Don’t miss Scott’s many videos and F# For Fun and Profit if you want to learn about F#!

"Is this really possible? How can I use this in real work?"

2022 - An Interview and Using F# at a client πŸ‘¨β€πŸ’»

A few months later, I had an interview for a new staff augmentation job (with Omnitech, but on a team for another company). Experience, this blog and speaking at some local events made me known to them and made the interview more of a get to know you conversation. After an overview of the existing large system which included Domain Driven Development, Azure, Event Sourcing and Eventual Consistency, Projections, Cosmos Db, Angular, SignalR. I was able to ask about the Scott Havens approach and Domain Modeling Made Functional and Kyle was aware and knowledgable on it.

Within a few weeks of starting, I was getting to learn F# to modifidy existing reporting code, seeing the core of the application in F# and then experiencing the interop with C# projects. I shared this knowledge at Omnitech and a blog post F# Introduction from a C# Developer , but it didn’t catch on much outside of this client.

I’m very thankful for the opportunity to work with this team, learn from them and apply it to real production code.

Pragmatic Programmer connects again

We read Pragmatic Programmer together at Omnitech in 2021. My quote in that article was “The biggest ’eye-opener’ for me was about transforming programming, where you take input data and transform it into an output. Thinking of the data as a mighty river πŸ›Ά opened me to new thinking.” See Tip 49 “Programming is about Code, but Programs are about Data”.

More Learning! πŸŽ“

Fast forward a few years to 2023.

Matt started at Omnitech and brought new energy and interest in FP. He dove in deep and learned Haskell. Check out his coming December 19th Advent Article ! At the same time we had a FP Lunch and Learn “spin off” watching many videos on a wide range of topics. Here are a few of them (again, well worth your time):

Geared for C# devopers

Someone in our area is using F#!

Zach shared at an SF Devs Meetup about Domain Modeling in F# . He has had a lot of success building apps with F#. I chatted with him and he’s had success with some projects at his company, teaching and learning, but it’s not easy getting more on board with the approach and F# language.

Book Club at Omnitech

We started F# in Action by Isaac Abraham Book Club in October and November 2024 with a larger group. The interest is increasing, we are having more conversations and I find myself thinking “how could I solve this task in F#?”, while still mostly using C# and Typescript. This book is a great introduction and we have had a lot of good discussions.

Learn, Apply, Teach

Matt’s moto is "Learn, Apply, Teach". He’s leading the charge. It’s important to have experts in something before trying to adopt something.

I was able to apply my F# learning for a script and shared Run Cli Commands with F# on November 25, 2024.

This journey is going take a lot of humility and good communication skills to help others see the current pain, the possible benefits. Ken Scambler`s - A Human Approach to Functional Programming was very helpful in thinking about how to share these ideas and approaches with more people.

It’s difficult to get adoption and buy in before you have experience. We need to show some “wins” and let results speak for themselves.

Pragmatist, Early Adopters and the Happy Middle Grond

We need to be pragmatic about adopting any new (or new to us) technologies and approaches. We need to be careful, weigh the cost and benefits, think long term, be willing to have open and honest conversations, experiment and evaluate. In our excitement for something new, we need to be careful not to make others feel like the other way is “bad” or “wrong” or “you’ve been doing this wrong for years”. Buy-in takes a lot of time and relationship building.

I plan to keep thinking about and maybe writing more about this soon.

Eric Sink`s Article on the F# chasm was very helpful.

What’s next?

I’m going to keep learning, searching for ways to Apply and teach/share/mentor with others.

I’ll continue to learn, look for current pain points FP may alliviate, look for ways to apply these concepts in my C# code and for opportunities to use F# in a proper way (scripts, testing, sudo domain modeling, etc).

I hope to be able to use FP first principles of immutability, expression, F# domain modeling and then more F# code in the future. Hopefully, I’ll have more posts about progress in the future.

Here is a list of some of the many links I’ve captured during my journey.

Journey image generated by bing.com/images/create

Thanks for reading and I wish you the best this holiday season and on your own Functional Journey!


Watch the Story for Good News
I gladly accept BTC Lightning Network tips at [email protected]

Please consider using Brave and adding me to your BAT payment ledger. Then you won't have to see ads! (when I get to $100 in Google Ads for a payout (I'm at $95.73!), I pledge to turn off ads)

Use Brave

Also check out my Resources Page for referrals that would help me.


Swan logo
Use Swan Bitcoin to onramp with low fees and automatic daily cost averaging and get $10 in BTC when you sign up.