Skip to content
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

Current documentation and JavaDoc are far from being perfect #1041

Open
kleinesfilmroellchen opened this issue Mar 23, 2020 · 9 comments
Open

Comments

@kleinesfilmroellchen
Copy link

This is not a bug. It is a serious problem that I think many people have with the package. I have no problem with the API, it is very nice, well-structured and extensible, it is fast and robust.

But it is, quite frankly, horribly documented.

It took me several DAYS (no kidding) of experimentation, sifting through piles of one-sentence JavaDoc (which isn't clearly referenced on the README btw) and reading a bunch of source code to grasp a basic understanding of how Takes works, how one controls and customizes different parts of the data and event flow, what the basic subclasses do and how their constructors work.

NOW I understand enough to do decently fast development with Takes. But I doubt that everyone has the time to spare or the willpower to dissect a library just to be able to use it. I, at several points, was just hunting down bugs I introduced because I did not know that Takes behaved in a certain way. In a way that was not documented. I was looking to add a certain feature and needed several attempts of using different decorators until I found the one that did the thing I wanted it to do.

Takes is a great library, don't get me wrong. But great libraries deserve great documentation. Therefore, I suggest we concentrate our efforts on the following:

  1. Document behavior that is not obvious. Some examples of undocumented behavior I encountered:
  • Most response decorators that add a body also add a Content-Length header. It is up for debate whether that is a good thing or not, but this behavior had me debugging about three hours until I figured I needed to remove a wrong Content-Length header silently set by a RsText decorator.
  • Document how different Backs handle Socket closing and opening and whether they respond to Connection: keep-alive headers. I still do not know how this works and commonly get 29s TTFB because some socket is still open, timing out or whatever. Somebody has to know how this all works.
  • Gzip may cause extreme lag and even crashes when a Take throws an exception that should be handled by a Fallback. Explain how to properly use the Gzip decorator and where it should be avoided.
  1. For every class and major method, document common use cases and workflows, example use cases and gotchas like the ones described above. Describe in more detail how the classes and methods behave, how they perform and known edge cases that might occur.

  2. Likewise, for every constructor, document how it behaves differently than the others, in which situation it may be preferred over other constructors, etc.

  3. Create a more comprehensive explanation of how the Takes API and architecture works and how one goes about extending it in various ways. Explain what to do and what not to do when extending the framework and when compositing its parts.

I know that most of the things listed under undocumented behavior may be my fault at least partially. But it always took a long time for me to find out what I did wrong and exactly why, in the end, it really always was a feature and not a bug, just an undocumented feature.

If there is no real comprehensive API documentation apart from the JavaDoc, then the JavaDoc should also contain all necessary information.

Thanks to all the engaged people on this great project!

@0crat
Copy link
Collaborator

0crat commented Mar 23, 2020

@paulodamaso/z please, pay attention to this issue

@paulodamaso
Copy link
Contributor

@0crat in

@kleinesfilmroellchen
Copy link
Author

I have, again, stumbled across a quirk in one class's behavior: RsEmpty adds an HTTP header with a 204 status code. I do not know if most decorators do this, but it again lead to an issue without good error reporting that was fully on my side. I only found out after - again! - looking into the (luckily very simple) source code of said decorator and discovering that behavior. Everything fine with the library, nothing fine with the documentation. The head() iterable of Response includes the RESPONSE LINE of HTTP itself, i.e. HTTP/1.1 200 OK. Please clarify this with Responses documentation.

@paulodamaso
Copy link
Contributor

@0crat status

@0crat
Copy link
Collaborator

0crat commented Apr 7, 2020

@0crat status (here)

@paulodamaso This is what I know about this job in C3FFK3YAY, as in §32:

@kleinesfilmroellchen
Copy link
Author

kleinesfilmroellchen commented Apr 18, 2020

... and more undocumented behavior: as it seems, non-faked Request objects connect directly to the socket's input stream with their body(). This means that trying to receive all bytes from the body input stream will result in an infinitely blocking method call, as the socket is of course still open for sending the response.

Just in case anyone's wondering, the workaround is to make an InputStream that reads the number of bytes specified in the Content-Length header of the request. Or use some other method of limiting the number of bytes read.

@yegor256
Copy link
Owner

@kleinesfilmroellchen many thanks for this ticket! Maybe you can help us improve the documentation? A few pull requests will definitely be helpful. In the mean time, I will also try to do some improvements.

@yegor256
Copy link
Owner

@baudoliver7 maybe you can help too?

@yegor256 yegor256 added the bug label Aug 24, 2022
@yegor256 yegor256 changed the title Better Documentation Current documentation and JavaDoc are far from being perfect Aug 24, 2022
@kleinesfilmroellchen
Copy link
Author

This issue is two years old. I have since abandoned the project that used takes, I neither use Java nor takes anymore. You can leave this issue open or close it, I don't care, but I'll not be involved anymore.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants