4 ms·
> I work on a Java code base where there is try catch every 4-5 lines. There is a huge difference. The Java code you are reading is caused by bad programmers
by hota_mazi 9y ago
> I work on a Java code base where there is try catch every 4-5 lines.
There is a huge difference.
The Java code you are reading is caused by bad programmers who are not using exception handling correctly. Proper exception use means sometimes catching and sometimes ignoring the exception and declaring it in your `throws` clause.
In Go, testing against `nil` every twenty lines is not only common, it's the ONLY way to write robust code. You simply don't have a choice.
- geodel 9y agoConsidering so many projects in last 10 years where code was not even formatted even though it was one command away in IDE, ridiculous variable names, useless comments like 'method getA() returns A" I am not sure it is result of bad programmers or just natural state of IT industry. Java succeeds despite lot of bad code mean immense hard work on performance/ libs side by JDK teams. I think same is going to be true for Go. I have written few projects in Go and they have produced much more value than time taken to write them. At the end of day companies I worked for prefer mediocre code that is written and used vs excellent code in brilliant programing language that was never completed.
- e3b0c 9y agoInterestingly it makes me a better programmer after being used to the Go style. Now I don't allow unused headers/variables in my C/C++ code and feel natural to check every return error. 'Optional' warnings don't happen anymore either since -Werror feels familiar. Overall my C/C++ code becomes more reliable and easier to debug.