Suggestion about Phexample and StateSpecs(Mocketry) integration

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
20 messages Options
Reply | Threaded
Open this post in threaded view
|

Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
Hello

I think you read about Mocketry and know that It provides same "should syntax" DSL like project Phexample.

There is problem between two projects. We both implement #should message in Object class. So when somebody want Phexample Mocketry become broken and vice versa.

In the past I actually only read about Phexample tests reusage idea with #given message. And I didn't know that It provides "should syntax" too.
Now I read about it and look at code (thank's Yuriy Tymchuk) and I have some suggestions about it.

First few words about state of Mocketry project.

Mocketry is not based on SSpec (I was google such wrong opinion). It is just implement SSpec idea about executable specifications and "should syntax".
And specifications part with DSL was extracted from Mocketry to StateSpecs project. So Mocketry is only about mocks and behaviour specs.

Idea of executable specifications is not about replacement "assert syntax" with "should syntax". It is about building reusable first class objects which can validate domain objects. For example there are EqualitySpec, ElementsCountSpec, ClassSpec. All this specs present "valid state" of objects. They know how to validate objects.
State specs can be used in tests, UI and any other domain where you want put descriptions about what it mean "valid object".
I start use StateSpecs in Presenty to build object editor. With specs I put requirements on model aspects.
I am sure Magritte provides something similar in description objects.

So StateSpecs solve very general problem: how to describe validation rules for objects and how to make such descriptions reusable.
To make it convenient and readable StateSpecs provides two kind of DSL:

- should syntax to immediately check object state
- first class words to create spec instances with more readable way: Instance of: SomeClass, Equal to: #some, Containing item: arrayItem and others

First option can be used in tests instead #assert: expressions. Last can be used in mock message arguments.

StateSpecs provide very simple way to extend it DSL based on pragmas:

Instance of: aClass
    <syntax: #(be an instance of:)>
    ^ClassSpec for: aClass

Equal to: anObject
    <syntax: #(equal:)>
    <syntax: #(be equal:)>
    ^self return: (EqualitySpec pattern: anObject)

Containing item: anObject
    <syntax: #(include:)>
    ^ElementContainmentSpec requiredElement: anObject

And with this you can write:

object should be an instance of: SomeClass
object should equal: #some
object should be equal: #some
array should include: item.

So with such approach both kind of DSL extended at one place.

Ok. Now my main suggestion. Let's Phexample use StateSpecs for "should syntax".
I can provide all "should protocol" of Phexample in StateSpecs. So it will be transparent for current users. It just few extra pragmas and classes in StateSpecs-DSL package. Maybe it is already done by Yuriy Tymchuk.
With such integration both projects will just improved.

What do you think?

Best regards,
Denis
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Camillo Bruni-3

On 2013-03-25, at 21:24, Denis Kudriashov <[hidden email]> wrote:

> Hello
>
> I think you read about Mocketry and know that It provides same "should
> syntax" DSL like project Phexample.
>
> There is problem between two projects. We both implement #should message in
> Object class. So when somebody want Phexample Mocketry become broken and
> vice versa.
>
> In the past I actually only read about Phexample tests reusage idea with
> #given message. And I didn't know that It provides "should syntax" too.
> Now I read about it and look at code (thank's Yuriy Tymchuk) and I have
> some suggestions about it.
>
> First few words about state of Mocketry project.
>
> Mocketry is not based on SSpec (I was google such wrong opinion). It is
> just implement SSpec idea about executable specifications and "should
> syntax".
> And specifications part with DSL was extracted from Mocketry to StateSpecs
> project. So Mocketry is only about mocks and behaviour specs.
>
> Idea of executable specifications is not about replacement "assert syntax"
> with "should syntax". It is about building reusable first class objects
> which can validate domain objects. For example there are EqualitySpec,
> ElementsCountSpec, ClassSpec. All this specs present "valid state" of
> objects. They know how to validate objects.
> State specs can be used in tests, UI and any other domain where you want
> put descriptions about what it mean "valid object".
> I start use StateSpecs in Presenty to build object editor. With specs I put
> requirements on model aspects.
> I am sure Magritte provides something similar in description objects.
>
> So StateSpecs solve very general problem: how to describe validation rules
> for objects and how to make such descriptions reusable.
> To make it convenient and readable StateSpecs provides two kind of DSL:
>
> - should syntax to immediately check object state
> - first class words to create spec instances with more readable way:
> Instance of: SomeClass, Equal to: #some, Containing item: arrayItem and
> others
>
> First option can be used in tests instead #assert: expressions. Last can be
> used in mock message arguments.
>
> StateSpecs provide very simple way to extend it DSL based on pragmas:
>
> Instance of: aClass
>   <syntax: #(be an instance of:)>
>   ^ClassSpec for: aClass
>
> Equal to: anObject
>   <syntax: #(equal:)>
>   <syntax: #(be equal:)>
>   ^self return: (EqualitySpec pattern: anObject)
>
> Containing item: anObject
>   <syntax: #(include:)>
>   ^ElementContainmentSpec requiredElement: anObject
>
> And with this you can write:
>
> object should be an instance of: SomeClass
> object should equal: #some
> object should be equal: #some
> array should include: item.
>
> So with such approach both kind of DSL extended at one place.
>
> Ok. Now my main suggestion. Let's Phexample use StateSpecs for "should
> syntax".
> I can provide all "should protocol" of Phexample in StateSpecs. So it will
> be transparent for current users. It just few extra pragmas and classes in
> StateSpecs-DSL package. Maybe it is already done by Yuriy Tymchuk.
> With such integration both projects will just improved.
>
> What do you think?

humm I have ambigous feelings about that.
Definitely StateSpec looks more mature and can be used in a more flexible way.
But I am not a big fan of the pragma magic. Why?
It breaks all tools for me :/. If I see a message send I want to be able to:
- browse it, so I can see who implements it?
- debug it directly to get to the real method.

SateSpec does indeed help writing readable code by allowing almost grammatically
correct sentences. However I don't think this is the way to program. I am a big
fan of stupid english:

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

If I want to figure out how the first one works, I can simply browse the
implementors of #should and/or #isKindOf: where is the StateSpec version I am
lost. I have to rely on "contains string literal" to get the sources, for me
that is very strange.

So personally I would go for the simple solution that doesn't introduce yet
another indirection meta-level using the pragmas.

For me, complex DSLs only work if you write the proper debugging tools for it.

Sorry for so much negative energy :) but you can try to convince me otherwise :)




Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Uko2
I think that we can implement all basic messages like isTrue, isKindOf: , so you'll be able to write it and browse it. Also people will be able to decide in what form they want to write tests. I think that it's nice to have such flexible tool as StateSpec

Надіслано з iPhone

25 бер. 2013 о 22:28 Camillo Bruni <[hidden email]> написав(ла):

>
> On 2013-03-25, at 21:24, Denis Kudriashov <[hidden email]> wrote:
>
>> Hello
>>
>> I think you read about Mocketry and know that It provides same "should
>> syntax" DSL like project Phexample.
>>
>> There is problem between two projects. We both implement #should message in
>> Object class. So when somebody want Phexample Mocketry become broken and
>> vice versa.
>>
>> In the past I actually only read about Phexample tests reusage idea with
>> #given message. And I didn't know that It provides "should syntax" too.
>> Now I read about it and look at code (thank's Yuriy Tymchuk) and I have
>> some suggestions about it.
>>
>> First few words about state of Mocketry project.
>>
>> Mocketry is not based on SSpec (I was google such wrong opinion). It is
>> just implement SSpec idea about executable specifications and "should
>> syntax".
>> And specifications part with DSL was extracted from Mocketry to StateSpecs
>> project. So Mocketry is only about mocks and behaviour specs.
>>
>> Idea of executable specifications is not about replacement "assert syntax"
>> with "should syntax". It is about building reusable first class objects
>> which can validate domain objects. For example there are EqualitySpec,
>> ElementsCountSpec, ClassSpec. All this specs present "valid state" of
>> objects. They know how to validate objects.
>> State specs can be used in tests, UI and any other domain where you want
>> put descriptions about what it mean "valid object".
>> I start use StateSpecs in Presenty to build object editor. With specs I put
>> requirements on model aspects.
>> I am sure Magritte provides something similar in description objects.
>>
>> So StateSpecs solve very general problem: how to describe validation rules
>> for objects and how to make such descriptions reusable.
>> To make it convenient and readable StateSpecs provides two kind of DSL:
>>
>> - should syntax to immediately check object state
>> - first class words to create spec instances with more readable way:
>> Instance of: SomeClass, Equal to: #some, Containing item: arrayItem and
>> others
>>
>> First option can be used in tests instead #assert: expressions. Last can be
>> used in mock message arguments.
>>
>> StateSpecs provide very simple way to extend it DSL based on pragmas:
>>
>> Instance of: aClass
>>  <syntax: #(be an instance of:)>
>>  ^ClassSpec for: aClass
>>
>> Equal to: anObject
>>  <syntax: #(equal:)>
>>  <syntax: #(be equal:)>
>>  ^self return: (EqualitySpec pattern: anObject)
>>
>> Containing item: anObject
>>  <syntax: #(include:)>
>>  ^ElementContainmentSpec requiredElement: anObject
>>
>> And with this you can write:
>>
>> object should be an instance of: SomeClass
>> object should equal: #some
>> object should be equal: #some
>> array should include: item.
>>
>> So with such approach both kind of DSL extended at one place.
>>
>> Ok. Now my main suggestion. Let's Phexample use StateSpecs for "should
>> syntax".
>> I can provide all "should protocol" of Phexample in StateSpecs. So it will
>> be transparent for current users. It just few extra pragmas and classes in
>> StateSpecs-DSL package. Maybe it is already done by Yuriy Tymchuk.
>> With such integration both projects will just improved.
>>
>> What do you think?
>
> humm I have ambigous feelings about that.
> Definitely StateSpec looks more mature and can be used in a more flexible way.
> But I am not a big fan of the pragma magic. Why?
> It breaks all tools for me :/. If I see a message send I want to be able to:
> - browse it, so I can see who implements it?
> - debug it directly to get to the real method.
>
> SateSpec does indeed help writing readable code by allowing almost grammatically
> correct sentences. However I don't think this is the way to program. I am a big
> fan of stupid english:
>
> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>
> If I want to figure out how the first one works, I can simply browse the
> implementors of #should and/or #isKindOf: where is the StateSpec version I am
> lost. I have to rely on "contains string literal" to get the sources, for me
> that is very strange.
>
> So personally I would go for the simple solution that doesn't introduce yet
> another indirection meta-level using the pragmas.
>
> For me, complex DSLs only work if you write the proper debugging tools for it.
>
> Sorry for so much negative energy :) but you can try to convince me otherwise :)
>
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
In reply to this post by Camillo Bruni-3
Hello
2013/3/26 Camillo Bruni <[hidden email]>
Definitely StateSpec looks more mature and can be used in a more flexible way.
But I am not a big fan of the pragma magic. Why?
It breaks all tools for me :/. If I see a message send I want to be able to:
- browse it, so I can see who implements it?
- debug it directly to get to the real method.

SateSpec does indeed help writing readable code by allowing almost grammatically
correct sentences. However I don't think this is the way to program. I am a big
fan of stupid english:

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

If I want to figure out how the first one works, I can simply browse the
implementors of #should and/or #isKindOf: where is the StateSpec version I am
lost. I have to rely on "contains string literal" to get the sources, for me
that is very strange.

I think main thing you want is easilly explore all available should syntax. And StateSpecs can be easilly adopted for such task. We can just move all methods with syntax pragmas to single class. So you can open this class and see what available.

To get implementors of some "should expression" you should use senders search of syntax words instead of implementors. Syntax words in StateSpecs is just method literals ( <syntax: #(be an instance of:)>, #() is just array of symbols).

Interesting that StateSpecs has more explicit syntax system. How you can explore in Phexample expression:

object should be true
?

You have separate PheMatcher>>be and PheMatcher>>true methods and there is no places in code where you can see that this messages can and should be used together.
But with StateSpecs you should put pragma with explicit expression like:

Equal>>true: anObject
    <syntax: #(be true)>
    ^self return: (IdentitySpec pattern: true)

So with StateSpecs you have full syntax expression at one place which can be easy explored.
And for example to support Phexample mesage #beTrue you should just add another pragma:

Equal>>true: anObject
    <syntax: #(be true)>
    <syntax: #(beTrue)>
    ^self return: (IdentitySpec pattern: true)

So with Phexample you can browse implementors of "single word should expressions". But with Phexample if you browse implementors of #be like messages you have no idea how it can be used.
In StateSpecs you should use senders. And with StateSpecs if you browse "any syntax word implementors" by senders seach you will see all possible usage cases. And if I move all methods with syntax pragmas to single class you can easilly see all possible expressions in one place.

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

With StateSpecs it should be

foo should be a kind of: Bar

And as I said before It is simple task to support all Phexample expressions by StateSpecs pragmas

Best regards,
Denis

Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Tudor Girba-2
In reply to this post by Camillo Bruni-3
Hi,

I agree with Camillo.

When implementing anything you need to think of the costs associated with assessing it.

Cheers,
Doru


On Mar 25, 2013, at 10:28 PM, Camillo Bruni <[hidden email]> wrote:

>
> On 2013-03-25, at 21:24, Denis Kudriashov <[hidden email]> wrote:
>
>> Hello
>>
>> I think you read about Mocketry and know that It provides same "should
>> syntax" DSL like project Phexample.
>>
>> There is problem between two projects. We both implement #should message in
>> Object class. So when somebody want Phexample Mocketry become broken and
>> vice versa.
>>
>> In the past I actually only read about Phexample tests reusage idea with
>> #given message. And I didn't know that It provides "should syntax" too.
>> Now I read about it and look at code (thank's Yuriy Tymchuk) and I have
>> some suggestions about it.
>>
>> First few words about state of Mocketry project.
>>
>> Mocketry is not based on SSpec (I was google such wrong opinion). It is
>> just implement SSpec idea about executable specifications and "should
>> syntax".
>> And specifications part with DSL was extracted from Mocketry to StateSpecs
>> project. So Mocketry is only about mocks and behaviour specs.
>>
>> Idea of executable specifications is not about replacement "assert syntax"
>> with "should syntax". It is about building reusable first class objects
>> which can validate domain objects. For example there are EqualitySpec,
>> ElementsCountSpec, ClassSpec. All this specs present "valid state" of
>> objects. They know how to validate objects.
>> State specs can be used in tests, UI and any other domain where you want
>> put descriptions about what it mean "valid object".
>> I start use StateSpecs in Presenty to build object editor. With specs I put
>> requirements on model aspects.
>> I am sure Magritte provides something similar in description objects.
>>
>> So StateSpecs solve very general problem: how to describe validation rules
>> for objects and how to make such descriptions reusable.
>> To make it convenient and readable StateSpecs provides two kind of DSL:
>>
>> - should syntax to immediately check object state
>> - first class words to create spec instances with more readable way:
>> Instance of: SomeClass, Equal to: #some, Containing item: arrayItem and
>> others
>>
>> First option can be used in tests instead #assert: expressions. Last can be
>> used in mock message arguments.
>>
>> StateSpecs provide very simple way to extend it DSL based on pragmas:
>>
>> Instance of: aClass
>>  <syntax: #(be an instance of:)>
>>  ^ClassSpec for: aClass
>>
>> Equal to: anObject
>>  <syntax: #(equal:)>
>>  <syntax: #(be equal:)>
>>  ^self return: (EqualitySpec pattern: anObject)
>>
>> Containing item: anObject
>>  <syntax: #(include:)>
>>  ^ElementContainmentSpec requiredElement: anObject
>>
>> And with this you can write:
>>
>> object should be an instance of: SomeClass
>> object should equal: #some
>> object should be equal: #some
>> array should include: item.
>>
>> So with such approach both kind of DSL extended at one place.
>>
>> Ok. Now my main suggestion. Let's Phexample use StateSpecs for "should
>> syntax".
>> I can provide all "should protocol" of Phexample in StateSpecs. So it will
>> be transparent for current users. It just few extra pragmas and classes in
>> StateSpecs-DSL package. Maybe it is already done by Yuriy Tymchuk.
>> With such integration both projects will just improved.
>>
>> What do you think?
>
> humm I have ambigous feelings about that.
> Definitely StateSpec looks more mature and can be used in a more flexible way.
> But I am not a big fan of the pragma magic. Why?
> It breaks all tools for me :/. If I see a message send I want to be able to:
> - browse it, so I can see who implements it?
> - debug it directly to get to the real method.
>
> SateSpec does indeed help writing readable code by allowing almost grammatically
> correct sentences. However I don't think this is the way to program. I am a big
> fan of stupid english:
>
> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>
> If I want to figure out how the first one works, I can simply browse the
> implementors of #should and/or #isKindOf: where is the StateSpec version I am
> lost. I have to rely on "contains string literal" to get the sources, for me
> that is very strange.
>
> So personally I would go for the simple solution that doesn't introduce yet
> another indirection meta-level using the pragmas.
>
> For me, complex DSLs only work if you write the proper debugging tools for it.
>
> Sorry for so much negative energy :) but you can try to convince me otherwise :)
>
>
>
>

--
www.tudorgirba.com

"Problem solving efficiency grows with the abstractness level of problem understanding."




Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

stephane ducasse
In reply to this post by Camillo Bruni-3

On Mar 25, 2013, at 10:28 PM, Camillo Bruni <[hidden email]> wrote:

I am a big
fan of stupid english:

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

+ 1



Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

stephane ducasse
In reply to this post by Denis Kudriashov

On Mar 26, 2013, at 7:46 AM, Denis Kudriashov <[hidden email]> wrote:

If I want to figure out how the first one works, I can simply browse the
implementors of #should and/or #isKindOf: where is the StateSpec version I am
lost. I have to rely on "contains string literal" to get the sources, for me
that is very strange.

+1

Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Uko2
In reply to this post by Denis Kudriashov
Ok, and what if we will change behavior a bit so if no definitions were found it will send the incoming message to enclosed object? This way it will work like phexample but will also allow to define some fancy DSL.

On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:

Hello
2013/3/26 Camillo Bruni <[hidden email]>
Definitely StateSpec looks more mature and can be used in a more flexible way.
But I am not a big fan of the pragma magic. Why?
It breaks all tools for me :/. If I see a message send I want to be able to:
- browse it, so I can see who implements it?
- debug it directly to get to the real method.

SateSpec does indeed help writing readable code by allowing almost grammatically
correct sentences. However I don't think this is the way to program. I am a big
fan of stupid english:

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

If I want to figure out how the first one works, I can simply browse the
implementors of #should and/or #isKindOf: where is the StateSpec version I am
lost. I have to rely on "contains string literal" to get the sources, for me
that is very strange.

I think main thing you want is easilly explore all available should syntax. And StateSpecs can be easilly adopted for such task. We can just move all methods with syntax pragmas to single class. So you can open this class and see what available.

To get implementors of some "should expression" you should use senders search of syntax words instead of implementors. Syntax words in StateSpecs is just method literals ( <syntax: #(be an instance of:)>, #() is just array of symbols).

Interesting that StateSpecs has more explicit syntax system. How you can explore in Phexample expression:

object should be true
?

You have separate PheMatcher>>be and PheMatcher>>true methods and there is no places in code where you can see that this messages can and should be used together.
But with StateSpecs you should put pragma with explicit expression like:

Equal>>true: anObject
    <syntax: #(be true)>
    ^self return: (IdentitySpec pattern: true)

So with StateSpecs you have full syntax expression at one place which can be easy explored.
And for example to support Phexample mesage #beTrue you should just add another pragma:

Equal>>true: anObject
    <syntax: #(be true)>
    <syntax: #(beTrue)>
    ^self return: (IdentitySpec pattern: true)

So with Phexample you can browse implementors of "single word should expressions". But with Phexample if you browse implementors of #be like messages you have no idea how it can be used.
In StateSpecs you should use senders. And with StateSpecs if you browse "any syntax word implementors" by senders seach you will see all possible usage cases. And if I move all methods with syntax pragmas to single class you can easilly see all possible expressions in one place.

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

With StateSpecs it should be

foo should be a kind of: Bar

And as I said before It is simple task to support all Phexample expressions by StateSpecs pragmas

Best regards,
Denis


Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
2013/3/26 Yuriy Tymchuk <[hidden email]>
Ok, and what if we will change behavior a bit so if no definitions were found it will send the incoming message to enclosed object? This way it will work like phexample but will also allow to define some fancy DSL.

We can copy all phexample syntax methods into single class inside StateSpecs package but replace implementation with pragmas approach. So anybody can browse implementors like usual and it will not required any special cases.

How I can influence your interest, guys? I can provide cleaning, comments, improvements to StateSpecs. I opened for your requirements.
Phexample become quite popular and can be part of Pharo sometimes. Mocketry/StateSpecs used by people too.
It would be bad if this packages can't be used together.
 

On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:

Hello
2013/3/26 Camillo Bruni <[hidden email]>
Definitely StateSpec looks more mature and can be used in a more flexible way.
But I am not a big fan of the pragma magic. Why?
It breaks all tools for me :/. If I see a message send I want to be able to:
- browse it, so I can see who implements it?
- debug it directly to get to the real method.

SateSpec does indeed help writing readable code by allowing almost grammatically
correct sentences. However I don't think this is the way to program. I am a big
fan of stupid english:

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

If I want to figure out how the first one works, I can simply browse the
implementors of #should and/or #isKindOf: where is the StateSpec version I am
lost. I have to rely on "contains string literal" to get the sources, for me
that is very strange.

I think main thing you want is easilly explore all available should syntax. And StateSpecs can be easilly adopted for such task. We can just move all methods with syntax pragmas to single class. So you can open this class and see what available.

To get implementors of some "should expression" you should use senders search of syntax words instead of implementors. Syntax words in StateSpecs is just method literals ( <syntax: #(be an instance of:)>, #() is just array of symbols).

Interesting that StateSpecs has more explicit syntax system. How you can explore in Phexample expression:

object should be true
?

You have separate PheMatcher>>be and PheMatcher>>true methods and there is no places in code where you can see that this messages can and should be used together.
But with StateSpecs you should put pragma with explicit expression like:

Equal>>true: anObject
    <syntax: #(be true)>
    ^self return: (IdentitySpec pattern: true)

So with StateSpecs you have full syntax expression at one place which can be easy explored.
And for example to support Phexample mesage #beTrue you should just add another pragma:

Equal>>true: anObject
    <syntax: #(be true)>
    <syntax: #(beTrue)>
    ^self return: (IdentitySpec pattern: true)

So with Phexample you can browse implementors of "single word should expressions". But with Phexample if you browse implementors of #be like messages you have no idea how it can be used.
In StateSpecs you should use senders. And with StateSpecs if you browse "any syntax word implementors" by senders seach you will see all possible usage cases. And if I move all methods with syntax pragmas to single class you can easilly see all possible expressions in one place.

`foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`

With StateSpecs it should be

foo should be a kind of: Bar

And as I said before It is simple task to support all Phexample expressions by StateSpecs pragmas

Best regards,
Denis



Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Camillo Bruni-3

On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:

> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>
>> Ok, and what if we will change behavior a bit so if no definitions were
>> found it will send the incoming message to enclosed object? This way it
>> will work like phexample but will also allow to define some fancy DSL.
>>
>
> We can copy all phexample syntax methods into single class inside
> StateSpecs package but replace implementation with pragmas approach. So
> anybody can browse implementors like usual and it will not required any
> special cases.
>
> How I can influence your interest, guys? I can provide cleaning, comments,
> improvements to StateSpecs. I opened for your requirements.
> Phexample become quite popular and can be part of Pharo sometimes.
> Mocketry/StateSpecs used by people too.
> It would be bad if this packages can't be used together.

sorry for starting the whole rant :) I am veery busy at least until tomorrow

Yuriy we can discuss that after tomorrow?
I would as well appreciate some common solution to avoid the selector clash.



>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>
>> Hello
>> 2013/3/26 Camillo Bruni <[hidden email]>
>>
>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>> way.
>>> But I am not a big fan of the pragma magic. Why?
>>> It breaks all tools for me :/. If I see a message send I want to be able
>>> to:
>>> - browse it, so I can see who implements it?
>>> - debug it directly to get to the real method.
>>>
>>> SateSpec does indeed help writing readable code by allowing almost
>>> grammatically
>>> correct sentences. However I don't think this is the way to program. I am
>>> a big
>>> fan of stupid english:
>>>
>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>
>>> If I want to figure out how the first one works, I can simply browse the
>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>> I am
>>> lost. I have to rely on "contains string literal" to get the sources, for
>>> me
>>> that is very strange.
>>>
>>
>> I think main thing you want is easilly explore all available should
>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>> move all methods with syntax pragmas to single class. So you can open this
>> class and see what available.
>>
>> To get implementors of some "should expression" you should use senders
>> search of syntax words instead of implementors. Syntax words in StateSpecs
>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>> array of symbols).
>>
>> Interesting that StateSpecs has more explicit syntax system. How you can
>> explore in Phexample expression:
>>
>> object should be true
>> ?
>>
>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>> no places in code where you can see that this messages can and should be
>> used together.
>> But with StateSpecs you should put pragma with explicit expression like:
>>
>> Equal>>true: anObject
>>    <syntax: #(be true)>
>>    ^self return: (IdentitySpec pattern: true)
>>
>> So with StateSpecs you have full syntax expression at one place which can
>> be easy explored.
>> And for example to support Phexample mesage #beTrue you should just add
>> another pragma:
>>
>> Equal>>true: anObject
>>    <syntax: #(be true)>
>>    <syntax: #(beTrue)>
>>    ^self return: (IdentitySpec pattern: true)
>>
>> So with Phexample you can browse implementors of "single word should
>> expressions". But with Phexample if you browse implementors of #be like
>> messages you have no idea how it can be used.
>> In StateSpecs you should use senders. And with StateSpecs if you browse
>> "any syntax word implementors" by senders seach you will see all possible
>> usage cases. And if I move all methods with syntax pragmas to single class
>> you can easilly see all possible expressions in one place.
>>
>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>
>>
>> With StateSpecs it should be
>>
>> foo should be a kind of: Bar
>>
>> And as I said before It is simple task to support all Phexample
>> expressions by StateSpecs pragmas
>>
>> Best regards,
>> Denis
>>
>>
>>


Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Uko2
Sounds good to me.

On 26 бер. 2013, at 23:00, Camillo Bruni <[hidden email]> wrote:

>
> On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:
>
>> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>>
>>> Ok, and what if we will change behavior a bit so if no definitions were
>>> found it will send the incoming message to enclosed object? This way it
>>> will work like phexample but will also allow to define some fancy DSL.
>>>
>>
>> We can copy all phexample syntax methods into single class inside
>> StateSpecs package but replace implementation with pragmas approach. So
>> anybody can browse implementors like usual and it will not required any
>> special cases.
>>
>> How I can influence your interest, guys? I can provide cleaning, comments,
>> improvements to StateSpecs. I opened for your requirements.
>> Phexample become quite popular and can be part of Pharo sometimes.
>> Mocketry/StateSpecs used by people too.
>> It would be bad if this packages can't be used together.
>
> sorry for starting the whole rant :) I am veery busy at least until tomorrow
>
> Yuriy we can discuss that after tomorrow?
> I would as well appreciate some common solution to avoid the selector clash.
>
>
>
>>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>>
>>> Hello
>>> 2013/3/26 Camillo Bruni <[hidden email]>
>>>
>>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>>> way.
>>>> But I am not a big fan of the pragma magic. Why?
>>>> It breaks all tools for me :/. If I see a message send I want to be able
>>>> to:
>>>> - browse it, so I can see who implements it?
>>>> - debug it directly to get to the real method.
>>>>
>>>> SateSpec does indeed help writing readable code by allowing almost
>>>> grammatically
>>>> correct sentences. However I don't think this is the way to program. I am
>>>> a big
>>>> fan of stupid english:
>>>>
>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>
>>>> If I want to figure out how the first one works, I can simply browse the
>>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>>> I am
>>>> lost. I have to rely on "contains string literal" to get the sources, for
>>>> me
>>>> that is very strange.
>>>>
>>>
>>> I think main thing you want is easilly explore all available should
>>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>>> move all methods with syntax pragmas to single class. So you can open this
>>> class and see what available.
>>>
>>> To get implementors of some "should expression" you should use senders
>>> search of syntax words instead of implementors. Syntax words in StateSpecs
>>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>>> array of symbols).
>>>
>>> Interesting that StateSpecs has more explicit syntax system. How you can
>>> explore in Phexample expression:
>>>
>>> object should be true
>>> ?
>>>
>>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>>> no places in code where you can see that this messages can and should be
>>> used together.
>>> But with StateSpecs you should put pragma with explicit expression like:
>>>
>>> Equal>>true: anObject
>>>   <syntax: #(be true)>
>>>   ^self return: (IdentitySpec pattern: true)
>>>
>>> So with StateSpecs you have full syntax expression at one place which can
>>> be easy explored.
>>> And for example to support Phexample mesage #beTrue you should just add
>>> another pragma:
>>>
>>> Equal>>true: anObject
>>>   <syntax: #(be true)>
>>>   <syntax: #(beTrue)>
>>>   ^self return: (IdentitySpec pattern: true)
>>>
>>> So with Phexample you can browse implementors of "single word should
>>> expressions". But with Phexample if you browse implementors of #be like
>>> messages you have no idea how it can be used.
>>> In StateSpecs you should use senders. And with StateSpecs if you browse
>>> "any syntax word implementors" by senders seach you will see all possible
>>> usage cases. And if I move all methods with syntax pragmas to single class
>>> you can easilly see all possible expressions in one place.
>>>
>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>
>>>
>>> With StateSpecs it should be
>>>
>>> foo should be a kind of: Bar
>>>
>>> And as I said before It is simple task to support all Phexample
>>> expressions by StateSpecs pragmas
>>>
>>> Best regards,
>>> Denis
>>>
>>>
>>>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Tudor Girba-2
Perhaps Mocketry would be a good topic for a "Show us your projects" session. Then we can try to go into a couple of more details.

Cheers,
Doru


On Mar 27, 2013, at 12:42 AM, Yuriy Tymchuk <[hidden email]> wrote:

> Sounds good to me.
>
> On 26 бер. 2013, at 23:00, Camillo Bruni <[hidden email]> wrote:
>
>>
>> On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:
>>
>>> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>>>
>>>> Ok, and what if we will change behavior a bit so if no definitions were
>>>> found it will send the incoming message to enclosed object? This way it
>>>> will work like phexample but will also allow to define some fancy DSL.
>>>>
>>>
>>> We can copy all phexample syntax methods into single class inside
>>> StateSpecs package but replace implementation with pragmas approach. So
>>> anybody can browse implementors like usual and it will not required any
>>> special cases.
>>>
>>> How I can influence your interest, guys? I can provide cleaning, comments,
>>> improvements to StateSpecs. I opened for your requirements.
>>> Phexample become quite popular and can be part of Pharo sometimes.
>>> Mocketry/StateSpecs used by people too.
>>> It would be bad if this packages can't be used together.
>>
>> sorry for starting the whole rant :) I am veery busy at least until tomorrow
>>
>> Yuriy we can discuss that after tomorrow?
>> I would as well appreciate some common solution to avoid the selector clash.
>>
>>
>>
>>>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>>>
>>>> Hello
>>>> 2013/3/26 Camillo Bruni <[hidden email]>
>>>>
>>>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>>>> way.
>>>>> But I am not a big fan of the pragma magic. Why?
>>>>> It breaks all tools for me :/. If I see a message send I want to be able
>>>>> to:
>>>>> - browse it, so I can see who implements it?
>>>>> - debug it directly to get to the real method.
>>>>>
>>>>> SateSpec does indeed help writing readable code by allowing almost
>>>>> grammatically
>>>>> correct sentences. However I don't think this is the way to program. I am
>>>>> a big
>>>>> fan of stupid english:
>>>>>
>>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>> If I want to figure out how the first one works, I can simply browse the
>>>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>>>> I am
>>>>> lost. I have to rely on "contains string literal" to get the sources, for
>>>>> me
>>>>> that is very strange.
>>>>>
>>>>
>>>> I think main thing you want is easilly explore all available should
>>>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>>>> move all methods with syntax pragmas to single class. So you can open this
>>>> class and see what available.
>>>>
>>>> To get implementors of some "should expression" you should use senders
>>>> search of syntax words instead of implementors. Syntax words in StateSpecs
>>>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>>>> array of symbols).
>>>>
>>>> Interesting that StateSpecs has more explicit syntax system. How you can
>>>> explore in Phexample expression:
>>>>
>>>> object should be true
>>>> ?
>>>>
>>>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>>>> no places in code where you can see that this messages can and should be
>>>> used together.
>>>> But with StateSpecs you should put pragma with explicit expression like:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with StateSpecs you have full syntax expression at one place which can
>>>> be easy explored.
>>>> And for example to support Phexample mesage #beTrue you should just add
>>>> another pragma:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  <syntax: #(beTrue)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with Phexample you can browse implementors of "single word should
>>>> expressions". But with Phexample if you browse implementors of #be like
>>>> messages you have no idea how it can be used.
>>>> In StateSpecs you should use senders. And with StateSpecs if you browse
>>>> "any syntax word implementors" by senders seach you will see all possible
>>>> usage cases. And if I move all methods with syntax pragmas to single class
>>>> you can easilly see all possible expressions in one place.
>>>>
>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>
>>>> With StateSpecs it should be
>>>>
>>>> foo should be a kind of: Bar
>>>>
>>>> And as I said before It is simple task to support all Phexample
>>>> expressions by StateSpecs pragmas
>>>>
>>>> Best regards,
>>>> Denis
>>>>
>>>>
>>>>
>>
>>
>
>

--
www.tudorgirba.com

"Sometimes the best solution is not the best solution."


Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
2013/3/27 Tudor Girba <[hidden email]>
Perhaps Mocketry would be a good topic for a "Show us your projects" session. Then we can try to go into a couple of more details.


Unfortunately I can't participate conference this year
 
Cheers,
Doru


On Mar 27, 2013, at 12:42 AM, Yuriy Tymchuk <[hidden email]> wrote:

> Sounds good to me.
>
> On 26 бер. 2013, at 23:00, Camillo Bruni <[hidden email]> wrote:
>
>>
>> On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:
>>
>>> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>>>
>>>> Ok, and what if we will change behavior a bit so if no definitions were
>>>> found it will send the incoming message to enclosed object? This way it
>>>> will work like phexample but will also allow to define some fancy DSL.
>>>>
>>>
>>> We can copy all phexample syntax methods into single class inside
>>> StateSpecs package but replace implementation with pragmas approach. So
>>> anybody can browse implementors like usual and it will not required any
>>> special cases.
>>>
>>> How I can influence your interest, guys? I can provide cleaning, comments,
>>> improvements to StateSpecs. I opened for your requirements.
>>> Phexample become quite popular and can be part of Pharo sometimes.
>>> Mocketry/StateSpecs used by people too.
>>> It would be bad if this packages can't be used together.
>>
>> sorry for starting the whole rant :) I am veery busy at least until tomorrow
>>
>> Yuriy we can discuss that after tomorrow?
>> I would as well appreciate some common solution to avoid the selector clash.
>>
>>
>>
>>>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>>>
>>>> Hello
>>>> 2013/3/26 Camillo Bruni <[hidden email]>
>>>>
>>>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>>>> way.
>>>>> But I am not a big fan of the pragma magic. Why?
>>>>> It breaks all tools for me :/. If I see a message send I want to be able
>>>>> to:
>>>>> - browse it, so I can see who implements it?
>>>>> - debug it directly to get to the real method.
>>>>>
>>>>> SateSpec does indeed help writing readable code by allowing almost
>>>>> grammatically
>>>>> correct sentences. However I don't think this is the way to program. I am
>>>>> a big
>>>>> fan of stupid english:
>>>>>
>>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>> If I want to figure out how the first one works, I can simply browse the
>>>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>>>> I am
>>>>> lost. I have to rely on "contains string literal" to get the sources, for
>>>>> me
>>>>> that is very strange.
>>>>>
>>>>
>>>> I think main thing you want is easilly explore all available should
>>>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>>>> move all methods with syntax pragmas to single class. So you can open this
>>>> class and see what available.
>>>>
>>>> To get implementors of some "should expression" you should use senders
>>>> search of syntax words instead of implementors. Syntax words in StateSpecs
>>>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>>>> array of symbols).
>>>>
>>>> Interesting that StateSpecs has more explicit syntax system. How you can
>>>> explore in Phexample expression:
>>>>
>>>> object should be true
>>>> ?
>>>>
>>>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>>>> no places in code where you can see that this messages can and should be
>>>> used together.
>>>> But with StateSpecs you should put pragma with explicit expression like:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with StateSpecs you have full syntax expression at one place which can
>>>> be easy explored.
>>>> And for example to support Phexample mesage #beTrue you should just add
>>>> another pragma:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  <syntax: #(beTrue)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with Phexample you can browse implementors of "single word should
>>>> expressions". But with Phexample if you browse implementors of #be like
>>>> messages you have no idea how it can be used.
>>>> In StateSpecs you should use senders. And with StateSpecs if you browse
>>>> "any syntax word implementors" by senders seach you will see all possible
>>>> usage cases. And if I move all methods with syntax pragmas to single class
>>>> you can easilly see all possible expressions in one place.
>>>>
>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>
>>>> With StateSpecs it should be
>>>>
>>>> foo should be a kind of: Bar
>>>>
>>>> And as I said before It is simple task to support all Phexample
>>>> expressions by StateSpecs pragmas
>>>>
>>>> Best regards,
>>>> Denis
>>>>
>>>>
>>>>
>>
>>
>
>

--
www.tudorgirba.com

"Sometimes the best solution is not the best solution."



Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Uko2
If you can write step by step instruction what to show, I can do it. Right now all my time is used to prepare my own presentation, so I can't do it myself.

uko


On 27 бер. 2013, at 18:41, Denis Kudriashov <[hidden email]> wrote:

2013/3/27 Tudor Girba <[hidden email]>
Perhaps Mocketry would be a good topic for a "Show us your projects" session. Then we can try to go into a couple of more details.


Unfortunately I can't participate conference this year
 
Cheers,
Doru


On Mar 27, 2013, at 12:42 AM, Yuriy Tymchuk <[hidden email]> wrote:

> Sounds good to me.
>
> On 26 бер. 2013, at 23:00, Camillo Bruni <[hidden email]> wrote:
>
>>
>> On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:
>>
>>> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>>>
>>>> Ok, and what if we will change behavior a bit so if no definitions were
>>>> found it will send the incoming message to enclosed object? This way it
>>>> will work like phexample but will also allow to define some fancy DSL.
>>>>
>>>
>>> We can copy all phexample syntax methods into single class inside
>>> StateSpecs package but replace implementation with pragmas approach. So
>>> anybody can browse implementors like usual and it will not required any
>>> special cases.
>>>
>>> How I can influence your interest, guys? I can provide cleaning, comments,
>>> improvements to StateSpecs. I opened for your requirements.
>>> Phexample become quite popular and can be part of Pharo sometimes.
>>> Mocketry/StateSpecs used by people too.
>>> It would be bad if this packages can't be used together.
>>
>> sorry for starting the whole rant :) I am veery busy at least until tomorrow
>>
>> Yuriy we can discuss that after tomorrow?
>> I would as well appreciate some common solution to avoid the selector clash.
>>
>>
>>
>>>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>>>
>>>> Hello
>>>> 2013/3/26 Camillo Bruni <[hidden email]>
>>>>
>>>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>>>> way.
>>>>> But I am not a big fan of the pragma magic. Why?
>>>>> It breaks all tools for me :/. If I see a message send I want to be able
>>>>> to:
>>>>> - browse it, so I can see who implements it?
>>>>> - debug it directly to get to the real method.
>>>>>
>>>>> SateSpec does indeed help writing readable code by allowing almost
>>>>> grammatically
>>>>> correct sentences. However I don't think this is the way to program. I am
>>>>> a big
>>>>> fan of stupid english:
>>>>>
>>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>> If I want to figure out how the first one works, I can simply browse the
>>>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>>>> I am
>>>>> lost. I have to rely on "contains string literal" to get the sources, for
>>>>> me
>>>>> that is very strange.
>>>>>
>>>>
>>>> I think main thing you want is easilly explore all available should
>>>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>>>> move all methods with syntax pragmas to single class. So you can open this
>>>> class and see what available.
>>>>
>>>> To get implementors of some "should expression" you should use senders
>>>> search of syntax words instead of implementors. Syntax words in StateSpecs
>>>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>>>> array of symbols).
>>>>
>>>> Interesting that StateSpecs has more explicit syntax system. How you can
>>>> explore in Phexample expression:
>>>>
>>>> object should be true
>>>> ?
>>>>
>>>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>>>> no places in code where you can see that this messages can and should be
>>>> used together.
>>>> But with StateSpecs you should put pragma with explicit expression like:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with StateSpecs you have full syntax expression at one place which can
>>>> be easy explored.
>>>> And for example to support Phexample mesage #beTrue you should just add
>>>> another pragma:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  <syntax: #(beTrue)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with Phexample you can browse implementors of "single word should
>>>> expressions". But with Phexample if you browse implementors of #be like
>>>> messages you have no idea how it can be used.
>>>> In StateSpecs you should use senders. And with StateSpecs if you browse
>>>> "any syntax word implementors" by senders seach you will see all possible
>>>> usage cases. And if I move all methods with syntax pragmas to single class
>>>> you can easilly see all possible expressions in one place.
>>>>
>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>
>>>> With StateSpecs it should be
>>>>
>>>> foo should be a kind of: Bar
>>>>
>>>> And as I said before It is simple task to support all Phexample
>>>> expressions by StateSpecs pragmas
>>>>
>>>> Best regards,
>>>> Denis
>>>>
>>>>
>>>>
>>
>>
>
>

--
www.tudorgirba.com

"Sometimes the best solution is not the best solution."




Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
Ok. I can do this.
I think showing examples from project wiki page is enough. Plus demo of how extend syntax sugar and how to use stubs.
What people really want to see about mock objects framework?


2013/3/27 Yuriy Tymchuk <[hidden email]>
If you can write step by step instruction what to show, I can do it. Right now all my time is used to prepare my own presentation, so I can't do it myself.

uko



On 27 бер. 2013, at 18:41, Denis Kudriashov <[hidden email]> wrote:

2013/3/27 Tudor Girba <[hidden email]>
Perhaps Mocketry would be a good topic for a "Show us your projects" session. Then we can try to go into a couple of more details.


Unfortunately I can't participate conference this year
 
Cheers,
Doru


On Mar 27, 2013, at 12:42 AM, Yuriy Tymchuk <[hidden email]> wrote:

> Sounds good to me.
>
> On 26 бер. 2013, at 23:00, Camillo Bruni <[hidden email]> wrote:
>
>>
>> On 2013-03-26, at 19:45, Denis Kudriashov <[hidden email]> wrote:
>>
>>> 2013/3/26 Yuriy Tymchuk <[hidden email]>
>>>
>>>> Ok, and what if we will change behavior a bit so if no definitions were
>>>> found it will send the incoming message to enclosed object? This way it
>>>> will work like phexample but will also allow to define some fancy DSL.
>>>>
>>>
>>> We can copy all phexample syntax methods into single class inside
>>> StateSpecs package but replace implementation with pragmas approach. So
>>> anybody can browse implementors like usual and it will not required any
>>> special cases.
>>>
>>> How I can influence your interest, guys? I can provide cleaning, comments,
>>> improvements to StateSpecs. I opened for your requirements.
>>> Phexample become quite popular and can be part of Pharo sometimes.
>>> Mocketry/StateSpecs used by people too.
>>> It would be bad if this packages can't be used together.
>>
>> sorry for starting the whole rant :) I am veery busy at least until tomorrow
>>
>> Yuriy we can discuss that after tomorrow?
>> I would as well appreciate some common solution to avoid the selector clash.
>>
>>
>>
>>>> On 26 бер. 2013, at 07:46, Denis Kudriashov <[hidden email]> wrote:
>>>>
>>>> Hello
>>>> 2013/3/26 Camillo Bruni <[hidden email]>
>>>>
>>>>> Definitely StateSpec looks more mature and can be used in a more flexible
>>>>> way.
>>>>> But I am not a big fan of the pragma magic. Why?
>>>>> It breaks all tools for me :/. If I see a message send I want to be able
>>>>> to:
>>>>> - browse it, so I can see who implements it?
>>>>> - debug it directly to get to the real method.
>>>>>
>>>>> SateSpec does indeed help writing readable code by allowing almost
>>>>> grammatically
>>>>> correct sentences. However I don't think this is the way to program. I am
>>>>> a big
>>>>> fan of stupid english:
>>>>>
>>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>> If I want to figure out how the first one works, I can simply browse the
>>>>> implementors of #should and/or #isKindOf: where is the StateSpec version
>>>>> I am
>>>>> lost. I have to rely on "contains string literal" to get the sources, for
>>>>> me
>>>>> that is very strange.
>>>>>
>>>>
>>>> I think main thing you want is easilly explore all available should
>>>> syntax. And StateSpecs can be easilly adopted for such task. We can just
>>>> move all methods with syntax pragmas to single class. So you can open this
>>>> class and see what available.
>>>>
>>>> To get implementors of some "should expression" you should use senders
>>>> search of syntax words instead of implementors. Syntax words in StateSpecs
>>>> is just method literals ( <syntax: #(be an instance of:)>, #() is just
>>>> array of symbols).
>>>>
>>>> Interesting that StateSpecs has more explicit syntax system. How you can
>>>> explore in Phexample expression:
>>>>
>>>> object should be true
>>>> ?
>>>>
>>>> You have separate PheMatcher>>be and PheMatcher>>true methods and there is
>>>> no places in code where you can see that this messages can and should be
>>>> used together.
>>>> But with StateSpecs you should put pragma with explicit expression like:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with StateSpecs you have full syntax expression at one place which can
>>>> be easy explored.
>>>> And for example to support Phexample mesage #beTrue you should just add
>>>> another pragma:
>>>>
>>>> Equal>>true: anObject
>>>>  <syntax: #(be true)>
>>>>  <syntax: #(beTrue)>
>>>>  ^self return: (IdentitySpec pattern: true)
>>>>
>>>> So with Phexample you can browse implementors of "single word should
>>>> expressions". But with Phexample if you browse implementors of #be like
>>>> messages you have no idea how it can be used.
>>>> In StateSpecs you should use senders. And with StateSpecs if you browse
>>>> "any syntax word implementors" by senders seach you will see all possible
>>>> usage cases. And if I move all methods with syntax pragmas to single class
>>>> you can easilly see all possible expressions in one place.
>>>>
>>>> `foo should isKindOf: Bar` vs. `foo should be an instance of: Bar`
>>>>>
>>>>
>>>> With StateSpecs it should be
>>>>
>>>> foo should be a kind of: Bar
>>>>
>>>> And as I said before It is simple task to support all Phexample
>>>> expressions by StateSpecs pragmas
>>>>
>>>> Best regards,
>>>> Denis
>>>>
>>>>
>>>>
>>
>>
>
>

--
www.tudorgirba.com

"Sometimes the best solution is not the best solution."





Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Sean P. DeNigris
Administrator
In reply to this post by Camillo Bruni-3
Camillo Bruni-3 wrote
Yuriy we can discuss that after tomorrow?
I would as well appreciate some common solution to avoid the selector clash.
Bump ;)
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov
2013/5/21 Sean P. DeNigris <[hidden email]>
Camillo Bruni-3 wrote
> Yuriy we can discuss that after tomorrow?
> I would as well appreciate some common solution to avoid the selector
> clash.

Bump ;)


I don't remember is it was public conclusion but we agree to try StateSpecs for Phexample.
After I finish key features of TxText I will adapt StateSpecs to satisfy Camillo requirements.
 


-----
Cheers,
Sean
--
View this message in context: http://forum.world.st/Suggestion-about-Phexample-and-StateSpecs-Mocketry-integration-tp4678247p4688892.html
Sent from the Pharo Smalltalk mailing list archive at Nabble.com.


Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Suggestion about Phexample and StateSpecs(Mocketry) integration

Camillo Bruni-3

On 2013-05-21, at 20:19, Denis Kudriashov <[hidden email]> wrote:

> 2013/5/21 Sean P. DeNigris <[hidden email]>
>
>> Camillo Bruni-3 wrote
>>> Yuriy we can discuss that after tomorrow?
>>> I would as well appreciate some common solution to avoid the selector
>>> clash.
>>
>> Bump ;)
>>
>>
> I don't remember is it was public conclusion but we agree to try StateSpecs
> for Phexample.
> After I finish key features of TxText I will adapt StateSpecs to satisfy
> Camillo requirements.

cool! let me know once you're ready ;) (no hurry) and we can do a tryout in Pharo 3.0!
Reply | Threaded
Open this post in threaded view
|

Re: [Pharo-dev] Suggestion about Phexample and StateSpecs(Mocketry) integration

Sean P. DeNigris
Administrator
In reply to this post by Denis Kudriashov
Denis Kudriashov wrote
I don't remember is it was public conclusion but we agree to try StateSpecs
for Phexample.
After I finish key features of TxText I will adapt StateSpecs to satisfy
Camillo requirements.
Double bump ;) I want to try Mocketry, but I'm already using Phexample, so I need them to be compatible...
Cheers,
Sean
Reply | Threaded
Open this post in threaded view
|

Re: Suggestion about Phexample and StateSpecs(Mocketry) integration

Denis Kudriashov

2013/11/30 Sean P. DeNigris <[hidden email]>
Denis Kudriashov wrote
> I don't remember is it was public conclusion but we agree to try
> StateSpecs
> for Phexample.
> After I finish key features of TxText I will adapt StateSpecs to satisfy
> Camillo requirements.

Double bump ;) I want to try Mocketry, but I'm already using Phexample, so
 I need them to be compatible...

Now loading Mocketry will override existed #should implementation. So your Phexample "should expressions" will evaluated by Mocketry system.
And if I remember correctly Yuriy added some compatibility messages to Mocketry to make it usage seamless for Phexample tests.
Unfortunately I don't have time now to move StateSpecs to Phexample. But I will work on it some day.

Best regards,
Denis