This page is no longer maintained — Please continue to the home page at www.scala-lang.org

More functional, less object oriented

9 replies
Matt
Joined: 2011-06-08,
User offline. Last seen 42 years 45 weeks ago.

Hi,
I will begin the development of an application. I tried to draw a
model of it, but I can't figure out how to make it more "functional".
It looks to be so "classical" (I mean, more in an OO style) that it
would be the same to develop it in Java.
Maybe I'm wrong, but is there a specific way to modelize an
application in a functional way ?
Thanks! Bye,
Matt

Luc Duponcheel
Joined: 2008-12-19,
User offline. Last seen 34 weeks 3 days ago.
Re: More functional, less object oriented
Here is my view on it (in a nutshell, and far from being formal (let alone correct (!))):

Architecture = top-down decomposition of system in functional sub-systems
Design = bottom up composition of components from atomic object components

-- analogy: company --> (sub-)departments <-- employees

[ somewhere subsystems and components meet ]

The atomic object components can be pure stateless ones or stateful ones.

Modelling stateless components in Java is somewhat clumsy
(you explicitely need an object to execute functionality)

-- analogy: you need a calculator to do a calculation

Modelling stateless components using Scala shines because functions are objects.

Modelling stateful components can be done in two ways:

 1) changing their old state to a new state (using var)
 2) transforming the ones with the old state into new ones with new state (using val)


You should go for option 2


Another thing is control.

Instead of modelling it using statements and traditional control constructs like
 - sequencing
 - looping
You should go for compositions of the functions and transformations above.

If you really want to be a die-hard functional programmer,
then you could go for the state monad for state and (delimited)
continuations for control.


Luc


On Wed, Jun 8, 2011 at 8:06 PM, Matt <matt@taggiasco.ch> wrote:
Hi,
I will begin the development of an application. I tried to draw a
model of it, but I can't figure out how to make it more "functional".
It looks to be so "classical" (I mean, more in an OO style) that it
would be the same to develop it in Java.
Maybe I'm wrong, but is there a specific way to modelize an
application in a functional way ?
Thanks! Bye,
Matt



--
   __~O
  -\ <,
(*)/ (*)

reality goes far beyond imagination

Raoul Duke
Joined: 2009-01-05,
User offline. Last seen 42 years 45 weeks ago.
Re: More functional, less object oriented

On Wed, Jun 8, 2011 at 1:15 PM, Luc Duponcheel wrote:
> Architecture = top-down decomposition of system in functional sub-systems
> Design = bottom up composition of components from atomic object components

just to agree and disagree all at once, see this thread:
http://lambda-the-ultimate.org/node/3265#comment-48045

sincerely.

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: More functional, less object oriented
Dear Matt,
Actually, diagram-chasing and string diagrams from category theory are great high level modeling tools for functional programming. 
Best wishes,
--greg

On Wed, Jun 8, 2011 at 11:06 AM, Matt <matt@taggiasco.ch> wrote:
Hi,
I will begin the development of an application. I tried to draw a
model of it, but I can't figure out how to make it more "functional".
It looks to be so "classical" (I mean, more in an OO style) that it
would be the same to develop it in Java.
Maybe I'm wrong, but is there a specific way to modelize an
application in a functional way ?
Thanks! Bye,
Matt



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136

+1 206.650.3740

http://biosimilarity.blogspot.com
marius
Joined: 2008-08-31,
User offline. Last seen 3 years 19 weeks ago.
Re: More functional, less object oriented

+1

On Jun 8, 2011 10:15 PM, "Luc Duponcheel" <luc.duponcheel@gmail.com> wrote:
> Here is my view on it (in a nutshell, and far from being formal (let alone
> correct (!))):
>
> Architecture = top-down decomposition of system in functional sub-systems
> Design = bottom up composition of components from atomic object components
>
> -- analogy: company --> (sub-)departments <-- employees
>
> [ somewhere subsystems and components meet ]
>
> The atomic object components can be pure stateless ones or stateful ones.
>
> Modelling stateless components in Java is somewhat clumsy
> (you explicitely need an object to execute functionality)
>
> -- analogy: you need a calculator to do a calculation
>
> Modelling stateless components using Scala shines because functions are
> objects.
>
> Modelling stateful components can be done in two ways:
>
> 1) changing their old state to a new state (using var)
> 2) transforming the ones with the old state into new ones with new state
> (using val)
>
>
> You should go for option 2
>
>
> Another thing is control.
>
> Instead of modelling it using statements and traditional control constructs
> like
> - sequencing
> - looping
> You should go for compositions of the functions and transformations above.
>
> If you really want to be a die-hard functional programmer,
> then you could go for the state monad for state and (delimited)
> continuations for control.
>
>
> Luc
>
>
> On Wed, Jun 8, 2011 at 8:06 PM, Matt <matt@taggiasco.ch> wrote:
>
>> Hi,
>> I will begin the development of an application. I tried to draw a
>> model of it, but I can't figure out how to make it more "functional".
>> It looks to be so "classical" (I mean, more in an OO style) that it
>> would be the same to develop it in Java.
>> Maybe I'm wrong, but is there a specific way to modelize an
>> application in a functional way ?
>> Thanks! Bye,
>> Matt
>
>
>
>
> --
> __~O
> -\ <,
> (*)/ (*)
>
> reality goes far beyond imagination
Matt
Joined: 2011-06-08,
User offline. Last seen 42 years 45 weeks ago.
Re: More functional, less object oriented

Thanks for your reply. Tools such as ?

On 8 juin, 23:36, Meredith Gregory wrote:
> Dear Matt,
>
> Actually, diagram-chasing and string diagrams from category theory are great
> high level modeling tools for functional programming.
>
> Best wishes,
>
> --greg
>
> On Wed, Jun 8, 2011 at 11:06 AM, Matt wrote:
> > Hi,
> > I will begin the development of an application. I tried to draw a
> > model of it, but I can't figure out how to make it more "functional".
> > It looks to be so "classical" (I mean, more in an OO style) that it
> > would be the same to develop it in Java.
> > Maybe I'm wrong, but is there a specific way to modelize an
> > application in a functional way ?
> > Thanks! Bye,
> > Matt
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 7329 39th Ave SW
> Seattle, WA 98136
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com

Meredith Gregory
Joined: 2008-12-17,
User offline. Last seen 42 years 45 weeks ago.
Re: Re: More functional, less object oriented
Dear Matt,
i was talking about conceptual tools. You can do diagram-chasing with Paul Taylor's package for latex or Omnigraffle, for that matter. The point is that both ordinary category theoretic diagrams and string diagrams (see also the Catster's videos on this) provide a compact visual representation with obvious -- and well vetted -- benefits. If you know anything about the history of physics, i would venture that diagram-chasing and string diagrams are as enabling to functional modeling as Feynman diagrams are to (quantum) physics. 
Best wishes,
--greg

On Wed, Jun 8, 2011 at 11:30 PM, Matt <matt@taggiasco.ch> wrote:
Thanks for your reply. Tools such as ?


On 8 juin, 23:36, Meredith Gregory <lgreg.mered...@gmail.com> wrote:
> Dear Matt,
>
> Actually, diagram-chasing and string diagrams from category theory are great
> high level modeling tools for functional programming.
>
> Best wishes,
>
> --greg
>
> On Wed, Jun 8, 2011 at 11:06 AM, Matt <m...@taggiasco.ch> wrote:
> > Hi,
> > I will begin the development of an application. I tried to draw a
> > model of it, but I can't figure out how to make it more "functional".
> > It looks to be so "classical" (I mean, more in an OO style) that it
> > would be the same to develop it in Java.
> > Maybe I'm wrong, but is there a specific way to modelize an
> > application in a functional way ?
> > Thanks! Bye,
> > Matt
>
> --
> L.G. Meredith
> Managing Partner
> Biosimilarity LLC
> 7329 39th Ave SW
> Seattle, WA 98136
>
> +1 206.650.3740
>
> http://biosimilarity.blogspot.com



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136

+1 206.650.3740

http://biosimilarity.blogspot.com
vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
Re: More functional, less object oriented
UML Object diagrams, more or less.

as well as sql's "select ... from ... where..." is just a limit diagram, most probably a pullback.

Thanks,
-Vlad


On Wed, Jun 8, 2011 at 2:36 PM, Meredith Gregory <lgreg.meredith@gmail.com> wrote:
Dear Matt,
Actually, diagram-chasing and string diagrams from category theory are great high level modeling tools for functional programming. 
Best wishes,
--greg

