DEV Community

Discussion on: Write Better Code With [Functional Programming & Elixir]

 
aminmansuri profile image
hidden_dude • Edited

Yeah that needs refactoring.

Also overuse of if/else and case is not helped with FP popular error handling these days.

A nice thing about exceptions is that you can essentially ignore errors in most places rather than having and if/else everywhere or an error handler everywhere.

That style seems to be devolving into old styles where error handling is mixed in with the happy path making the code harder to read.

Classic OO (Smalltalk) and classic FP (if you consider Common Lisp FP) didn't even really have "if statements" or "case statements".

These were handled in the libraries.

I think modern OO languages biggest flaw is there over reliance on statements and keywords that make them much less extendable than Smalltalk or Lisp where you could literally change everything by extending the libraries.

Really no "modern" OO language really has that flexibility and clean design. Not Java, not C++, not C#, not Ruby, not Python, not JavaScript.