Error between chair and clock
Error between chair and clock
“tells the user the current time” would be an excellent comment for a clock
I’m not the best at commenting my code, but generally I just try to think of what information I’d want to know if looking at this 10 years from now
Imo comments are best used sparingly, don’t bother commenting something that anyone with a basic understanding of programming would understand straight away by reading the code
Functions should generally be commented with what parameters are and what they’re for, plus what they output
use reqwest::Client;
// create a http client class that all other files can import
// so as to only create one instance globally
pub struct HttpClient {
client: Client,
}
impl HttpClient {
pub fn new() -> Self {
HttpClient {
client: Client::new(),
}
}
pub fn client(&self) -> &Client {
&self.client
}
}
Here’s an example where if I were to stumble onto this file 10 years from now, I might think wtf is this looking at it out of context, the comment explains why it exists and what it’s used for
(we’ll ignore the fact I totally didn’t just add this comment because I suck at commenting personal projects)
Listen we all know deep down the solution is to try to parse it with regex
I’ve actively been told off at work on multiple occasions for putting too much effort into making my code reusable and extendable later down the line
(As of recently I’ve had to rewrite an entire project from last year because I gave up and just wrote a big blob of difficult to maintain code, then unsurprisingly the requirements changed)
That would just be irresponsible we want fewer bugs not more of them!
Clearly you should just ship it with the debugger and call it a day
Had a look at it, looked worse than react
Definitely need to look into this for future, would make dev so much easier to just write for web and not have to deal with react native’s bullshit
Honestly doing it again I’d just write in xamarin or something not web orientated because as it turns out the web app is going to need to be separate anyway
I might look into capacitor but is that not basically just electron?
I do not code in C it was just a throwaway meme lol
I am spoiled by dotnet and rust error messages. They tell you exactly what the problem is, where it is, and in rust’s case sometimes even how to fix it
Then there’s C with “segmentation fault”
Yes I mean react native
Wouldn’t be bothering with it if I were just working with web
I like base JS and I like jQuery. Only reason I’m using React is for native cross platform mobile/web but I’m beginning to regret choosing it for that
Made the mistake of using react for a mobile app and my god why is it this convoluted, why are the error messages always along the lines of “something went wrong with networking 🤷”
Unfortunately I’m stuck with it now
Alright Frankenstein
At one of the companies I worked out we had a head dev like this, except he didn’t want to spend any time teaching the juniors so we just had to kinda figure it out from eachother
You’ve gotta wonder what else you’d write though
Especially given the urgency guy’s probably not gonna sit there and ponder
Don’t you have to set the harpoon marks manually? And actually now that I say that isn’t it just a tui on marks?
https://github.com/Droogans/unmaintainable-code
Feel like I should leave this here incase anyone hasn’t seen it
This is unfortunate for new programmers cause I think it’s some kind of learned instinct rather than a hard rule