jueves, 1 de julio de 2010

Frameworks = Mathematical Placebos

Thanks to Online LaTeX Equation Editor. Very helpful for "The Placebo Formula"
---

Programming Frameworks are like something I have called as Mathematical Placebos, extra data that we add to equations to help us reach its results.

This extra data bloats the language ahead of the future. We tend to find many gotchas before and while we are working on a code, and they will delay code delivery.

What started easy, now is not.

To give a mathematical example, a very interesting equation, Euler's Identity, goes like this:



LaTeX: e^{i\pi}+1=0
PHP: it doesn't have built-in calculations for imaginary numbers.
Python: print (math.e**(math.pi*1j))+1

The result is this Python expression is not exactly 'zero', but very near to it. This is a common catch in floating point calculations. ;-P

Do you imagine what amount of tests Leonhard Euler did, in order to find out that relation of constants returns -1?

What I call "The Placebo Formula" (numbers I recall when I solve fractional, algebraic, or exponential equations), goes like this:



LaTeX: \frac{\sqrt[1]{\left(\textbf{1}\right)^{1}}}{1}+0=1
PHP: echo pow(1.0,1.0/1.0)*1.0/1.0+0.0;
Python: print 1.0*1.0**(1.0/1.0)/1.0+0.0

Do you get the idea of all those extra artifacts in both placebo formula and frameworks? You have to remind yourself that if you see a simple "1" in a formula, you can add any of those pseudo-numbers to ease your calculations.

In programming, this effect is also achieved when you create a common Object class for every object, including those objects not yet discovered or planned. When you have to add a behavior to all objects, you add it to that base Object class.

---
PS: I annotated what I need to do in this post instead of actually doing it! (e.g. I typed "use an image of euler's identity and wikipedia link") It is always easier said than done, although this action can prompt you to do a better organization of the way in which you express your thoughts. Write for yourself!

No hay comentarios:

Publicar un comentario