Version française
Home     About     Download     Resources     Contact us    
Browse thread
Modeling tool for OCaml?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Jon Harrop <jon@f...>
Subject: Re: [Caml-list] Modeling tool for OCaml?
On Sunday 04 February 2007 18:41, Julien Peeters wrote:
> I imagine that designing applications with functional languages is much
> different than with imperative ones.
>
> I was wondering on which points the difference is significant?

If you assume that by "imperative" you really mean "object oriented", as most 
of the main imperative languages are now OO (C++, Java, C# and Python), the 
difference is primarily that class hierarchies can often be represented more 
succinctly and efficiently using other constructs (like variant types) in 
functional programming languages like OCaml.

> Does common oriented object design patterns can be used with OCaml?

Most OO design patterns are redundant in OCaml. Basically, most OO design 
patterns solve problems creating by OO in the first place...

> And what, for a developer, is the work to do to change his way of
> thinking?

Try to write your programs using a minimal amount of mutation, replace all 
loops with higher-order functions, leverage trees and pattern matching 
whenever possible. Forget about the advanced features of OCaml (objects, 
polymorphic variants) to start with.

> I envisage to learn OCaml deeply and than I want to set the basis to do
> the change from imperative languages to functional ones.

Functional programming is often beneficial. I posted a simple OpenGL demo 
recently:

  http://www.ffconsultancy.com/free/bunny/

Although this is a very array-intensive program, operating on vertex and index 
arrays, it can still leverage functional programming by using the 
higher-order Array.iter and map functions extensively.

> P.S. : somebody have reference books which goes over this subject?

Yes, my book covers this subject (see my sig).

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists