Conveying the usage of an object

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

Conveying the usage of an object

Sergio Fedi
Hi, 

In other smalltalks, which had the capability of marking a method with more than one category, I could make a method public/private AND it's functional category (accessor, printing, etc)

I did this to explicitly show the user which methods I expect to be sent to the object and which ones I don't.

It didn't seem to me I can assign more than one category in Pharo, so my question is:

How can I deal with this problem? Which is "the Pharo way" to accomplish this?

Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Mariano Martinez Peck
Sergio, a few times I also wanted that. And the only way of doing it I found was by doing defining protocols like 'public' , 'public - subcategoryX', 'public - subcategoryY' , etc... not sure powerful but simple.

Cheers,

On Mon, Apr 27, 2015 at 7:53 PM, Sergio Fedi <[hidden email]> wrote:
Hi, 

In other smalltalks, which had the capability of marking a method with more than one category, I could make a method public/private AND it's functional category (accessor, printing, etc)

I did this to explicitly show the user which methods I expect to be sent to the object and which ones I don't.

It didn't seem to me I can assign more than one category in Pharo, so my question is:

How can I deal with this problem? Which is "the Pharo way" to accomplish this?




--
Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Sergio Fedi
The only other way I can think of doing this is via the virtual categories (which Pharo seems to have) and make them look for "Public" at the beggining of the first comment.

Not fancy, but practical.

Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Stephan Eggermont-3
In reply to this post by Sergio Fedi
On 28/04/15 00:53, Sergio Fedi wrote:
> How can I deal with this problem? Which is "the Pharo way" to accomplish
> this?

Uhm, you write unit tests for the public API? Showing what you expect to
sent to an object in a nice descriptive way?

Stephan



Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Sergio Fedi
I already do that.
(and I also make sure my tests have 100% coverage over the Public protocol)

But to know that you have to memorize the methods that are in the test cases.
Besides, I may want to test private methods too.

Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Stephan Eggermont-3
On 28/04/15 01:44, Sergio Fedi wrote:
> I already do that.
> (and I also make sure my tests have 100% coverage over the Public protocol)
>
> But to know that you have to memorize the methods that are in the test
> cases.
> Besides, I may want to test private methods too.

The categorization of methods is a weak way of showing the user,
as it is decoupled from the actual code, i.e. when I change the
behaviour, there is no automatic update of the category.

With Glamour/GTInspector extensions you could create an
API browser from e.g. marking API methods with a pragma
or using a TestCase subclass APITest

Stephan


Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

jtuchel
Stephan,
 
isn't that a weak argument? If I change the bhavior of a method and forget to rename it to something intention revealing, there also is no guarantuee that the name tells a developer anything about it...
 
Joachim
> Stephan Eggermont <[hidden email]> hat am 28. April 2015 um 12:17 geschrieben:
>
>
> On 28/04/15 01:44, Sergio Fedi wrote:
> > I already do that.
> > (and I also make sure my tests have 100% coverage over the Public protocol)
> >
> > But to know that you have to memorize the methods that are in the test
> > cases.
> > Besides, I may want to test private methods too.
>
> The categorization of methods is a weak way of showing the user,
> as it is decoupled from the actual code, i.e. when I change the
> behaviour, there is no automatic update of the category.
>
> With Glamour/GTInspector extensions you could create an
> API browser from e.g. marking API methods with a pragma
> or using a TestCase subclass APITest
>
> Stephan
>
>
>
Reply | Threaded
Open this post in threaded view
|

Re: Conveying the usage of an object

Stephan Eggermont-3
On 28/04/15 12:35, Joachim Tuchel wrote:
> isn't that a weak argument?

Yes, it is. And taking a look at the actual
categories gives me the impression that
naming is done better than categorization.

Stephan