Tag Archives: Rails

What is Dependency Injection

If you are a developer, chances are very good that you know what Object-Oriented (OO) code is. You might have also heard about OO Design Patterns, things like single responsibilities, decoupled code, and my subject here: Dependency Injection (DI).

OO Design patterns help you write code that is easier to change, and easier to test. Being quite abstract concepts, they apply to many modern programming languages, including Java, Ruby and PHP. Each language has its own way to do things, thus each language implements the concepts in a different way. Some implementations are similar, others not so much. In this article I’ll talk about Dependency Injection with a special focus on web development. I’ll explain what DI is, and I’ll elaborate on Ruby’s implementation. Finally, I’ll compare the Ruby approach with PHP’s view on DI.

Continue reading What is Dependency Injection

A Web Developer’s OS

What must an Operating System do to satisfy web developers’ needs? This is a tricky question, as each person is a whole different world, so it’s impossible to have a single answer to satisfy every person.

One could say “Well, because each person is different, the OS must be able to adapt to all different kinds of people”. Basically, meaning the OS must be easy to customize. This is great, but when is it too much customization? Systems that are very customizable also tend to be hard to use. In this post I’ll compare the three most used Operating Systems out there, namely Windows, OS X and GNU/Linux. I like FreeBSD but the userbase is so small I sadly won’t consider it here.

When talking about customization, I’d say Linux is king. Windows, on the other hand, is not natively customizable, but easy to use and with sane defaults. OS X gets the best of both worlds. That’s just my humble opinion, as I don’t consider myself to be a full power user of any of those systems, I just use them to get work done on a daily basis.

Continue reading A Web Developer’s OS

FMPRoRHTTP, or, making FileMaker interface with Rails over HTTP

[Authored by Ian]

I’ve been doing work on a couple projects integrating Rails with FileMaker Pro (FMP) over HTTP. There are a few different FMP features and plugins the FMP developers use to connect to Rails, none of which I truly grok. Notwithstanding my lack of FMP knowledge, I wanted to write-up what I expect from FMP as an HTTP client, and what I think would be neat to see.

A Good Foundation

When I’m integrating with another system over HTTP, I usually provide usage examples for my Rails-based service using the lingua franca of *nix system tools like Bash, Curl, WGet, LWP, and Telnet. I expect an integrating client like FMP to be able to perform the same basic functions those commandline tools perform.

Continue reading FMPRoRHTTP, or, making FileMaker interface with Rails over HTTP

Never write a render_foo method again

[Authored by Ian]

I’ve probably written a hundred render_not_found methods in my life as a Rails dev. Usually they just render a static file under /public, and maybe, if I’m feeling nice, give an XML response. No more!

Continue reading Never write a render_foo method again

Remote Pair Programming: Part II: Sharing the server

[Authored by Sam]

[01/04/15 – Editor’s note: This post was written in 2008. In 2015 we don’t use this “reverse ssh tunnel” method much anymore, but the technique is still interesting.]

In my last post I described how to use reverse ssh tunnels and screen -x to setup a remote pair programming environment.

Several people have commented that this works well for sharing a console based editor (vim, emacs) but that there is no way for the remote pair to look at how things are rendering in the browser. Well here’s a super simple way to use ssh tunnels to share your development server too. I’ve seen variations on how to do this (Advanced Rails Recipes: Pragmatic Programmers has one). The advantage to the below method is it requires no server configuration and is very secure from snooping.

Continue reading Remote Pair Programming: Part II: Sharing the server

Remote Pair Programming: How we do it

[Authored by Sam]

[01/04/15 – Editor’s note: This post was written in 2008. In 2015 we don’t use this “reverse ssh tunnel” method much anymore, but the technique is still interesting.]

There’s a lot of talk about remote pair programming, but the fact is it can be a pain to set up.  Using iChat screen sharing is a popular method, but can feel a little cludgy, and doesn’t work for developers running Linux. Here’s another method using reverse ssh tunnels and screen -x we use a lot at Beezwax.
Continue reading Remote Pair Programming: How we do it

FileMaker Pro/Rails integration methodology

[Authored by Ian]

Here’s a synopsis of my findings on integrating Rails with FMP.

Goals:

  • allow two-way data transmission between FileMaker Pro (FMP) and Rails
  • minimize development time required for both FMP and Rails
  • accommodate as many clients (which may be another application written with FMP, Rails, or anything else) as possible

Continue reading FileMaker Pro/Rails integration methodology

A Use For Git’s Post-Commit Hook

[Authored by Sam]

I love git and I love to be lazy, so lately I’ve been playing with git hooks.

Git’s default pre-commit hook is really handy, but today I’m in more of a post-commit kind of mood.  Like all git’s hooks it comes with an example script.

This one isn’t particularly useful.  It evaluates Nothing and returns a successful exit code.  Big deal.

Git’s default post-commit hook.

Continue reading A Use For Git’s Post-Commit Hook