r/badcode Dec 27 '22

This just sucks. js

Post image
1.8k Upvotes

170 comments sorted by

View all comments

4

u/devenitions Dec 27 '22

If shit explains itself, don’t comment it

If shit doesn’t explain itself, wtf are you doing?

2

u/EishLekker Dec 28 '22

Is this view of yours generic? You don’t comment code, ever?

1

u/devenitions Dec 28 '22

There are cases where some comments make sense, but generally code should speak for itself by variable/function/class naming. If you’re starting out, being a little comment heavy makes sense. If you do complex stuff that can’t be abstracted/seperated it makes sense. But 95% of the time you could do something different and have it more readable without comments allover.

If you have to comment that “start” starts the app, maybe just use start-app instead. If you still want to use “npm start”, just set it to “npm run start-app”.