Earlier quoted context omitted.
Think about your error handling best practices. Mine are: 1. Re-structure your logic so the error cannot happen 2. If you can't do 1, recover from the error silently and continue on with the program 3. If you can't do 2, handle the error gracefully and notify the user of what state is changed, letting them choose whether or not to continue 4. If you can't do 3, inform the user of what happened and ideally provide the…
"2. If you can't do 1, recover from the error silently and continue on with the program" I think that defensive programming is the worst way of dealing with errors. You are now silently diverging from your business requirements by making up data.
Ask HN: What habits make a programmer great?
181–190 of 191 posts
Re: Ask HN: What habits make a programmer great?
#182Earlier quoted context omitted.
This is a great comment! If you have a blog could you make it a blog post? It deserves to be read more widely.
I've been tempted to start a blog...I've gotten a few requests on HN...but I'm still in the "rather be a programmer than a web celebrity" phase. I'm afraid it'll be too much of a distraction from my projects. Plus, I usually write better in response to a prompt than coming up with content in a vacuum.
On HN, I often check specific commenters activity, or new comments in a thread that can be days-old, because I often find hidden gems. A link to more elaboration would definitely count as such. Perhaps an audience of even just a dozen or so people like me might be worth it.
EDIT: Coincidentally (I swear), there's exactly a dozen of comments that positively engage with your comment!
Re: Ask HN: What habits make a programmer great?
#183Re: Ask HN: What habits make a programmer great?
#1841. All programmers should drop the "I don't have to be good at math" habit...you're disrespecting people who are likely in possession of knowledge that will help you later. Being "good at math" means you communicate and try to understand concepts. It's more about attitude than knowledge. 2. All programmers should learn Galois theory, not only to get over the idea that they can't be good at math, but to learn to appre…
Re: Ask HN: What habits make a programmer great?
#185Earlier quoted context omitted.
I sometimes temporarily modify the program by for example misspelling a file name of a data base column name just to provoke an error that will execute the error handling code. Or changing a condition from == to != to cause an exception. Not ideal, but at least the new code is executed at least once, so I see that it executes as expected. Creating tests for some of these cases would involve mocking things out, and th…
>I sometimes temporarily modify the program by for example misspelling a file name of a data base column name just to provoke an error that will execute the error handling code. Yes, a lot of things like that are possible. I remember in one client-server project I worked on, we unplugged the network cable from one PC (while the program was communicating between client and server), to see if we got the correct error m…
This was done in a project I handled, for the World Bank. I had a team of 9 motivated though young developers (first project for most of them). Near the end, before we sent the software to the client, a colleague was assigned to test the software - testing by a member external to the team, a slightly senior guy, ex-CITIL (a Citi IT subsidiary which had more mature software processes than we did then), though of course we did test the software ourselves a lot, first. I remember what happened:
We prepared the machines and software for the test. Called him over.
He said: I am going to sit down and destroy your software.
We said: Go ahead, please try.
And he tried to. But could not. He only found a few minor cosmetic defects.
Getting up after a few hours of rigorous testing, he said something like - I am happy with your work.
Re: Ask HN: What habits make a programmer great?
#186Re: Ask HN: What habits make a programmer great?
#187Re: Ask HN: What habits make a programmer great?
#1881. All programmers should drop the "I don't have to be good at math" habit...you're disrespecting people who are likely in possession of knowledge that will help you later. Being "good at math" means you communicate and try to understand concepts. It's more about attitude than knowledge. 2. All programmers should learn Galois theory, not only to get over the idea that they can't be good at math, but to learn to appre…
Re: Ask HN: What habits make a programmer great?
#189Earlier quoted context omitted.
Read (good) fiction. Backed by science! https://www.scientificamerican.com/article/novel-finding-rea... https://www.theguardian.com/books/booksblog/2013/oct/08/lite... https://www.washingtonpost.com/news/speaking-of-science/wp/2... https://www.psychologytoday.com/blog/the-athletes-way/201412... I've been confronted with this question a couple of times even before I read the articles linked above and I always answered…
On this note... the books I've found most interesting over the last couple years are ones that expand my mind to a viewpoint or a perspective of another people group that is different than my own. Two very different books but, Between the World and Me, and How to Get Filthy Rich in Rising Asia both made me think in ways I cant quite describe.
Re: Ask HN: What habits make a programmer great?
#190Oh god, again with this.