## A crack at Dynamic Programming

Dynamic Programming is a discrete optimization technique. It means, the variables we want to calculate using this method are discrete. As an example, if x is one such variable then $x\in\{1,2,3,4\}$ is acceptable, but ‘x is a real number between 0 and 1′ is NOT acceptable since there are infinitely many real numbers between 0 and 1. In math terms, we can say that the domain of the variable x is a countable set.

Problems that are solved by dynamic programming are recursive nature. Let’s look at the problem that ask us to calculate the sum up to a number, i.e., if $f_s$ is such a function then $f_s(5)=0+1+2+3+4+5$. The recursive definition (assuming i is non negative) is following:

$f_{s}(i)=\begin{cases}0 & ,i=0\\i+f_{s}(i-1) & ,i\geq1\end{cases}$

## A Simple AS3 Logging Library using the Chain Of Responsibility and Singleton Pattern

Few years back, I wrote a simple logging library in ActionScript3 using the Chain of Responsibility pattern. Recently, I dug up the old codes, made some modifications, and put it in github for other people to use and contribute. In this post, I will mainly focus on how to use the library and do some project specific modifications, but  I will also briefly discuss my reasons for using the Chain Of Responsibility and the Singleton Pattern. I started writing this library with the following 4 goals in mind:

1. It should be easily accessible to all of the classes of a project.
2. It should be able to write logging information to different output sources, i.e., file, database, console, etc., and additional output sources can be added easily.
3. It should be able to handle different levels of logging like FATAL_ERROR or INFO (as different actions may be needed for handling different levels), and additional levels can be added easily.
4. It should require minimal setup.