Friday, July 4, 2008

Identifying with uuid.

I've noticed that a good way to uniquely identify software objects is using uuid. Python has a built-in uuid module that allows developers to generate unique ids when needed. The notion of uniquely identifying software objects is old news and hence not really news at all.

However, when keeping in mind that you way want a given software object to be uniquely identifiable in environments remote to the environment in which the object was constructed, you may want every object in your system to have a uuid.

This is easy to achieve in Python, and any other language with uuid support for that matter. Simply create a base class that will act as the unique indentifier generator. This class should hold an id attribute which stores the generated uuid. Any class you implement for this point on can inherit form this base class if they need a uuid.

No comments :

Post a Comment