[erlang-questions] design desicions

Adam Lindberg <>
Wed May 2 09:27:38 CEST 2007


On 5/2/07, jm <> wrote:
> If you are coming from an OOP background an idea that may help is to ask
> the question "should this be a process?" when you would normally create
> a new instance of an object.

Also, another difference is usually that processes are actors, and
objects data containers (generally speaking). Especially in your case.
The individual vehicle processes wouldn't actually do anything
_simultaneously_ (the need for concurrency, thus using processes). The
vehicle implementation should really only contain data (price, model,
and whatnot). Then, as Jeff suggested, you would only need one process
to manage them all (store them in a database such as Mnesia or ETS) to
make sure they are accessed in an orderly fashion, avoiding double
booking etc.

> In this case, I'd guess that each active user session would be a process
> and that there would be one process minding the cars database in an
> initial cut of the software.
>
> Jeff.
>
> Aidan Kane wrote:
> > I'm another newcomer to Erlang that's having a few difficulties
> > understanding how one goes about designing a system from scratch.
> >
> > I've been trying to think about it in terms of rebuilding the system I
> > currently work on which allows users to purchase vehicles via a web
> > interface. At any one time there can easily be 30,000+ vehicles
> > available for sale within the system. obviously the standard rules
> > like two people can't purchase a vehicle at the same time apply.
> >
> > should each vehicle be a process (seems like a lot of processes - very
> > few of whom would ever be active at the same time)? if so, how would
> > the processes be created? would a process run at system start up to
> > create them all?
> >
> > would each active user be a process as well?
> >
> > Sorry that the question is so general. I'm just having a lot of
> > trouble understanding where to start with all this.
> >
> > Thanks.
> > Aidan.
> > _______________________________________________
> > erlang-questions mailing list
> > 
> > http://www.erlang.org/mailman/listinfo/erlang-questions
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://www.erlang.org/mailman/listinfo/erlang-questions
>

Cheers!
Adam
--
Adam Lindberg
Software Developer

Erlang Training and Consulting Ltd
401 Fruit and Wool Exchange,
Brushfield Street, London,
E1 6EL, United Kingdom
Company Registration 3893360 VAT Number GB 752 1091 57
Tel +44 207 456 1020
Fax +44 870 1390 779
Mobile +44 7960 726 016
Email 



More information about the erlang-questions mailing list