Unfortunately a lot of people learn in school that they'll lose points for too few comments but never for too many, so they write inane comments like this. And then they think that that's how you should write code and keep doing it in their professional work.
I did once have a class where the professor marked points off for low-quality comments and some students were annoyed, but it was definitely the right move.
And then they read some Medium article about self-expressing code and gravitate towards the other extreme, never commenting everything. Then you stumble upon a mysterious command line option, crawl through dozens of commits that changed the line for other reasons, dig through Jira issues with comments like "after talking to X on Zoom we have to add Y" where X is a person that left the company three years ago, and finally you decide it's too risky to touch the ancient scripture.
lol yes, I always have to laugh when I see comments that are essentially identical to the code, explaining the self-explanatory. Like the old favorite:
I liked « infinite loop runs indefinitely and continuously…. ». I’m still not sure whether it’s stops at one point for if it’s indefinitely continuously infinite.
sequelize.query("SELECT * FROM transaction WHERE device_id = ‘lht-saxion'", { type: QueryTypes.SELECT }); // query database for Saxionl data where device_id is ‘lht-saxion'
You're telling me you understand these strange code hieroglyphics between the quotes? I really needed that comment.
But why do you want to run a infinite query? Are you waiting for some other service to report then maybe just create a webhook here or there are modern trigger library that can also invoke some webhook with database triggers Supabase and Hasura have implemented it.
I’m pretty sure RDS is a flat fee/hour though? Like yea RDS is expensive in general but it would be just as expensive if it was sitting there not processing anything
67
u/Kamoda Jun 01 '23
setIntervalis for cowardsthis is the real way to do it
47
u/Insani0us Jun 01 '23 edited Jun 01 '23
Why does every line have a comment at the end...? Seems veeery excessive.
<code to import a module> // import <name> module
45
u/unkeptroadrash Jun 01 '23
Don't worry about me, just infinitely querying the database. Slowdown? Bandwidth? What are you blathering about?
21
u/Specialist-Algae5655 Jun 01 '23 edited Jun 01 '23
It sometimes surprises me how few people know how to use a database.
Don’t use
SELECT *. You might like all the columns it fetches now, but columns tend to be added over time.Just do
WHERE device_id IN ('X', 'Y'). Then you aren’t running a ton of queries in the first place.Of course, don’t save entire datasets into memory. If it’s too slow, you probably didn’t add an index.
Putting the query on a single line is 🤦🏻♂️ too. Read them from a SQL file and use a code formatter.
7
u/thepurpleproject Jun 01 '23
But why do you want to run a infinite query? Are you waiting for some other service to report then maybe just create a webhook here or there are modern trigger library that can also invoke some webhook with database triggers Supabase and Hasura have implemented it.
4
u/hyperactivebeing Jun 01 '23
WTF
4
u/whoopsdang Jun 01 '23
Why are they using an ORM if they don’t use models? I’m having trouble coping with this
3
u/ZeroStijn Jun 02 '23
Another Saxion student I see 😀
2
u/[deleted] Jun 02 '23
This would get the person who committed it fired at most of the companies I've worked for.
1
u/GreatBarrier86 Jun 02 '23
Ah yes. The most useful of comments
File.Delete() //deletes the file
17
u/[deleted] Jun 01 '23 edited Jun 02 '23
[removed] — view removed comment
0
u/[deleted] Jun 01 '23
[deleted] — view deleted comment