views:

26

answers:

1

I need to develop a geometry library in python, describing points, lines and planes in 3d space, and various geometry operations. Related to my previous question.

The main issue in the design is if these entities should have identity or not. I was wondering if there's a similar library out there (developed in another language) to take inspiration from, what is the chosen design, and in particular the reason for one choice vs. the other.

+1  A: 

I am not familiar with other libraries, but it seems that there 3d points should be (immutable) value objects. - allows sharing of a point between several containers (lines, planes, etc.) - Avoids defensive getters and setters - In real-life a 3d point has no identity.

Also, Josh Bloch is saying (see http://www.infoq.com/presentations/effective-api-design ) that one of the mistakes they did in the design of Java's standard library was that they did not define the Size class as immutable.

Itay