New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Documentarian #90
Documentarian #90
Conversation
How possible is it to turn the SwiftDoc into HTML doc in the wiki? (I've never done it – though it seems there should be a way...) I think the biggest issue is really the lack of a comprehensive introductory tutorial, which I realize is hard to write. For example, I didn't even know there was a |
Footnote: This is made worse since a carthage framework does not provide quick link documentation in Xcode. So it's up to the user to open up a separate SwiftCheck project and read source... I usually start with test cases hoping to find interesting tidbits I can learn from, then fall back to actually reading source. |
There is a tutorial playground, but I have not been maintaining it of late. |
Ok – trying to put together a "list of really nice to have's" for the documentation. Here's one that I'm stuck on: How would I write a generator that takes a random element from an Array? Been reading the code... haven't figured it out yet. |
/// the testability of program properties - A statement or invariant that can be proven to hold when | ||
/// fed any number of arguments of a particular kind. It is akin to Fuzz Testing but is made | ||
/// significantly more power by the primitives in this framework. | ||
/// |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this point, I'm really interested. You've caught my attention, even if I've never heard of QuickCheck before. You're assuming your reader is familiar with TDD, but that's not a terrible assumption (and a motivated reader will have a good intuition for what you mean at this point anyway).
It's important to know who your audience is. In my comments I've assumed the following profile:
To teach this kind of reader, you need to focus on problems they encounter in their work, and show how taking some time to learn a new system will help solve those problems. It's possible that you need to first teach them what problems they face. They may not even realize the limitations of their current system. So the first step is "here's the problem." For an example of what I mean, see Functional Wish Fulfillment and its followups. This may be way too much information for the header (it took me 3 blog posts just to build up to If SwiftCheck can really do for Swift what QuickCheck does for Haskell, I think it can be an incredibly useful tool to many developers. It's worth selling it well, and especially to developers who have not embraced lambda-all-the-things. It needs to work for the kinds of software most iOS devs write today. By its nature, I would expect it to nudge devs towards writing better software, but it's crappy software that most needs SwiftCheck.... |
And total nitpick because of how I read it. Using /** **/ for big block comment would make much easier to read on iPhone :D |
I think it's important to keep this in mind. I'm a Scala programmer, but with about 25 years of object oriented programming (started with Smalltalk, then Objective C). I'm familiar with the concepts but I still tend to avoid "complex" or obscure syntax, and to me that includes memorizing 20 different math-like operators. I think it makes my code harder to read. I'd rather write |
My suggestions for some additions to the README.md that would make SwiftCheck much, much easier to adopt. I think it's important that these appear in the README since code-level documentation is harder to access.
let emailGen = wrap3 <^> localEmail <*> Gen.pure("@") <*> hostname <*> Gen.pure(".") <*> tld
|
/// `SetOf` is called a "Modifier Type". To learn more about them see `Modifiers.swift`---+ | ||
/// | | ||
/// v | ||
/// property("Shrunken sets of integers don't always contain [] or [0]") <- forAll { (s : SetOf<Int>) in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I read Modifiers.swift but it leaves more questions than I have answers (lack of documentation in that file).
I get the general impression that I can operate on an ArrayOf
, SetOf
. But it's still kind of vague. Why are we not just passing in an Array
or a Set
?
I also saw quite a few things that I didn't understand, such as shrinkOne
and removes
, and a few things that I personally understand from Scala, but a Swift programmer won't (such as take
and drop
). But I still have no clue how to apply these in SwiftCheck.
ArrowOf
perplexes me. Not sure what that might be – I only vaguely understand arrows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added documentation for that in this pull request. Read that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few more comments up there... but it still leaves a lot of questions – such as "what is shrinkOne
and removes
and take
and drop
and when would I use these? Keep in mind, if you are dealing with Swift programmers... they've probably never heard of this. They wouldn't know what List[0,1,2].take(1)
would mean.
Also I'd really like to see how to use withFail
and whenComplete
but I can't find any examples. Would be very handy to see them in action. (I wanted to log something to output in whenComplete
for instance...)
By the way, showing expectFail
was very nice. Recommend you put that into the README.md as well. That's a big one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few more comments up there... but it still leaves a lot of questions – such as "what is shrinkOne and removes and take and drop and when would I use these?
You wouldn't. They're all private
😄
Also I'd really like to see how to use withFail and whenComplete but I can't find any examples.
Yes, that is certainly lacking I'll focus there next.
Definitely agree with @zbeckman's suggestions. The Similarly, every time I see |
What did RAC do to appease that kind of criticism with |
@rnapier The trouble with providing such a method in the variadic case would be statically checking that the length of the given list ( Email is not a great example to have in here because of its complexity. |
The latest ReactiveCocoa (3.0) has adopted very Swifty syntax, getting rid of "RAC" (so it's just |
I don't mean prefixing so much as In that same spirit, I don't see |
/// For an example of the latter see the `ArrowOf` modifier. Because Swift's type system treats | ||
/// arrows (`->`) as an opaque entity that you can't interact with or extend, SwiftCheck provides | ||
/// `ArrowOf` to enable the generation of functions between 2 types. That's right, we can generate | ||
/// arbitrary functions! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I need more of an explanation of how I would actually go about using this...!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given!
Oh, @rnapier, we have to use |
@CodaFi ... Actually I think working up to, and presenting, a good email generator would be a fantastic case for a couple of reasons:
|
Then I will save it for the Tutorial playground (which I'm thinking now I'll do in a different pull request). |
OK, I'm going to go ahead and merge this, but this discussion is far from over and will continue in #91. |
I'm using this pull request as an opportunity to try and quash a lot more of the ambiguity around using this framework in a meaningful way by providing a large amount of documentation. As such, I'm giving @zbeckman the authority to green light this.
I'd appreciate if you would use this issue to comment on any existing documentation and provide feedback about any new stuff that was provided. As a new user your experience with this library so far is probably the most valuable thing I could have at my disposal for this pull request.