I'm just an Erlang learner, but one thing that led me to Erlang is my ancient and well thumbed copy of Shlaer and Mellor's "Object lifecycles: Modeling the world in states" (<a href="http://www.amazon.com/Object-Life-Cycles-Modeling-Computing/dp/0136299407">
http://www.amazon.com/Object-Life-Cycles-Modeling-Computing/dp/0136299407</a>) which, for such a short book, made a great deal of sense to me and very much changed the way I saw program design.<br><br>It might be relevant to you because it is aimed at developing real-time systems where each "object" is implemented as a state-machine driven process, and the messages each process accepts are its "methods".
<br><br>Francis.<br><br>On 10/22/07, Alexander Lamb < <a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:alexander.lamb@rodanotech.ch">alexander.lamb@rodanotech.ch</a> > wrote:<br>><br>> Hello list,
<br>> I am trying to understand what is the design process (intellectual, that<br>> is) when building a program in Erlang.<br>><br>> Indeed, in the object oriented world, I would start by finding what my<br>> classes might be and the relationship between them. Gradually I would add
<br>> functions (class or instance methods) to the classes in order to provide<br>> solid foundations on top of which I can write an application.<br>><br><br><div><span class="gmail_quote">On 10/23/07, <b class="gmail_sendername">
<a href="mailto:erlang-questions-request@erlang.org">erlang-questions-request@erlang.org</a></b> <<a href="mailto:erlang-questions-request@erlang.org">erlang-questions-request@erlang.org</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Send erlang-questions mailing list submissions to<br> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions">
http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>or, via email, send a message with subject or body 'help' to<br> <a href="mailto:erlang-questions-request@erlang.org">erlang-questions-request@erlang.org
</a><br><br>You can reach the person managing the list at<br> <a href="mailto:erlang-questions-owner@erlang.org">erlang-questions-owner@erlang.org</a><br><br>When replying, please edit your Subject line so it is more specific
<br>than "Re: Contents of erlang-questions digest..."<br><br><br>Today's Topics:<br><br> 1. HiPE compilation option (Serge Aleynikov)<br> 2. Re: Fwd: Why single-assignment with non-shared state?<br> (Richard A. O'Keefe)
<br> 3. Re: Design methodology going from Object oriented to<br> functional programming? (Aaron Feng)<br> 4. Re: Design methodology going from Object oriented to<br> functional programming? (YC)<br> 5. Re: Design methodology going from Object oriented to
<br> functional programming? (Jay Nelson)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Mon, 22 Oct 2007 20:39:24 -0500<br>From: Serge Aleynikov <<a href="mailto:saleyn@gmail.com">
saleyn@gmail.com</a>><br>Subject: [erlang-questions] HiPE compilation option<br>To: "Erlang Users' List" <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>Message-ID: <
<a href="mailto:471D50CC.1030601@gmail.com">471D50CC.1030601@gmail.com</a>><br>Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br><br>One of my colleagues asked me how to enable HiPE compilation. After<br>
explaining the +native command-line flag I went back to documentation<br>and haven't found any reference to it in erlc, c, compile. I think it<br>must be an oversight as HiPE is an important feature that deserves to be
<br>documented.<br><br>Serge<br><br><br>------------------------------<br><br>Message: 2<br>Date: Tue, 23 Oct 2007 15:08:07 +1300<br>From: "Richard A. O'Keefe" <<a href="mailto:ok@cs.otago.ac.nz">ok@cs.otago.ac.nz
</a>><br>Subject: Re: [erlang-questions] Fwd: Why single-assignment with<br> non-shared state?<br>To: Erlang Questions <<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>><br>
Message-ID: <<a href="mailto:E787BEFE-6AB4-4727-9ADC-AB3A014C057E@cs.otago.ac.nz">E787BEFE-6AB4-4727-9ADC-AB3A014C057E@cs.otago.ac.nz</a>><br>Content-Type: text/plain; charset=US-ASCII; format=flowed<br><br>On 22 Oct 2007, at 2:05 am, Tobias Gerdin wrote:
<br><br>> Well as long as the expressions you match on doesn't change during<br>> matching I do not see the problem. There are several prominent<br>> languages such as the ML-family, Scala, or even Lisps which feature
<br>> both pattern matching and assignment.<br><br>I know nothing about Scala.<br><br>However, I keep both SML and Mlton on my machines (hmm, I think I may<br>have MoscowML somewhere as well). SML DOES NOT ALLOW PATTERN MATCHING
<br>ON MUTABLE DATA. SML's mutable data are "references" (boxes holding a<br>single variable) and "arrays". You cannot look inside either of these<br>using pattern matching.<br><br>The only "pattern matching" feature standardly available in Lisp is
<br>destructuring-bind (and its close relatives). It matches mutable<br>cons cells because Lisp doesn't have any other kind. Reading any<br>Scheme or Lisp tutorial, with its dire warnings against changing<br>lists that happened to appear as literal data, may provide some idea
<br>of the trouble mutable data can get you into.<br><br><br><br>------------------------------<br><br>Message: 3<br>Date: Mon, 22 Oct 2007 22:29:51 -0400<br>From: "Aaron Feng" <<a href="mailto:aaron.feng@gmail.com">
aaron.feng@gmail.com</a>><br>Subject: Re: [erlang-questions] Design methodology going from Object<br> oriented to functional programming?<br>To: "Jay Nelson" <<a href="mailto:jay@duomark.com">jay@duomark.com
</a>><br>Cc: <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>Message-ID:<br> <<a href="mailto:4e3934860710221929y5b0a775bm10a7df93f206003b@mail.gmail.com">4e3934860710221929y5b0a775bm10a7df93f206003b@mail.gmail.com
</a>><br>Content-Type: text/plain; charset="iso-8859-1"<br><br>Hi Jay,<br><br>I found the paper very insightful. I understand the space constraint that<br>some of the code sample has to be removed. Is the complete code sample
<br>available for download?<br><br>Aaron<br><br>On 10/22/07, Jay Nelson <<a href="mailto:jay@duomark.com">jay@duomark.com</a>> wrote:<br>><br>> I wrote a paper for the 2004 ICFP on designing structured systems
<br>> using processes. You can find it on my website at http://<br>> <a href="http://www.duomark.com/erlang/index.html">www.duomark.com/erlang/index.html</a><br>><br>> jay<br>><br>> _______________________________________________
<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions
</a><br>><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://www.erlang.org/pipermail/erlang-questions/attachments/20071022/7b3bfb0a/attachment-0001.html">http://www.erlang.org/pipermail/erlang-questions/attachments/20071022/7b3bfb0a/attachment-0001.html
</a><br><br>------------------------------<br><br>Message: 4<br>Date: Mon, 22 Oct 2007 19:41:26 -0700<br>From: YC <<a href="mailto:yinso.chen@gmail.com">yinso.chen@gmail.com</a>><br>Subject: Re: [erlang-questions] Design methodology going from Object
<br> oriented to functional programming?<br>To: "Alexander Lamb" <<a href="mailto:alexander.lamb@rodanotech.ch">alexander.lamb@rodanotech.ch</a>><br>Cc: <a href="mailto:erlang-questions@erlang.org">
erlang-questions@erlang.org</a><br>Message-ID:<br> <<a href="mailto:779bf2730710221941y4865b02bo5c842e94ced49c96@mail.gmail.com">779bf2730710221941y4865b02bo5c842e94ced49c96@mail.gmail.com</a>><br>Content-Type: text/plain; charset="iso-8859-1"
<br><br>Actually, at the level you are describing, there should be no difference<br>between FP and OOP.<br><br>While OOP definitely emphasize data and relations, it is not the only<br>paradigm that does so - and given your background you should be experienced
<br>with the relational paradigm, which has even heavier emphasis on data and<br>relations, but is not OOP.<br><br>To leverage your knowledge on relations - you can pretend sql queries are<br>functions, i.e. select is a function, update is a function, and insert is a
<br>function. Then instead of writing<br><br>object.insert()<br><br>you write<br><br>insert (object) - which looks a lot like the sql query insert into table ...<br><br><br>That's it. In the Java style OOP the head of the statement is an object,
<br>and in FP the head of the statement is a function name. But in either case<br>you need to model the same world.<br><br>An extremely crude way of thinking about FP is that it decouples the data<br>from the function (or vice versa, that OOP couples functions and data).
<br>That means some facilities that you've taken for granted in OOP, such as<br>inheritance, polymorphism, etc., will no longer be available. But FP have a<br>different approaches to address these problems, and that's where the rubber
<br>meet the road.<br><br>Erlang's process model is basically the Actor model - the idea of everything<br>is an actor feels similar to everything is an object in OOP. So as others<br>have alluded to instead of thinking in objects you can think in processes.
<br>But Actor model is independent of FP or OOP, so you would still have to get<br>used to the FP part in Erlang.<br><br>You might want to check out <a href="http://www.math.chalmers.se/~rjmh/Papers/whyfp.html">http://www.math.chalmers.se/~rjmh/Papers/whyfp.html
</a><br><<a href="http://www.math.chalmers.se/%7Erjmh/Papers/whyfp.html">http://www.math.chalmers.se/%7Erjmh/Papers/whyfp.html</a>>. A higher level<br>introduction is <a href="http://www.defmacro.org/ramblings/fp.html">
http://www.defmacro.org/ramblings/fp.html</a>.<br><br>Cheers,<br>yc<br><br>On 10/22/07, Alexander Lamb < <a href="mailto:alexander.lamb@rodanotech.ch">alexander.lamb@rodanotech.ch</a> > wrote:<br>><br>> Hello list,
<br>> I am trying to understand what is the design process (intellectual, that<br>> is) when building a program in Erlang.<br>><br>> Indeed, in the object oriented world, I would start by finding what my<br>> classes might be and the relationship between them. Gradually I would add
<br>> functions (class or instance methods) to the classes in order to provide<br>> solid foundations on top of which I can write an application.<br>><br>> For example, I could have PERSON, PROFILE, ROLE, FEATURE, etc... and
<br>> decide a PROFILE is a collection of FEATURES. A PERSON can have 0 or many<br>> ROLES. A ROLE is a PROFILE on a given area (a department for example) for a<br>> given time. I would then add functions such as "give all the active roles
<br>> for the user" or "what features give that profile" or "does the user have a<br>> given feature for that department".<br>> I admit it is more complexe than that, but you get the idea.
<br>><br>> Obviously, this doesn't seem to be the way to go with Erlang. Intuitively,<br>> I would start making a list of all the functions which will allow me to<br>> interract with my application. In that case I could have "give me all users
<br>> with an active role on that department", etc... Then by implementing those<br>> high level functions I would split them into pieces by calling smaller<br>> simpler functions. The underlying data structure will "just follow" or
<br>> "appear" naturally.<br>><br>> Hence: object oriented design is "data structure and relationships first,<br>> functions second" and functional design is "functions first, data structure
<br>> second".<br>><br>> Am I being over simplistic here. Are there some guidelines as to how one<br>> can approach a problem when creating a new program? Especially programs<br>> which deal with persistent data, not protocole analysers or socket servers!
<br>><br>> Thanks,<br>><br>> Alex<br>> --<br>> Alexander Lamb<br>> Founding Associate<br>> RODANOTECH S?rl<br>><br>> 4 ch. de la Tour de Champel<br>> 1206 Geneva<br>> Switzerland<br>>
<br>> Tel: 022 347 77 37<br>> Fax: 022 347 77 38<br>><br>> <a href="http://www.rodanotech.ch">http://www.rodanotech.ch</a><br>><br>><br>><br>><br>> _______________________________________________
<br>> erlang-questions mailing list<br>> <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>> <a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions
</a><br>><br>-------------- next part --------------<br>An HTML attachment was scrubbed...<br>URL: <a href="http://www.erlang.org/pipermail/erlang-questions/attachments/20071022/0fc13763/attachment-0001.html">http://www.erlang.org/pipermail/erlang-questions/attachments/20071022/0fc13763/attachment-0001.html
</a><br><br>------------------------------<br><br>Message: 5<br>Date: Mon, 22 Oct 2007 21:51:44 -0700<br>From: Jay Nelson <<a href="mailto:jay@duomark.com">jay@duomark.com</a>><br>Subject: Re: [erlang-questions] Design methodology going from Object
<br> oriented to functional programming?<br>To: "Aaron Feng" <<a href="mailto:aaron.feng@gmail.com">aaron.feng@gmail.com</a>><br>Cc: <a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org
</a><br>Message-ID: <<a href="mailto:FC68D843-F1BE-4859-AE50-E966D81B4F82@duomark.com">FC68D843-F1BE-4859-AE50-E966D81B4F82@duomark.com</a>><br>Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed<br>
<br>I haven't looked at for a couple years. I don't have the code on the<br>web. I will have to look around and see if I can find it on another<br>computer.<br><br>jay<br><br>On Oct 22, 2007, at 7:29 PM, Aaron Feng wrote:
<br><br>> Hi Jay,<br>><br>> I found the paper very insightful. I understand the space<br>> constraint that some of the code sample has to be removed. Is the<br>> complete code sample available for download?
<br>><br>> Aaron<br>><br><br><br><br>------------------------------<br><br>_______________________________________________<br>erlang-questions mailing list<br><a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org
</a><br><a href="http://www.erlang.org/mailman/listinfo/erlang-questions">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br><br>End of erlang-questions Digest, Vol 5, Issue 69<br>***********************************************
<br></blockquote></div><br>