Best practices: get/put

Lennart Ohman lennart.ohman@REDACTED
Mon Jan 23 20:36:50 CET 2006


Hi,
the main reason you should avoid get/put is that you revert
to a global variable programming style, difficult to debug
and understand later on.

I would say that records are a good option for a state, since
you can easily extend it as you invent new fields. However
one should of course consider the size of what needs to be
copied (when updating), how often it is done, the need to
make efficient searching-operations and so on. (Records are
tuples behind the scenes).
There usually is no silver bullit. If performance is an issue,
make a few test programs, fill them with *your* data and measure
performance.

Best Regards,
Lennart


-------------------------------------------------------------
Lennart Ohman                   office  : +46-8-587 623 27
Sjoland & Thyselius Telecom AB  cellular: +46-70-552 67 35
Sehlstedtsgatan 6               fax     : +46-8-667 82 30
SE-115 28, STOCKHOLM, SWEDEN    email   : lennart.ohman@REDACTED

-----Original Message-----
From: owner-erlang-questions@REDACTED
[mailto:owner-erlang-questions@REDACTED] On Behalf Of Matheus Degiovani
Sent: Monday, January 23, 2006 9:31 PM
To: erlang-questions@REDACTED
Subject: Best practices: get/put

Hello,

The best practices document says that one should avoid using get/put do 
store data in the process dictionary. I'm guessing that in gen_servers, 
that information should actually be stored in the various State 
parameters/returns, right?

So, my question is: what is the best (or maybe, what's the usual) data 
structure used for storing state information? Trees? Records?

Cya.
-- 
Matheus Degiovani
matheus@REDACTED
http://www.tilt.net
http://clubtilt.net

"Nem mesmo os sábios conseguem enxergar os dois lados" - Gandalf em O 
Senhor dos Anéis de JRR Tolkien.



More information about the erlang-questions mailing list