This repository has been archived by the owner on Mar 24, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Discussion about the implementation
phpspec edited this page Dec 30, 2011
·
7 revisions
This document is meant to explore an alternative interface for specs in PHPSpec2.
- Keep the focus of the developer on specifying the behaviour of his class
- Eliminate as much as possible unnecessary syntax
- Take into accounts the limitations and possibilities of PHP
- Keep the spec framework maintainable
- Allow for specs to be as readable as possible
Example with the existing code: https://gist.github.com/1540309
- Too much noise from PHP syntax (class, extends, \PHPSpec\Context, function, ->, etc...)
- Not possible to have nested contexts/examples
- Need to use spec() interceptor to add expectations
- Examples names in camel case (not too readable)
- Keeping OO for specs and framework, but addressing problems
- Adding global functions, functional specs, keep PHP syntax noise
- Keeping OO for framework, functional specs, keep PHP syntax noise
- Keeping OO for framework, functional specs, eliminating PHP syntax noise
- Using annotations for defining contexts, more than one @context annotation meaning nested contexts
- Using @let annotation to intercept a subject, instead of $this->spec
- Using @specdox annotation for defining the english version of example
- Only moving the noise from one place to another
- Although editors like text mate allow the method name be created automatically from specdox as you type, we would still have to see the camel case version, polluting the spec
- Not much different than existing code. Easy to implement
- Still most would be familiar PHP code and syntax. Annotations are common now in PHP user land
https://github.com/speciphy/speciphy https://github.com/noonat/pecs
- PHP namespace implementation won't let you use a namespace function in a different namespace. Developers won't be able to namespace their specs with their own chosen namespaces.
- Still a lot of noise from PHP syntax
- Difficult to maintain and extend, not Object Oriented
- Easier to read example descriptions
- Possible to nest contexts
https://gist.github.com/12d67c3ca11b7bd546d7
- Still a lot of noise from PHP syntax
- Easier to read example descriptions
- Possible to nest contexts
- Easier to maintain and extend
https://gist.github.com/4aaffb4a70b6e3c61ce3
https://gist.github.com/457c3ae2357d3a74d7fa
- Need a translator component
- IDEs will not recognise the syntax without plugins
- Developers need to learn the specific syntax
- Completely eliminate language noise
- Easier to read example descriptions
- Possible to nest contexts
- Easier to maintain and extend