Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Ivo Jansch's Blog:
Validating OCL constraints in PHP objects
Nov 15, 2007 @ 14:44:00

While attending a code camp for Xenerix, Ivo Jansch decided to challenge himself to create a way to implement Object Constraint Language functionality in PHP objects.

To give a practical example: if you have a class 'Creditcard', you could define the constraints 'self.limit > 0' when withdrawing an amount. While the goal of the code camp was to do some nifty things with OCL and Ruby, I wanted to see if I could create a method to easily implement OCL constraints in arbitrary PHP objects.

He structures his example similar to the one provided, making CreditCard and Person classes with constraints on the person's name, withdrawing past the expire date of the card and the keeping the limit of the card above zero. He created a OCL wrapper class to handle most of the hard work, but he provides the code examples you'll need to see it in action, complete with constraints.

tagged: ocl constraint object language tutorial class wrapper ocl constraint object language tutorial class wrapper

Link:

Ivo Jansch's Blog:
Validating OCL constraints in PHP objects
Nov 15, 2007 @ 14:44:00

While attending a code camp for Xenerix, Ivo Jansch decided to challenge himself to create a way to implement Object Constraint Language functionality in PHP objects.

To give a practical example: if you have a class 'Creditcard', you could define the constraints 'self.limit > 0' when withdrawing an amount. While the goal of the code camp was to do some nifty things with OCL and Ruby, I wanted to see if I could create a method to easily implement OCL constraints in arbitrary PHP objects.

He structures his example similar to the one provided, making CreditCard and Person classes with constraints on the person's name, withdrawing past the expire date of the card and the keeping the limit of the card above zero. He created a OCL wrapper class to handle most of the hard work, but he provides the code examples you'll need to see it in action, complete with constraints.

tagged: ocl constraint object language tutorial class wrapper ocl constraint object language tutorial class wrapper

Link:


Trending Topics: