On 16 September 2016 at 13:42, Clément Bera <[hidden email]> wrote: Why don't you just change nautilus to have two text areas, one with the test corresponding to the method and the other one with the method's code ? Exactly, we already have that with class comments, so why not methods (and while we're at it, package comments too) A separate method comment would make it clear that it's intended as API documentation for users of the method (and then the comment inside the method's source can be really a development comment). Another advantage is that its syntax won't have to deal with being between quotes and all the indentation/escapement hassles that come with inserting a syntax inside another one… |
2016-09-16 15:26 GMT+02:00 Damien Pollet <[hidden email]>:
Could we have a Pillar-way of organizing comments so that, based on sections, one could automatically find, from a book-like comment of the package or the class, which section applies to a given method?
Good point. Thierry
|
On 16 September 2016 at 15:35, Thierry Goubier <[hidden email]> wrote: Could we have a Pillar-way of organizing comments so that, based on sections, one could automatically find, from a book-like comment of the package or the class, which section applies to a given method? I guess it's like any cross-referencing or indexing system… I'm guessing a purely automatic system would find irrelevant matches and miss related stuff, so it would need some human-added hints. But no one can reasonably go through the cross-product of docs and code, adding hints, so that would need to be crowdsourced and aggregated, a bit like the QA critiques. I'll leave this link to the Django docs: https://docs.djangoproject.com/en/1.10/ I recently watched a talk from I think the Django lead who was explaining the different kinds of docs (tutorials, howtos, topic guides, and reference). Package/class/method comments would be reference doc, but would need to cross-ref with any other docs too… |
Another example: First example: On Fri, Sep 16, 2016 at 10:51 AM, Damien Pollet <[hidden email]> wrote:
Bernardo E.C. Sent from a cheap desktop computer in South America. |
In reply to this post by Damien Pollet
2016-09-16 15:51 GMT+02:00 Damien Pollet <[hidden email]>:
If one could, in a Pillar doc of a package, unify the packa
|
In reply to this post by Damien Pollet
Sorry for the mistake,
2016-09-16 15:51 GMT+02:00 Damien Pollet <[hidden email]>:
If one could reference the package code (class / method) as a reference inside the Pillar comment, would that work? I'm a bit wary of an 'automatic' approach, but I'd find great to go in a fluid way from text to code and back. For those who remember, my idea would be like referencing chapters and sections of the LaTeX generation of smalltalk source code... If you reference {\ref aClass:aProtocol:aMethod} then you get a live two-way link between the comment and the code in the browser.
I'd make it simple: start with a book-like document cross-referenced with the live code, as the preferred documentation for a package. Thierry
|
In reply to this post by philippeback
2016-09-16 0:19 GMT+02:00 [hidden email] <[hidden email]>:
Why don't we have yet package comments ? I see there is some support for it in PackageManifest, I remember there was some work (people working) on support for Nautilus, no? maybe something like this, (see attached file) Nautilus comment pane on class selection -> show class comment no class selection -> show package comment (class side #description of package manifest of this package) you can even add or change the (package) comment, it will compile a proper #description method on the manifest class)
package_comment.cs (5K) Download Attachment |
How is all of this PackageManifest mechanism working? Doc anywhere? Phil Le 16 sept. 2016 17:02, "Nicolai Hess" <[hidden email]> a écrit :
|
In reply to this post by Denis Kudriashov
the integration run the validation and says that system documentation is ok. We do that all the time with Quqlity rules. |
In reply to this post by Clément Béra
Le 16/9/16 à 13:42, Clément Bera a
écrit :
and you want to create different semantic objects... well you underestimate the amount of work. Ask pavel just to get a semantically model for Pharo just plain pharo with Slot and Traits. Stef
Clement how do you save/store/merge.... in a method it is cheap and working.
|
In reply to this post by Denis Kudriashov
+ 1 Changing the language metamodel for simple validated comments is
a huge effort for nothing. Stef Le 16/9/16 à 14:18, Denis Kudriashov a
écrit :
|
In reply to this post by Nicolai Hess-3-2
This can be done in addition but first we should be able to encode them. |
In reply to this post by Damien Pollet
Le 16/9/16 à 15:26, Damien Pollet a
écrit :
I love you guys. Let us change MCZ binary storage, pharo language metamodel and more while we are at it. Not talking about merging and others. Sorry there is a huge tradeoffs with simplicity and gain. And you are just jumping into building a monster for ONE LINERS.... Repeat after me ONE LINERS. I prefer to keep my energy for worth large enhancements and grab low hanging fruits when I see them. And Nicolai showed it to us. We cn get some variation and get all the easy benefits. Daemons of over-engineering are tempting us because this is cooler to to design something complex. But KISS to the rescue. Stef
|
In reply to this post by Nicolai Hess-3-2
Just because we are too busy. Christophe is working on the manifest to support cargo metadata.
Yes this is one idea. I would love to have package comment.
|
In reply to this post by stepharo
On 16 September 2016 at 20:42, stepharo <[hidden email]> wrote:
Dreaming of crazy features is a good thing. Talking from experience, I prefer that to not dreaming, which is pretty dull. And over-engineering is of course the wrong path. But the temptation to do so is revealing of where the system is too complex. |
Le 16/9/16 à 21:58, Damien Pollet a
écrit :
Yes now create a thread: the dreams for a cool documentation system in Pharo and I will follow and add to it happily, What I was asking in this thread is how can we catch a low hanging fruit and get an immmediate impact because it looks so easy to do. Stef
|
In reply to this post by stepharo
Hi,
> On Sep 16, 2016, at 8:37 PM, stepharo <[hidden email]> wrote: > > + 1 > > Changing the language metamodel for simple validated comments is a huge effort for nothing. > Clement is good at VM level but not at other level :) I think there is a misunderstanding :). I do not see any implication to the language meta-model in the remark of Clement. In fact, I expressed exactly the same opinion, that the design of things like PythonDoc comes from the fact that those people do not rely on an IDE, so their design focuses on the only thing they have: source code. Clement remarked that we already have SUnit tests and he suggested that we could just enhance the IDE to present them next to the methods. This might actually be less straightforward with SUnit because it was not made for preserving links to the code, but it can work out of the box with something like GTExamples. Cheers, Doru > Stef > > Le 16/9/16 à 14:18, Denis Kudriashov a écrit : >> >> 2016-09-16 13:42 GMT+02:00 Clément Bera <[hidden email]>: >> Why don't you just change nautilus to have two text areas, one with the test corresponding to the method and the other one with the method's code ? >> >> You're saying: >> Their values is active documentation that can be automatically validated. >> That can also be applied to test we've already had with SUnit. If the only difference you want is to display the test next to the method, then it's an IDE problem, nothing has to be changed but the IDE. >> >> In python they have no other choices than putting tests in comments because their IDE is a text editor, they cannot create other panes or anything like that. >> >> It is of course true. But Stef suggestion is really much much simpler. It is just convention how to write examples inside comments. Then tools could work with them and Nicolai already provide simple extension for Nautilus. >> We already has a lot of comments with examples inside. Making them discoverable and testable will be nice. >> > -- www.tudorgirba.com www.feenk.com "Yesterday is a fact. Tomorrow is a possibility. Today is a challenge." |
On Sat, Sep 17, 2016 at 8:18 AM, Tudor Girba <[hidden email]> wrote: Hi, Yes, the language meta-model is already too complex in Pharo IMHO, let's not make it even more complex. I should have precised that's not what I meant if this was not obvious to everyone. 1. Method docs with examples, so a user can see an example usage of a method (sunit test methods sometimes aren't good "examples") 2. We already had (and still have) some method docs where the example code just won't work anymore because the methods or classes used Nicolai, I'm suggesting to show the SUnit test code (or example code, or whatever) next to the method, and being able to create a unit test this way instead of only the existing green/red button and the "browse tests" entry in the right click menu. For existing methods having in their comment executable code to test how they work (as you mentioned), the code can just be moved to the test shown in the pane next to it (through a script discovering all cases like that or manually). The example usage would still be shown next to the code for the user, except it would already be under version control as existing SUnit tests are, it can now have syntax coloring which is not present in comments, it's automatically executed by each Pharo build through SUnit hence detecting regressions and the meta-model is not getting more complex at all. As Tudor said, it's only about IDE changes. I believe that some SUnit tests are sometimes not good examples because they're higher level tests (application tests, business tests) while as for python doctests it's only relevant to show unit tests next to the method the unit test validates. Currently I believe Nautilus discovers tests and add the green/red button based on name conventions. Foo>>bar has this feature if FooTests>>testBar is implemented. So it's either a matter of improving this heuristic or educating the community with this existing name convention. In any case, I don't think it's more changes for the user than having to learn convention in the comments/pragmas.
|
2016-09-19 10:33 GMT+02:00 Clément Bera <[hidden email]>:
Yes, we should d some experiments with different solutions and see what works. I like the simplicity of having code in comments, at the moment I don't like when we use the code highlighter, because this looks a bit confusing. I would like a better link between methods and sunit tests, too. I still don't think that unit tests can fully replace code examples. And having a possibility to validate the code from method comments would be nice. For example, some time ago there were some examples in Color methods like wheel: thisMany "Return a collection of thisMany colors evenly spaced around the color wheel." "Color showColors: (Color wheel: 12)" the method #showColors: was long gone, so I replaced the comment to use #inspect instead. But this code example is not about validation, a unit test would look like self assert:(Color wheel: 12) equals: {(Color r: 0.7000000000000001 g: 0.07 b: 0.07 alpha: 1.0). (Color r: 0.7000000000000001 .....} This code example is about a simple usage: "how would Color wheel:12 look like ? Ha just inspect the result and see yourself" And having a way to detect when the code example "Color showColors: .." doesn't work anymore because the method was removed, or if the Code example "(CompiledMethod compiledMethodAt: #author) author" doesn't work anymore because the method was moved from CompiledMethod to Compiled code ;-) would be nice. Yes maybe we can find another way to link real example code (not code in comments) to the actual method with better tool support, but we can not cover this with unit tests style methods alone. Even a simple example like: 'pharo' capitalized " >>> 'Pharo'" this reads better than self assert:'pharo' capitalized equals:'Pharo' Ok, it is not that bad to understand the usage of 'capitalized', its iput and output from this unit test, but not all unit tests are written like that. Some tests are mostly about testing corner cases or an implementation detail, or other code that isn't even considered to be used outside of the test. So, yes, we should do some more experiments and see.
|
+1 I like doctest just a validated doc. I do not care that the are used as tests. This is not the main goal to me The goal is make sure that the reader understand fast. I like that there are in the comments because in a PharoDoc the examples woudl be there. Sytef
|
Free forum by Nabble | Edit this page |