[erlang-questions] Conceptual questions on architecture of functional programs

Ahmed Omar spawn.think@REDACTED
Thu Nov 4 09:29:58 CET 2010


I would recommend this one:
http://www.defmacro.org/ramblings/fp.html

2010/11/4 黃耀賢 (Yau-Hsien Huang) <g9414002.pccu.edu.tw@REDACTED>

> Hi, Silas.
>
> There's an introductory paper "Why Functional Programming Matters" for you.
>
> In functional fashion, you can make second-order, third-order and
> n-th-order
> functions
> when you pass a name of a first-order function into some function.
>
>
> --
>
> Best Regards.
>
> --- Y-H. H.
>
>
> On Thu, Nov 4, 2010 at 9:23 AM, Silas Silva <silasdb@REDACTED> wrote:
>
> > Hi all!
> >
> > After asking conceptual questions about distributed NoSQL databases, it
> > is time for a more newbie question, about functional programming.
> >
> > There is some years I do fine OO and imperative programming.  I needed
> > to learn some functional programming.  So I decided to start a basic
> > commercial application (customer, orders, etc.) in Erlang to learn
> > something about it.  After some time, I realized my program had the
> > following structure:
> >
> >
> > - model.erl -> basic functional to access Mnesia database
> > - layer.erl -> an abstraction layer between model and front-end.
> >  Controller?
> > - frontend.erl -> show a front-end for the user, for now HTTP in
> >  Mochiweb.  Latter, a GUI.
> >
> >
> > So, from fron-end I use layer functions, that use model functions.
> >
> > So I realized I wasn't actually doing any functional programming.  This
> > could be an architecture of a C program using high-level code.  I did
> > sequential programming split in dozens of mini-functions and I believed
> > that this was functional programming (a C-like program with high-level
> > constructors)...
> >
> > In OO, I would easily return an object from layer, call its methods to
> > get what I wanted and make heavy use of encapsulation in objects.  I
> > could also pass objects in and out.
> >
> > In the program I just wrote, I pass in and out records, that are not
> > that different from passing C structures in and out.
> >
> > So, my question is:  where is my mistake?  What about a reference (book,
> > tutorial whatever) about functional programming architecture for OO
> > programmers (or imperative programmers)?  "Programming Erlang Software
> > for a Concurrent World", by Joe Armstrong is great, but it is more about
> > the language itself than functional programming techniques.  "Practical
> > Common Lisp", by Peter Seibel is more worth to read.
> >
> > Other references are found in
> >
> >
> http://stackoverflow.com/questions/89212/functional-programming-architecture
> >
> > Any tips about that?
> >
> > Thanks!
> >
> > P.S: The above program don't have any concurrent code yet.  I know it is
> > really important for Erlang, but would it be really that necessary to
> > get function programming feeling?
> >
> > --
> > Silas Silva
> >
> > ________________________________________________________________
> > erlang-questions (at) erlang.org mailing list.
> > See http://www.erlang.org/faq.html
> > To unsubscribe; mailto:erlang-questions-unsubscribe@REDACTED
> >
> >
>



-- 
Best Regards,
- Ahmed Omar
http://nl.linkedin.com/in/adiaa
Follow me on twitter
@spawn_think <http://twitter.com/#!/spawn_think>


More information about the erlang-questions mailing list