Functional Design: Applying past software architecture and design to our Clojure programs by Janet Carr

January 17, 2024

Janet Carr delves into the principles of functional design in the context of Clojures programs, emphasizing recursion, function transformations, and reducers to eliminate the need for state in applications. She discusses the importance of applying functional design basics to achieve software engineering principles like robustness and adaptability. Janet also explores functional interfaces, design patterns, software architecture implementation, and best practices for using lambdas in functional programming, encouraging developers to embrace functional solutions for easier implementation and long-term success. She shares her journey into functional programming, highlighting the increased acceptance and demand for functional programming in the industry.

Functional Design: Applying past software architecture and design to our Clojure programs: A comprehensive overview

Introduction to functional design

Janet begins by introducing herself as a functional programming consultant and explains the basics of functional design, emphasizing recursion, functions over objects, and transformations over instructions.

 

Recursion and reducers

The importance of recursion in functional programming is highlighted, showcasing how it can be used to create reducers for collapsing collections into a single value. This approach transforms data through a series of transformations, eliminating the need for mutable state.

 

Functional interfaces

Janet discusses functional interfaces and their differences from object-oriented interfaces, emphasizing polymorphism and function delegation. She encourages applying software design principles from the past to functional programming.

 

Design patterns in functional programming

The relevance of design patterns in functional programming is explored, with a focus on the state pattern for modeling finite state machines. Janet demonstrates effective implementation using higher-order functions and recursion.

 

Applying functional design to software architecture

Janet elaborates on applying functional design concepts to software architecture, discussing patterns like finite state machines, observer pattern, and strategy pattern. She cautions against using state with Lambdas due to potential inconsistencies.

 

Best practices for lambdas and closures

Naming lambdas for better documentation and clarity is recommended, along with using closures and enclosures to make lambdas recursive. Janet also discusses the concept of protocols and encourages embracing functional programming solutions for easier implementation.

 

Personal experience and industry insights

Janet shares her journey into functional programming, learning Scala and Clojure through job postings and books. She discusses the use of Clojure in various companies like Walmart and highlights the growing adoption of functional programming in the industry.

 

Conclusion

Overall, Janet Carr’s presentation provides a comprehensive understanding of functional design principles and their practical application in software development, offering valuable insights for both beginners and experienced developers alike.

 

Additional resources

Check out more from the MeetUp Func Prog Sweden. Func Prog Sweden is the community for anyone interested in functional programming. At the MeetUps the community explore different functional languages like Erlang, Elixir, Haskell, Scala, Clojure, OCaml, F# and more.