(no title)
deltaoneseven | 4 years ago
Also your programming technique and style of programming influences the amount of bugs.
Generally to reduce bugs, go with a functional programming style and make sure the language has robust type checking. Functional has a bad connotation in some circles so another way to think about it is to use immutable variables as much as possible. Avoid mutation wherever you can.
This is the first step. The next steps are testing and QA, but most teams have that side covered.
borland|4 years ago
It's better to focus on clear and simple code styles and architectures. The goal is that when you're debugging the code or explaining it to someone else, you don't want any situations where things don't make sense, or something happens in a weird order for no apparent reason. Immutability can help here, for sure, but FP is a double edged sword. Sometimes it's fantastic but at others it makes your code into an unintelligible mess.
So yeah: Don't go rushing to rewrite your perfectly functional Java/Ruby/Python app across to Haskell or Clojure. It won't help you much at all. Rather, think about how you might use some of the ideas like immutability and function composition, to make your Java/Ruby/Python app easier to work with.
deltaoneseven|4 years ago
Basically immutability serves to create more invariants and reduce complexity of the program such that it is much more predictable.
I'm advocating exactly your conclusion hence the reason why I specified that immutability is the keyword, not monads and other advanced concepts associated with functional programming.