10

I'm a MVC web developer who's become very interested in functional programming to write web apps (specifically, I'm captivated by Erlang and Cowboy.)

What I'm having trouble finding an answer to/resources on is what pattern is used to replace MVC in FP.

Obviously the idea of an ORM is ludicrous in FP, since it's not object oriented, so what is used to replace it for persistence logic? Is it usual to just build a module that uses a library to create functions that interface with the datastore, or are there tools similar to ORMs?

Both advice and links to resources would be greatly appreciated. Bonus points for Erlang/Cowboy specific help. Thanks.

asked Jun 5, 2013 at 1:01
2
  • This question lends a bit of help to me understanding why this answer seems to be missing, but I'm still interested in advice from people experienced with FP, specific to ORM-type work. Commented Jun 5, 2013 at 1:09
  • Have a look at Deprecating the Observer Pattern with Scala.React. Commented Jun 5, 2013 at 13:02

4 Answers 4

5

There are MVC frameworks for Erlang. It's ChicagoBoss for example.

answered Jun 5, 2013 at 3:55

2 Comments

Thank mate. I've had a look at ChicagoBoss, and am thinking I'd prefer to go with something slimmer like Cowboy or WebMachine. I realise this means the ORM-equivalent isn't baked in, but am trying to figure out how FPers do it in general, without an ORM.
You might want to have a look at nitrogenproject.com - it's not quite MVC (it is event-driven using Erlang pattern matching). I found it to be light weight with a fast development cycle. BTW, there is less need for ORM-like tools in Erlang since databases such as Mnesia allow terms to be stored in the database and read back as terms, i.e. there is no need for a mapping or translation layer as there's nothing to translate.
4

Quoting from an article by @yarivs:

Erlang does carry its weight in all letters of the MVC. For the Model, forget database abstraction layers: you have a pure Erlang distributed database called Mnesia. For the view, Yaws has ehtml. For the controller, Yaws has appmods and Erlang's pattern matching.

I hope this helps.

answered Aug 17, 2013 at 7:25

Comments

2

im a coder for erlang. i use erlang for my web-game server... so...there is no View..and in function luangues this is no Model... so from my point of view, function luangues there is no need of MVC (just like no class or subclasses in function luangues..)

answered Jul 12, 2013 at 3:38

Comments

1

Lift framework(written in Scala) uses pattern called 'view first'.

follow link https://www.assembla.com/wiki/show/liftweb/View_First

answered Jul 3, 2013 at 10:27

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.