freeCodeCamp / classroom

BSD 3-Clause "New" or "Revised" License
144 stars 121 forks source link

chore(docs): inline-documentation #397

Closed theGaryLarson closed 1 year ago

theGaryLarson commented 1 year ago

Checklist:

Starting on #391

I am keeping this as a draft PR until we can get the paths updated between tests and the API routes. Then will resubmit once tests clear.

I am using the AI tool Mintlify to help me understand the codebase and document it along the way. I believe this would benefit many people like myself who are new to the codebase and want to gain a better understanding.

theGaryLarson commented 1 year ago

@lloydchang I added in-line docs for the api folder to start. Created this as a draft to get some feedback first though.

lloydchang commented 1 year ago

Thanks, @theGaryLarson

See https://github.com/freeCodeCamp/classroom/pull/366#issuecomment-1652616915 and https://github.com/freeCodeCamp/classroom/pull/396#issuecomment-1652403604

as they relate to:

Some checks were not successful 1 failing and 2 successful checks

Classroom ci / Build and test (16.14.2) (pull_request) Failing after 43s Details

below.

lloydchang commented 1 year ago

lgtm

lloydchang commented 1 year ago

:shipit: :ship: :it:

lloydchang commented 1 year ago

While Mintlify Writer AI generated documentation is lengthy, I agree with @theGaryLarson that:

This would benefit many people like myself who are new to the codebase and want to gain a better understanding.


• In a professional setting, experienced software engineers would find the documentation too verbose.

• In this classroom setting, the target audience of this codebase is students who are learning the basics of software engineering and computer programming.


To use a basic example:

res.status(200).end();

is documented by Mintlify Writer as:

/ The line res.status(200).end(); is setting the HTTP response status code to 200 (OK) and ending the response. This indicates that the request was successful and there is no additional data to be sent in the response body. / res.status(200).end();


• Some students have not learned that 200 is OK.

• Other students and experienced software engineers learned from experience that 200 is OK.

• Most students and experienced software engineers have not read the official HTTP standard at https://datatracker.ietf.org/doc/html/rfc9110

• The Mintlify Writer-generated documentation tries to split the difference by adding lengthy documentation, which would be too verbose for experienced software engineers but is just the right temperature for students who are new to the codebase and want to understand better.


For reference, HTTP standard:

200 OK from the Hypertext Transfer Protocol (HTTP) standard by Internet Engineering Task Force (IETF) at https://datatracker.ietf.org/doc/html/rfc9110#section-15.3

Screen Shot 2023-07-26 at 8 01 11 PM
theGaryLarson commented 1 year ago

Hey @lloydchang given the state of tests and route changes in API. I am going to leave this as a draft until tests pass. Then will sync and repush to this branch once they are resolved.

Slack convo with @ngillux