Friday, August 28, 2009

BNFT part 1 done

Ah, small steps

The "biggest" advantage of being a lazy programmer is that programming tasks gets designed to a minimum of programming. I have spent some time trying to port it from C++ to Java, which proved to be a b*st*rd (inglorious or not). At some stage I thought about how I usually implement parsers very quickly and decided to try from scratch.

Turned out that 3 hrs was enough for mocking the parsing part up (while trying to use only simple java, so it would port easily to other langauges).

So what remains is the execution part, for which I have designed an even simpler and speedier design that the original. By "accident" I came up with a lazy evaluation scheme, which should be pretty efficient, considering what the original tool did, with an abundance of stacks of strings (which was the ports biggest problem).

Now I will build a tree to do the second level parsing, which while traversion will build a second tree, where I call the an eval function to get the result in the end.

This means that the parsing itself will not be optimized, but putting together the answer will only take the "correct" path into consideration. Should be simple and nifty.

Hopefully I will soon have time to implement the last part so I can release it.

Wednesday, August 19, 2009

Exceptions revisited

Exceptions are another of those constructs that puts the power with the designer/implemeter instead of the user. The designer decides to throw the exception - now the user HAS to handle it by hook or crook.

To reverse the power the current exceptions style mechanism has to be remove. As stated earlier Dawn does not have return value, values are propagated forward through calls. Thus is it easy to signal errors by calling forward through an output. The user can ignore it, which puts the responsibility on the implementer to make sure that the component lives with faults without terminating or crashing.

The user can decide to pipe this error output into a logger, or reinstate the exception mechanism by terminating the scope (for which I have to find a graceful mechanism, break is not my favorite keyword).

This will lead to fault oblivious software, where faults in functionality will be faults in functionality only - not the mess today where faults in functionality can lead to application crashes, which makes a fault more serious than necessary.

This is also why null is NOT a big mistake - its just the handling thats the mistake i.e. the crash. Just be oblivious to it, and grace is reinstated.

What? Faulty software? Ah, you still live in the world where you think software can be without faults..

Thursday, August 13, 2009

Functional programming and the new black

Functional Programming have been all over the media (well at least the part that addresses programmers) the last year or so. Although I have not programmed in any functional language (as of yet), I still have an opinion about it (and why Dawn is not functional based).

As far as I know (and feel free to correct me), functional style programming can be done in most dynamic languages by observing a few key principles, but dynamic cannot be done in a functional language. In my book that means that dynamic languages is more general than functional languages; that functional practices are a limitation of the expressiveness (sounds like a bad thing formulated like this - but Im not saying that its a bad thing); that functional is in fact a convention or a DSL if you like. And as far as conventions goes I try to keep them out of Dawn, but welcome them as a specialization of its use.

My design purpose is to be general, general and general. That’s why the only general error handling I have discovered is timeout, that’s why generics, templates and concepts are replaced by the identifier override functionality; that’s why functions are objects with a single output - because all the other things are specializations and I want more generalizations.

I’m on the hopeless quest of the single programming language for all purposes, doomed to fail, but hoping to get a better result because of reaching for the stars (just hoping that I’m no Ikaros).

"Everybody's talkin' 'bout the new sound. Funny, but it's still rock and roll to me"
Billy Joel