We'll respond shortly.
After Jared’s excellent introduction to Go concurrency and his look at patterns of Go channel usage I would like to share a channel-based ring buffer in Go based on channels that we developed for the Loggregator Server in CloudFoundry (CF).… Read more
You have probably heard that you can never fully master a programming language. While this is true it doesn’t mean you can’t learn the basic rules of a language fairly quickly (you can). Languages generally tend to be expressive, and … Read more
I have been asked by at least a few people if I could tell them the best way to get started with programming and I have been slightly ashamed that I was unable to confidently answer that question.
I got … Read more
During refactoring, private methods are created in order to:Eliminate duplication within the class Clarify confusing and/or complex fragments of related code (Extract Method)
These are both great refactorings, but be cautious of classes with an excessive amount of private … Read more
We built an(other) object factory module for our current project and it looks a lot like all the others:
Object Oriented Programming (OOP) as an idea has been oversold. The most commonly used languages in use today are designed around the idea of OOP. Extremist languages like Java force you to think of everything in terms of objects. But is Object Orientation (OO) a good idea? Does it have problems? Is it the right tool for everything? Let's explore some of these questions in a slightly tongue in cheek and cathartic rant.
I’ve been experimenting with functional programming (FP) languages for a little while now and their acceptance is generally increasing amongst the wider developer community. This is the first post in a series of articles I hope to do that explore … Read more
I was recently presented the problem of appending to the initialize method from a module that was being included. To do this it would need to override the class's initialize method with my own but keep the functionality of the original initialize method.
Whenever I need to do something in Ruby that I know will require some experimentation I like to move outside of my application and reproduce the problem in a simple way. For this problem I created a Person class that mixes in a Teacher module.
module Teacher def initialize puts "initializing teacher" end end class Person include Teacher def initialize puts "initializing person" end end
The goal is to get the following output when a Person object is created:
> Person.new initializing teacher initializing person
The basic program fails as expected;
Teacher.new prints "initializing person" because Person's initialize is trumping Teacher's. Our immediate goal is to replace Person's initialize with Teacher's but in a way that preserves the original initialize method. By using
alias_method we can create a copy of the original initialize method that we can call later.