Adding a Little More Class to Diamonds
16.06.08
Last week I discussed some interesting properties of diamonds: namely, how the internal structure of a diamond affects the speed of light and other interesting observations. I also discussed speed in relation to web development, and some choices - such as whether to use an Object Relational Mapping System - that may slow down a web application. We also touched on object-oriented programming (OOP) - the idea of turning programming processes and components into reusable "objects" that can interact with each other in a piece of software.
Working on the 1791diamonds site has got me thinking about ways to model a diamond in an OOP fashion. Everyone knows that diamonds have class - but let's take it one step further and look at how to create a diamond in OOP:
|
![]() |
Create Your Own Famous Diamonds in Minutes
The above programming code is not specific to any programming language, but does use the CLASS keyword, which most programs use to work with basic OOP objects. Having created a class, we can now create new diamonds based on it. Let's have a go:
- The Hope Diamond = New Diamond(45.52,Cushion,Blue,$250,000,000)
- The Heart of Eternity Diamond = New Diamond(27.64,Heart,Vivid Blue,$16,000,000)
- The Cullinan Diamond = New Diamond(3106.75,Various,White,$400,000,000)
Well there you have it - forget about spending billions on your own chemical vapour deposition lab to create your own flawless diamonds, just get programming in your favourite OOP language and create as many diamonds as you want in minutes rather than millennia!
About
Robb is a Web Developer and Designer with over 10 years' experience. He is part of the technical team at 1791 Diamonds Ltd suppliers of diamond engagement rings in gold and platinum settings.


