apoorv-2204

apoorv-2204

Functional programming patterns IN elixir As opposed to Object Oriented design

How a simple problem like of inheritance or any other problems are mapped to functionalD and in OOD , what are their differences in their design model.?

If we been given a problem let say x to design and model it.How it would differ for the OOD and FD?

Lets say for entities like Person, Man, Woman , Father ,Mother, lawyer student?

How we design a future proof software? How we deal differently , with maybe upcoming future complexity in software? for both the designs?

Like in more complex situation like designing of vending machine , parking lot ,etc.How those OOD maps to functional. In functional there are just transformation of data.

Most Liked

D4no0

D4no0

What if we build elixir in minecraft? :joy:

adw632

adw632

Some essential rules:

  1. Let data be data.
  2. Use CRC (Create, Reduce, Convert) pipelines. Most things in elixir and FP is essentially reducing over some state.
  3. Use modules to organise related functions that operate on some state.
  4. If you wish to compose use import or delegate to other functions in other modules.
  5. If you want polymorphic behaviour use protocols
  6. If you want to derive functional behaviour with your own overrides use behaviors

Look at the Enum module, it can work on data elements of any type, so think in terms of steps or an algorithm and really let the data be just data.

For true OO semantics look at Elixir process modules such as genservers or liveviews which are objects as per the Alan Kay definition, they accept messages as the only means of interacting with them and manage private state in their own process context.

adamu

adamu

Program maintenance is an entropy-increasing process, and even its most skilful execution only delays the subsistence of the system into unfixable obsolescence

Fred Brooks

:slight_smile:

Where Next?

Popular in Discussions Top

matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New
Jayshua
I recently came across the javascript library htmx. It reminded me a lot of liveview so I thought the community here might be interested....
New
thojanssens1
It would be nice to be able to define a redirect from one route to another from the router.ex file. E.g.: redirect "/", UserController, ...
New
sashaafm
Piggy backing a bit on @dvcrn topic BEAM optimization for functions with static return type?, I’ve been trying to understand in a deeper ...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
AstonJ
I’ve just started the Phoenix part of the utterly brilliant online course by @pragdave. On generating the Phoenix app he uses the --no-ec...
New
PragTob
Hey everyone, this has been on my mind for some time and I’d love your input on it! TLDR: I feel like maps are superioer for storing and...
New
eteeselink
Hi all, In the last days, two things happened: A blog post titled “They might never tell you it’s broken” made the rounds. It’s about ...
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
sergio
Kind of like when jquery came out, it was super necessary. Existing drag and drop libraries have a bunch of baggage to support old browse...
New

Other popular topics Top

aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
Lily
In templates/appointment/index.html.eex: <%= for appointment <- @appointments do %> <tr> <td><%= appoi...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New

We're in Beta

About us Mission Statement