• Monads

    Monads allow you to chain together operations in your program without any unintended consequences. And they are a functional design pattern that are widely used and some languages even force you into using them like Haskell. I hope to build upon the definition of a monad as the post goes...


  • What is Middleware?

    Middleware connects two parts of your application together and passes data between them. It can be thought of as the glue for your application. A common example is Rack middleware. Rack is an interface between webservers supporting Ruby and Ruby frameworks. Rails and Sinatra are a couple of frameworks that...


  • Theory Behind Monoids

    This blogpost covers a brief background on the formal definition and theory behind Monoids. It by no means comprehensive or math intensive, but is more so a brief introduction to monoids. A monoid is a mathematical term, but is a practical pattern in functional programming. It is a system that...


  • Interface Segregation Principle

    The interface segregation principle is the “I” in the SOLID Principles. Bob Martin defined it as “Many client specific interfaces are better than one general purpose interface.” In other words, clients should not be forced to implement interfaces they don’t use. Having one large, bloated interface with methods that implementing...


  • Streams

    Java defines input and output in terms of streams. An input stream is a class that reads data and an output stream is a class that writes data. Streams are used for many different purposes. For example, to read data from a file you can use java.io.FileInputStream. In terms of...


  • Introduction to Networking

    I had the opporuntunity to read the first chapter of Java Network Programming by Elliotte Rusty Harold. The first chapter covers networking basics, and this post will summarize many of the concepts covered in that chapter. To start off, here’s some basic vocabulary about networking: Network - collection of computers...


  • Brief Introduction to Generative Testing in Clojure

    In Eric Normand’s talk at Clojure/west he covers the benefits of generative testing. He specifically covers Clojure, although generative testing can be used for any language. In unit testing the engineer comes up with the different scenarios that a user could possibly select and asserts that their program works in...


  • Throws keyword in Java

    The throws keyword is used in method declaration. It specifies that an exception may be thrown by a particular method. When should it be used? If you are catching an exception in your method then you do not need a throws keyword. For example, if you have a try/catch within...


  • Interpreter Vs. Compiler

    Interpretation and compilation are implementations of a language rather than a property of a language. It is, in fact, not correct to say a specific language is compiled. A language can either be executed through a compiler or interpreter, it’s just a matter of implementation. For example, Python code is...


  • Tail Recursive Minimax

    My post a few weeks ago about implementing minimax in Clojure was written in a linear recursive way. Another way to write the same algothrim is in a tail recursive manner. Both have their pluses and minuses which I’ll discuss further into the post. But I want to go through...


  • Database Query Optimization with Hashing

    Hash functions can be particularly useful for searching through a database with a large amount of data. For example, lets say you have a very large table of name and phone numbers like this … Given a name if you wanted to find the corresponding phone number you would have...


  • Minimax

    This week I spent most of my time implementing Minimax in Clojure. Upon first approaching the problem I thought my implementation would be similar to my first implementation of minimax in Ruby. But to my surprise the Clojure implementation came out quite different. The goal of minimax is to have...