Cleidiano

Cleidiano

Hi Guys,
I’m studing Elixir since last month but, I have a lot dificulty to change the form of thinking to solve a problem with functional design, I’m programing with OO and I would like to add Functional Programing in my toolbox, there’s someone the indicate a guide, book, tutorial to help me?

First 10 of 29 Posts Switch mode

mkunikow

mkunikow

We have this topic on forum. Maybe it will help.

peerreynders

peerreynders

You may want to have a look at Erlang and Elixir for Imperative Programmers (I haven’t read it, so I can’t really comment).

Personally given that even Erlang/Elixir aren’t “purely functional” I started reading Haskell Programming from First Principles - admittedly an extreme approach but I felt that my brain needed an extreme push :slight_smile: (I think Erik Meijer just finally wore me down with his “learn Haskell”).

mkunikow

mkunikow

I am also reading http://haskellbook.com/ plus http://learnyouahaskell.com/ . There is also Erlang book http://learnyousomeerlang.com/.

Qqwy

Qqwy

TypeCheck Core Team

There was a talk by Morgan Laco at ElixirConf about switching to Functional Programming(/Elixir) when coming from OOP. It might still take a few days before a video version of that talk appears online, however.

JamboJustin

JamboJustin

I recommend The Little Schemer. It’s not a comprehensive introduction to functional programming, but it will rewire your brain to think recursively, which is the single biggest obstacle to overcome with functional programming. Rewriting the programs into Elixir would make for good exercises.

I’m currently doing SICP in Elixir. Elixir is a lot like Lisp but much easier to mentally parse.

Cleidiano

Cleidiano OP

Thank you everybody!!!

peerreynders

peerreynders

2014 NDC London,UK
Functional programming design patterns by Scott Wlaschin

as referenced in
From Front End to Full Stack with Elixir and Phoenix by Lauren Tan (ElixirConf 2016)

Qqwy

Qqwy

TypeCheck Core Team

I think that the main change is that instead of having objects that themselves are responsible for their capabilities, you have data which can be transformed into other data if it has the correct format.

Thinking with transformations is a lot more extensible and flexible than thinking with a hierarchical model of objects.

In an OOP language (a true one like Ruby. In languages that have a difference between primitive types and objects like Java, you might need to use a.equals(b) instead), a comparison like a == b actually calls a method on object a. Which means that the result might be very different than b == a.
And you will need to define those methods in two places.

In a Functional language, you simply state what the result should be between a comparison of these two kinds of objects. In a single place.

vasspilka

vasspilka

I agree with the above, however I have to say something about the following statement:[quote=“Qqwy, post:10, topic:1771”]
I think that the main change is that instead of having objects that themselves are responsible for their capabilities, you have data which can be transformed into other data if it has the correct format.
[/quote]

In Erlang/Elixir one can think of processes as being objects, in fact when OO was being discussed by Alan Kay (one of the fathers of the idea of object-oriented programming) and Stefan Ram, Alan said the following two statements

I thought of objects being like biological cells and/or individual
computers on a network, only able to communicate with messages

OOP to me means only messaging, local retention and protection and
hiding of state-process, and extreme late-binding of all things. It
can be done in Smalltalk and in LISP. There are possibly other
systems in which this is possible, but I’m not aware of them.

Now this sounds a lot like the processes in OTP. I found the info in this really interesting article by James Edward Gray it’s a nice read. I’ve heard many times OO was about message passing and not Classes but I could not fully grasp that concept until I looked at it through Elixir and OTP.

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 91898 914
New
AstonJ
The obligatory hello world thread! Who are you and where are you from? :stuck_out_tongue:
4616 55835 594
New
byu
@chrismccord : I just saw the Extract AGENTS.md from Phoenix.new into phx.new generator commit to the phoenix project. My initial shotgu...
New
arcanemachine
I was working on an Ecto migration and I needed a timestamp. So, for the nth time, I looked up the different data types for timestamps, a...
New
alexslade
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog It says that Fly is going all-in on sprites, which is a worry ...
New
Herve37
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using. We’re particularly inte...
New
matt-savvy
Is there a word for the ~> symbol used in Version strings? Do you also just call it a Squiggle Arrow™ ?!
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement