July 2010
2 posts
YAML formats are not lossless
Recently I was using YAML files to package up content to send across the wire. A part of this included a checksum and signature of the contents to ensure that it wasn’t modified, and that it came from a trusted source.
I ran into an issue where some of the content wouldn’t sign properly on the receiving side. A lot of digging later turned up that parsing yaml content in ruby with...
Ruby 1.9.1 modifies request headers
I just ran across something in Ruby 1.9.1 that definitely violates the least-surprise principle (at least to me). It is in Net::HTTP#get.
def get(path, initheader = {}, dest = nil, &block) # :yield: +body_segment+
res = nil
if HAVE_ZLIB
unless initheader.keys.any?{|k| k.downcase == "accept-encoding"}
initheader["accept-encoding"] =...
June 2010
2 posts
Thick Pipe Example: Ruby Code Storage
In my previous post about laying thick pipes, I talked about the importance of writing code that doesn’t do just one thing, but enables more possibilities of other pieces of code to do a bunch of stuff based on input.
Laying a thick pipe is usually different than over-engineering in that it rarely requires an object oriented approach to do it. An example of over-engineering a project would...
Lay Thick Pipes
One thing that has becoming increasingly important to me over the years when writing software was architecture and design. At first, there was no “architecture” in my code in any traditional sense. It was not laid out in any deliberate manner and once I got it working - it stayed.
Of course, its obvious here that the project quickly becomes a disorganized mess that is almost...