I had a chance to look at what Neal Ford had to write on Fluent Interfaces in his book The Productive Programmer. Granted, I heard him cover it before at one of his presentations at the No Fluff Just Stuff conference in Reston, VA.
Basically, fluent interfaces have setter functions return self (or this in Java). [...]
Archive for the ‘Rails’ Category
Fluent Interfaces in Ruby
Posted in Rails on February 26, 2010 | Leave a Comment »
Safer Monkey Patching
Posted in Rails on February 22, 2010 | Leave a Comment »
General Monkey Patching
In Java, classes are defined up front, compiled into bytecode, and remain unaltered. Every instance created from a class adheres to that class.
Of course, Ruby is different. In Ruby, you can define a class and later redefine it (and of course, you can modify individual instances of a class so that they differ [...]
Ruby Metaprogramming – Dynamically Defining Classes and Methods
Posted in Rails on February 18, 2010 | Leave a Comment »
The following code uses a class factory to create a new class along with getter and setters for the fields passed into it:
class ClassFactory
def self.create_class(new_class, *fields)
c = Class.new do
fields.each do |field|
define_method field.intern do
[...]
How Ruby Differs From Java
Posted in Rails on February 15, 2010 | Leave a Comment »
The biggest difference really comes down to metaprogramming. While Java offers introspection (which was a major step up from C++), Ruby offers the ability to dynamically define new classes and methods without recompilation. Additionally, the ability to hook into a module being included or a new class being sub-classed combined with metaprogramming adds extremely powerful [...]
Pragmatic Wetware and The Dreyfuss Model
Posted in Rails on January 28, 2010 | 1 Comment »
I saw the Pragmatic Wetware book by Andy Hunt. “Hmm”, I thought, “a book on the human brain and how it works. Interesting, but I have too much else to read and study.” Wrong.
Apparently I had missed the pragmatic part of that title. As I am averaging three to five technical books a month right [...]
Regular Expression Pushups
Posted in Rails, Soft Skills on January 21, 2010 | Leave a Comment »
Regular expressions were not my strong suit, but I felt it was important to master them (or at least reach competency). So, on a flight back from Walt Disney World last summer, I studied them from one of my Ruby books and summarized them in detail in Evernote (to refer back to them). I thought [...]
Release It! The Remainder of the Book
Posted in Rails on December 20, 2009 | Leave a Comment »
In my last blog on this, I discussed some of the Capacity best practices. I am now going to briefly touch on the remainder of the book:
Networking. The section talks about best practices in a data center. This includes different networks for different functions (e.g., production, admin) and different NIC cards on different machines to [...]
Release It! Stability Patterns and Best Practices
Posted in Rails on December 8, 2009 | 1 Comment »
In my last blog I discussed some of the stability anti-patterns of Michael Nyguard’s excellent but tragically misnamed book “Release It!” I finished reading the patterns and best practices portion, discussed below:
Timeouts. Traditionally a thread blocks until the resource is ready, but this can be destabilizing if the resource is never ready. Thus, a thread [...]
Practices of an Agile Developer
Posted in Rails on November 12, 2009 | 1 Comment »
I have been reading “Practices of an Agile Developer” by Venkat Subramaniam over a few lunches. At 200 or so pages, it is a quick read (I am 2/3 through).
The problem? I have not been learning anything new.
But is that really a problem? The book is excellent, pragmatic, and full of good tips and ways [...]
Thinking Operationally
Posted in Architecture, Linux/Unix, Rails on October 30, 2009 | 1 Comment »
This blog is hosted on WordPress, which takes care of so many operational details for me. Essentially, if I can use a word processor, I host my blog on WordPress.
Now, I am creating my own virtual Ubuntu server on SliceHost to host my Rails app. There is so much more to think about! I have [...]