SOLID: the next step is Functional
As Object Oriented programmers, we follow SOLID Design Principles for improving OO design of our applications.
If you take the SOLID principles to their extremes, you arrive at something that makes Functional Programming look quite attractive.
Objects are merely a poor man's closures. And ultimately Closures are a poor man's objects.
This talk explains about how applying SOLID Design principles like Single Responsibility Principle (SRP) leads to many small classes. Furthermore, if you rigorously apply the Interface Segregation Principle (ISP), you'll eventually arrive at the ultimate Role Interface: an interface with a single method.
If you apply the SRP and ISP like that, you're likely to evolve a code base with many fine-grained classes that each have a single method.
Objects are data with behaviour. Closures are too are data with behaviour.
This talk will enlighten how applying Object Oriented Design Principles to their extreme will lead you to Functional Programming.
It's necessary for Object Oriented programmer to understand why Functional programming makes sense.
At the end, this talk will also cover essential basics of Functional programming needed to be known for every Object Oriented Programmer.
Outline/Structure of the Talk
This talk will take a sample code example written with Object oriented design.
Then it will apply Single Responsibilty Principle (SRP) and Interface Segragation Principles (ISP) to their extremes.
It will prove how objects are similar to closures. Also prove closures are objects.
At last, it will cover basics of functional programming necessary to be known for any Object Oriented programmer.
Learning Outcome
This talk will help Object Oriented Programmers to get into Functional programming. It will also enlighten why Functional programming matters
Target Audience
Developers who daily write Object Oriented Code and are interested to learn Functional programming.
Links
schedule Submitted 5 years ago
People who liked this proposal, also liked:
-
keyboard_arrow_down
Bodil Stokke - The Mess We've Made
60 Mins
Keynote
Beginner
In this talk, we'll explore why some technologies end up inexplicably dominating our field while others fade away despite their obvious merits. What will it take for the languages we care about to succeed, and what are the consequences of success? Let's apply a broad perspective to the mess we've made of modern computer science, and explore our options for getting the situation back on track through a careful examination of history, science and ponies.
-
keyboard_arrow_down
Keith Bennett - Functional Programming in Ruby
45 Mins
Talk
Beginner
Although Ruby is not known as a functional language, it does support higher order functions in the form of lambdas and procs. Ruby's support for both object oriented and functional approaches, along with its conciseness, clarity, and expressiveness, make it an excellent choice as a general purpose programming language.
This session, geared toward the functional novice, shows how to implement functional approaches in Ruby, and shows why you would want to.
Topics covered will include:
- in testing, using lambdas to verify that certain behaviors do or do not not raise errors
- lambdas as predicates
- deferred execution
- composite functions
- nested functions
- using lambdas to hide variables
- functions that return functions (partial application, currying)
- lightweight event handling
- chaining behavior with lambda arrays
- how lambdas differ from conventional Ruby methods
-
keyboard_arrow_down
Dhaval Dalal / Ryan Lemmer - Code Jugalbandi
Dhaval DalalSoftware ArtisanCalixir Consultants Pvt. Ltd.Ryan LemmerProgrammer, code-coachIndependent consultant, Cape Townschedule 5 years ago
60 Mins
Demonstration
Beginner
In Indian classical music, we have Jugalbandi, where two lead musicians or vocalist engage in a playful competition. There is jugalbandi between Flutist and a Percussionist (say using Tabla as the instrument). Compositions rendered by flutist will be heard by the percussionist and will replay the same notes, but now on Tabla and vice-versa is also possible.
In a similar way, we will perform Code Jugalbandi to see how the solution looks using different programming languages and paradigms.
During the session, Dhaval and Ryan will take turns at coding the same problem using different languages and paradigms. There would be multiple such rounds during the Jugalbandi. -
keyboard_arrow_down
Mushtaq Ahmed - Demystify the Reactive Jargons
60 Mins
Demonstration
Intermediate
Sync, Async, Blocking, Non-Blocking, Streaming are the buzzwords in the reactive programming world. This talk will attempt to attach some meaning to them. It will also demo the performance and resource consumption patterns for blocking-io, Scala Futures and RxJava Observables for comparable programs. Finally, a command line application that consumes twitter streams API will demo what is possible using the new reactive abstractions.
-
keyboard_arrow_down
Mohit Thatte - Purely functional data structures demystified
45 Mins
Talk
Beginner
Immutable, persistent data structures form a big part of the value proposition of most functional programming languages.
It is important to understand why these data structures are useful and how they make it easier to reason about your program.
It is also instructive to see how these data structures are implemented to get a greater appreciation for the inherent tradeoffs between performance and immutability.
In this talk I will do a walkthrough of some of these data structures drawing from the work of Chris Okasaki[1], and attempt to explain the essential ideas in a simple way.
[1] Purely Functional Data Structures, Chris Okasaki, School of Computer Science, Carnegie Mellon University
-
keyboard_arrow_down
Bhasker Kode - Writing and improving tail recursive functions
45 Mins
Talk
Beginner
Brief history of recursion
Snippets from a few languages
What is tail recursion?
Design choices around recursion
The importance of tail recursion in erlang
How do you profile such improvements?
-
keyboard_arrow_down
Aditya Godbole - Learning (from) Haskell - An experience report
45 Mins
Experience Report
Beginner
Functional programming as a programming style and discipline is useful even in languages which are not pure functional languages. By practising programming in a pure functional language like Haskell, programmers can drastically improve the quality of code when coding in other languages as well.
The talk is based on first hand experience of using Haskell in internal courses in our organisation to improve code quality.
This talk will cover Gofer (one of the earliest variants of Haskell) as a teaching tool, including the choice of the language, the features from Haskell that should (and shouldn't) be covered and the obstacles and benefits of the exercise.
-
keyboard_arrow_down
Mushtaq Ahmed - Typeclasses as objects and implicits
60 Mins
Tutorial
Intermediate
Haskell has populairzed typelcasses a principled way to add ad-hoc extensions on existing data types. They allow you to 1) add new operations on existing data types and 2) support new data types on existing operations, and thus solve the famous "expression problem".
There is a lot of similarily between typeclasses and Java good practices of programming to interfaces and preferring composition over inheritance. The missing link is the implicit dictionary passing which allows haskell to be much more concise and expressive.
In this tutorial, we will look at how Scala adopts typeclasses by adding the missing link of implicits.
-
keyboard_arrow_down
Mushtaq Ahmed - Functions as objects
60 Mins
Tutorial
Beginner
Objected oriented languages like Scala support the paradigm of programming with functions. How does it work? The language has to conceptually map functions to objects. This tutorial will explain this idea by starting with a simple Java-like code and progressively refactor it to make use of higher order functions. As a result, you will learn about a few syntax sugars and also the cost implication of using objects to represent functions.
Public Feedback
Hi Anil, thanks for submitting this proposal. I must admit, that I'm intrigued by the topic. I'm not sure if I would agree with you on the following statement:
Can you please point me to an example that will help me understand this perspective better?
Thank you.
Hi Naresh,
Nice to know that you got intrigued by the topic. You can check this great post by Mark Seemann http://bit.ly/solid-the-next-step-functional-post My talk will be along the same lines. I will mostly use Ruby/Java programming language to evolve OO code to functional style code.
Hope that answers your question. Thanks.
Thanks for the prompt response. I'm curious to know your personal experience/example. Thanks.
Hi Naresh,
Gist link shows a simple example how applying SRP and ISP principles converts a OO code to functional style code.
https://gist.github.com/anildigital/1f3fbb90ac630c802bad
In first file, I have used Java, in second file, example uses role interfaces with single method, third, fourth and fifth shows how it evolves to functional style and used Scala for these files.
I hope this example helps you to understand the perspective better.