Functional Programming Sucks

 

Functional Programming, i.e. moving fragments of code into functions.

  1. There is a great deal of overhead in emulated languages, so it is very costly to the speed of your application (in emulated languages)
  2. It is VERY hard to debug, nothing is together
  3. You should never reuse code, functional programming only promotes the reuse of code
  4. The debugger does not support this type of programming

It is cute, and I hate cute. I would like to get ride of functions altogether, functions require documentation, which means that the human is in the loop. The more functions, the more the human is required to know. For very small examples it looks perfect, but in practice it falls apart. The people that promote functional programming do not program. Either that or they are in a religion of their own design, making it impossible to think any other way.  People in a religion stop at their beliefs, so they trust that their solution is correct.

 

Functions are simply a group of statements that exist for the benefit of the human

Function are never really needed. There is no real reason that functions should even exist. They are an invention that has done more harm than good.  In our first programming language (Assembler) they were a great invention. In that world there is no tax upon their use because all the overhead was done within the assembler and within compilers that produced the same output. (FORTRAN, C, C++,...). Now we are moving toward a more relaxed dynamic instruction output such as JavaScript where operations are determined at run time. This type of environment changes everything. We still write our languages as if we are still using an assembler where calling functions have no overhead. In fact this is far from the truth. There is a great deal of overhead in passing values into and out of a group of statements.  We could take advantage of this by not writing our compilers as if they still produce machine code, but rather that they produce conditional machine code.

So much legacy thinking remains, religions that used to know the truth have changed but the programming world has not. We are trying to drag truths that we all believed in (a religion) into a world that no longer exists. If we get rid of functions, we get rid of overhead. Our programs will run faster, and we will be able to comprehend our logic much better.  I sure you cannot see this world, but it will exist. I have build small models of this world and it is amazing and a joy. Much like the Wright Brothers building their first kite, "if we just have a motor light and powerful enough we would man powered flight". What they really did was to build a motor, not an airplane. If we just build a powerful motor, then nothing would be impossible to program.