On Wed, Jun 8, 2011 at 11:06 AM, Matt <matt@taggiasco.ch> wrote:
Hi,
I will begin the development of an application. I tried to draw a
model of it, but I can't figure out how to make it more "functional".
It looks to be so "classical" (I mean, more in an OO style) that it
would be the same to develop it in Java.
Maybe I'm wrong, but is there a specific way to modelize an
application in a functional way ?
Thanks! Bye,
Matt



--
L.G. Meredith
Managing Partner
Biosimilarity LLC
7329 39th Ave SWSeattle, WA 98136

+1 206.650.3740

http://biosimilarity.blogspot.com

mepcotterell
Joined: 2011-03-17,
User offline. Last seen 40 weeks 6 days ago.
Re: More functional, less object oriented

How are UML diagrams "functional"?

On Thu, Jun 9, 2011 at 6:53 PM, Vlad Patryshev wrote:
> UML Object diagrams, more or less.
>
> as well as sql's "select ... from ... where..." is just a limit diagram,
> most probably a pullback.
>
> Thanks,
> -Vlad
>
>
> On Wed, Jun 8, 2011 at 2:36 PM, Meredith Gregory
> wrote:
>>
>> Dear Matt,
>> Actually, diagram-chasing and string diagrams from category theory are
>> great high level modeling tools for functional programming.
>> Best wishes,
>> --greg
>>
>> On Wed, Jun 8, 2011 at 11:06 AM, Matt wrote:
>>>
>>> Hi,
>>> I will begin the development of an application. I tried to draw a
>>> model of it, but I can't figure out how to make it more "functional".
>>> It looks to be so "classical" (I mean, more in an OO style) that it
>>> would be the same to develop it in Java.
>>> Maybe I'm wrong, but is there a specific way to modelize an
>>> application in a functional way ?
>>> Thanks! Bye,
>>> Matt
>>
>>
>> --
>> L.G. Meredith
>> Managing Partner
>> Biosimilarity LLC
>> 7329 39th Ave SW
>> Seattle, WA 98136
>>
>> +1 206.650.3740
>>
>> http://biosimilarity.blogspot.com
>
>

vpatryshev
Joined: 2009-02-16,
User offline. Last seen 1 year 24 weeks ago.
Re: More functional, less object oriented
Categorical, not functorial. Good question, nevertheless.

Thanks,
-Vlad


On Thu, Jun 9, 2011 at 4:56 PM, Michael Cotterell <mepcotterell@gmail.com> wrote:
How are UML diagrams "functional"?

On Thu, Jun 9, 2011 at 6:53 PM, Vlad Patryshev <vpatryshev@gmail.com>Cate wrote:
> UML Object diagrams, more or less.
>
> as well as sql's "select ... from ... where..." is just a limit diagram,
> most probably a pullback.
>
> Thanks,
> -Vlad
>
>
> On Wed, Jun 8, 2011 at 2:36 PM, Meredith Gregory <lgreg.meredith@gmail.com>
> wrote:
>>
>> Dear Matt,
>> Actually, diagram-chasing and string diagrams from category theory are
>> great high level modeling tools for functional programming.
>> Best wishes,
>> --greg
>>
>> On Wed, Jun 8, 2011 at 11:06 AM, Matt <matt@taggiasco.ch> wrote:
>>>
>>> Hi,
>>> I will begin the development of an application. I tried to draw a
>>> model of it, but I can't figure out how to make it more "functional".
>>> It looks to be so "classical" (I mean, more in an OO style) that it
>>> would be the same to develop it in Java.
>>> Maybe I'm wrong, but is there a specific way to modelize an
>>> application in a functional way ?
>>> Thanks! Bye,
>>> Matt
>>
>>
>> --
>> L.G. Meredith
>> Managing Partner
>> Biosimilarity LLC
>> 7329 39th Ave SW
>> Seattle, WA 98136
>>
>> +1 206.650.3740
>>
>> http://biosimilarity.blogspot.com
>
>



--
Sincerely,
Michael Cotterell
mepcotterell@gmail.com
mepcott@uga.edu

P.S. - Check out ScalaTion (http://code.google.com/p/scalation/), a
Domain-Specific Language for Modeling & Simulation. #blatantplug

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland