<div dir="ltr">Hi,<div><br></div><div>I'm attempting to build a system whose engineering challenges will classically benefit from the so-called Object-Oriented Programming paradigm: Specifically, that of encapsulation. However, the real complexity of the problem is that there are going to be millions of objects 'existent in space and time' simultaneously. </div>
<div><br></div><div>The problem domain is analogous to a drawing system: There is a 2D 'canvas onto which several different types of 'shape objects' can be fit into. Once they are all placed on the canvas, it is required that the canvas gets to know all the shapes which seem to coincide with point P (x, y co-ordinates) (or must do similar natured querying of all the shapes without being aware of their details). To find this, the canvas has to ask each shape, in an agnostic/implementation-independent way, whether the object "is_on_point (x,y)".</div>
<div><br></div><div>Thus far, I've gone about modeling each 'shape' as one 'record' in Erlang. I've written some 'utility' functions to determine types of various records. I've also written boilerplate logic in the 'canvas' class to check types and then call appropriate functions. I've also introduced a major convention hell which new programmers will have to understand if they want to add a new type of shape to the system.</div>
<div><br></div><div><br></div><div>Is there a cleaner way of modeling this? Should I be using OTP instead of looking for a way to do this in native Erlang? If yes, what would you suggest is a good supervisor/worker-process model so that such encapusulation and complexity can be achieved? Any examples I can look at?</div>
<div><br></div><div>Regards,</div><div><br></div><div>  -Suraj</div><div><br></div><div>-- <br><div dir="ltr">An Onion is the Onion skin and the Onion under the skin until the Onion Skin without any Onion underneath.<div>
<br></div></div>
</div></div>

<br>
<div><span style="font-family:Arial;background-color:white">______________________________<WBR>______________________________<WBR>_</span></div><span style="font-family:Arial;background-color:white"><font color="#808080">The information contained in this communication is intended solely for the use of the individual or entity to whom it is addressed and others authorized to receive it. It may contain confidential or legally privileged information. If you are not the intended recipient you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this information is strictly prohibited and may be unlawful. If you have received this communication in error, please notify us immediately by responding to this email and then delete it from your system. The firm is neither liable for the proper and complete transmission of the information contained in this communication nor for any delay in its receipt.</font></span>