DEV Community

Cover image for How To Write Good Code Documentation

How To Write Good Code Documentation

Bonnie on August 16, 2024

Code documentation is an important part of software development that often gets overlooked. Writing good code documentation enhances code readabili...
Collapse
 
asmyshlyaev177 profile image
Alex

Tried it on my project.

It offers me to simplify this condition statement:
export const siteUrl = isVercel ? vercelUrl : netifyUrl;
With this :
export const siteUrl = [vercelUrl, netifyUrl][isVercel];

It's can't handle NextJS and TalwindCss for now.

Eslint + conventional code analysis tools are way ahead of this app.

Collapse
 
colematt profile image
Matthew Cole

The second statement isn’t simplified. And you have to create a copy of the two values for vercelUrl and netifyUrl to make the array to be indexed.

Ternary expressions really aren’t bad once you understand the syntax, and they are used in a lot of languages, so you’ll be seeing them again in the future.

Collapse
 
the_greatbonnie profile image
Bonnie

Thanks for the feedback.

Collapse
 
asmyshlyaev177 profile image
Alex

You welcome, I know that this feature is "beta", more like "alpha" tbh. TailwindCss could be considered as anti-pattern, some devs advocate against it.
But Next.js should work out of the box.

Collapse
 
skywarth profile image
skywarth

How would you rate the documentation in my recent project? github.com/skywarth/darkest-PR

Do you think it's good, easy to read?

Collapse
 
the_greatbonnie profile image
Bonnie

Looks great.

Collapse
 
amrtaher1234 profile image
Amr Mohamed

Looks cool but doesn't serve the purpose at least from my own POV.

A typical readme should contain less text and more focus on how to get started instead of jargon, but overall cool!

Collapse
 
skywarth profile image
skywarth

Thanks for the suggestions Amr, appreciated.

Collapse
 
ravavyr profile image
Ravavyr

I'm pretty sure articles like these are called "spam" ?

Collapse
 
the_greatbonnie profile image
Bonnie

Why?

Collapse
 
ravavyr profile image
Ravavyr

2/3 of the post is an advertisement for mimrr....isn't it obvious?

Thread Thread
 
the_greatbonnie profile image
Bonnie

They sponsored the article.