sometimes 37 signals is so right on
They just went to a four-day work week. “Urgency is poisonous!” says Jason. I couldn’t agree more.
It is hard to write a book, and other whining.
Dear Internets,
I have been neglecting you. That’s because I started a new job last month, at a place called Smartleaf, doing Ruby on Rails development for 20 hours a week. It is fantastic. It is a lot of fun. It’s great people, good food, easy commute, and coding. I haven’t been an employee for years, so it’s quite a change for me, and in a good way. (It turns out that you can write better code without children yelling in your ear.)
But I’ve got these kids and this life and this job and I’m kinda busy.
Also, I’m supposed to be writing a book about computer science for practicing programmers. It’s meant to be an overview and sourcebook for people who didn’t get CS degrees but are working as programmers. Which, it turns out, is most of us. And when I signed on to write it, I hadn’t actually anticipated that a great job opportunity would drop into my lap, the way this one did, so I thought I’d have four or five hours a day to work on it. But suddenly I have about three minutes a day to work on it, and I’m having a really hard time. The subject matter is not easy. It is not just something I can write in my sleep. I don’t know the stuff I plan to write about. And even though I’ve lately become a big believer in the idea that you can accomplish an awful lot in just fifteen minutes, I fear that it is turning out not to be the case that you can write a book about computer science in just fifteen minutes a day.
Actually I emailed Steve Yegge about the book (partly because he was an inspiration for my wanting to write it, and partly because I wanted to use some quotes from his blog in it and wanted his approval) and he wrote back and said something like (I’m paraphrasing here): Hah, good luck. Many have tried, all have failed to write such a book. Which was a little bit depressing and discouraging, but honestly, what do you expect from Stevey?
Still, my editor is getting restive (hi Daniel!) and with good reason. Maybe we should put the book on hold, he asked, and see if it’s actually going to happen? Ick, I said. That is a terrible idea. I am going to write the damn book. Of course I can do it.
But I don’t know how. I don’t know how to do it, internets. I need your help, hive mind. I asked my friend John if he wanted to write the book with me, and he was like “hah, no.” All he does is send me links to stuff that I should read for the book, and recommend books that would be helpful, and talk about how much he wants to read the book. I asked Max to make me work on it for an hour every morning before the kids wake up, but the kids somehow magically sense when I am awake and wake up with me. And I have never been a morning person and I just can’t think at 6:30 a.m. And I have two hours on Saturday morning to myself when the kids go out to the French library with Max, so today I managed to clean the bedroom, set the robot to vacuum, and dump all the clean laundry on the bed in an enormous mountain so that I am forced to fold it before bedtime. I also went for a short walk and stopped in at the bookstore. And finally started typing this and as I am writing the family is returning, and a baby is running down the hall crying for me. So that was my morning.
And I realize how obnoxious it is that, out of amazing good fortune, I have a book contract, an actual book contract, with people who are my programming heroes, and here I am complaining about it, and basically just screwing it up.
So this is what happens: i get some bursts of energy to work on the book — like I spent two weeks reading and learning a bunch of stuff about C, and figuring out all the different ways to get segfaults, and I wrote a few pages of notes for a chapter on C, and I found awesome documents like the ANSI C Rationale on the internet, and I also read a bunch of stuff about machine architecture and cache memory and pipelining and bitwise operations and analog computing and I took a bunch of notes, and I thought a lot, and I wrote some stuff, and I made what progress I made by basically doing nothing but that, work, and cooking dinner. I mean, I basically ignored my children. I’d be like “uh huh, that’s great, but I’m really trying to understand the semantics of arrays in C right now, sweetie pie.” Oh, and I didn’t get quite enough sleep. After a couple of weeks of that I needed to do things like make plans for our trip to Europe in May (for my oldest friend’s wedding, not just because we’re decadent francophilic wine-and-cheese freaks, although we are that too, but man, that Euro is PAINFUL now) and get the taxes ready to send off to the accountant, and fight with the insurance company about various claims they refuse to pay for various ridiculous reasons. And read to my kids, and spend ten minutes alone with my husband, and parent help at Ari’s preschool, and everything else. And honestly, our lives aren’t even that busy. Our kids are not in a ton of activities. We don’t schlep around to baby music and movement classes. Ari is in no organized sports. He goes to preschool three mornings a week. Max and I each work 20 hours a week, and we have about 18 hours of babysitting.
But somehow I just can’t manage it.
What this tells me, first of all, is that nobody out there is managing it. We have far, far more time than most other parents with two children under five, and it’s still not ‘enough’. There’s an endless pile of stuff that I think should be getting done that isn’t getting done. This tells me that my ideas about what has to actually get done are just wrong, because I’m not getting a lot of these things done but things go on just the same. So I should probably just drop that stuff off my list. Like “inventory our crap for insurance purposes.” And “clean out the basement storage room”. And “start tomato seeds.”
But honestly, I’ve already dropped all that off my list. I’ve even dropped baking bread off my list, for the time being, and I’m someone who has an actual grain mill sitting on her counter. I grind my own damn wheat to make my own damn bread, and I haven’t done it in a couple of months.
I don’t watch TV or movies. The entire season 3 of Lost is sitting on my dresser waiting to be watched, but it’s an enormous commitment and I just don’t see how I can make the time. I’ve cut my newsfeeds down. I do no recreational reading except that I sometimes give an hour to the New Yorker.
Look, internets, I really want to write this book. It’s a lot of fun, except when it’s so painful I want to die or puke or something. I’m learning a lot. I think I could help other programmers figure out how to learn the stuff about computer science that they want to learn, and help them figure out why they should care. But it turns out, unsurprisingly, to be really, really, really hard to write a book. At least this kind of book. Well, I’m sure any book, really.
But am I just a big lazy whiner? I honestly don’t know. I thought maybe the book would be a year-long project, and it looks to be more like a five-year-project, especially at the pace I’m going. Now it’s true that Don Knuth is still working on his opus, but I’m not Don Knuth. Does the world need what I have to offer, or am I torturing myself and my family for an unnecessary project?
I keep thinking, okay, well, I didn’t make much progress that way, I’ll try some other way. And so I try all the hacks I know of to motivate, and make time, and make progress. And I keep trying in different ways. And when I drop it for a few days and fall off the wagon and stop meeting my goals, I just try again. So I’m sorta impressed with myself about this, that I keep trying, even in the face of basically constant failure and what feels like a pathetic lack of progress. But boy does it take an emotional toll. Writing this book (or mostly not managing to write it, as the case may be) is incredibly emotionally and intellectually taxing. Not to mention time-consuming.
I know we don’t have a ton of blog readers out there, really. But if anyone out there wants to offer some encouragement, or has any suggestions, I’d love to hear from you.
DHCP on VMware Fusion
VMware Fusion is a wonderful thing. I am happily running three Linux instances at once under my MacBook with 4GB of RAM (though, as best I can tell, the mobo can actually only address 3GB of RAM).
One glitch that was driving me crazy, though, was that it seemed like DHCP leases were being allocated flakily to the guest machines. When you’re doing database replication, you can’t have master/slave IP addresses changing all the time. (And you certainly don’t want two machines with the same IP address!)
Some digging around turned this up. I don’t remember exactly where — I believe snippets of it were in an official VMware forum — but it was harder to find than it should have been. Hence my posting, to add another path to help those who need it.
On OS X, the file you need to change should be in /Library/Application Support/VMware Fusion/vmnet8/dhcpd.conf. (vmnet8 is the virtual interface for NAT networking in the guest machines.) You should have a subnet clause in it already like this:
subnet 172.16.253.0 netmask 255.255.255.0 {
range 172.16.253.129 172.16.253.254;
option broadcast-address 172.16.253.255;
option domain-name-servers 172.16.253.2;
option domain-name "localdomain";
option routers 172.16.253.2;
}
Now, for each virtual machine, set up a new host clause, e.g. :
host ubuntu64-vm {
hardware ethernet 00:0F:FF:EF:00:00;
fixed-address 172.16.253.20;
}
Be sure to assign an IP address (fixed-address) outside the range specified in the subnet clause at top.
Get the Ethernet MAC address from ifconfig eth0 inside the guest machine, or from ~/Documents/Virtual Machines/GUESTMACHINENAME/GUESTMACHINENAME.vmx (it’s the line with ethernet0.generatedAddress).
Finally, restart the requisite VMware daemons by running
sudo "/Library/Application Support/VMware Fusion/boot.sh" --restart
No Ranting, No Railing, Just Grading
A few of our students, people new to ruby and rails, are pretty turned off by the ranting and railing in the rails community that’s been on super-duper heavy display lately, what with the Zed thing and the Dreamhost thing and all. (No links, google Zed Shaw and Dreamhost Rails for your ownselves.)
These students want to know: what’s up with the rails community being so childish, ranty, obscene, profane, and macho? If rails wants to be treated like a grownup framework for grownups, shouldn’t rails act like a grownup? How are we supposed to take rails seriously when the guy in charge of rails thinks people who are offended by swearing are not worth his time? And why should we want to join a community that appears so unwelcoming?
To which I say the following:
First, my job is not to defend rails and all the people associated with it (Right, say students, your job is actually to finish grading our assignments. Could you finish?!? I’m working on it, I swear). If Rails is a ponzi scheme I have not been let in on it; I get no kickbacks from duping students into learning it. I am enthusiastic but not passionate about rails ( I believe, as I’ve said before, that my only true passion may be cheese), and I hope I’ve managed to share some of my enthusiasm with our students, without appearing cultish.
Second, I could point out that the Ruby and Rails communities are not isomorphic. There is a lot going on in Ruby that is not rails. But it’s also true that many people come to Ruby through Rails, so if the rails community is unwelcoming, then fewer people may make it over the hump to discover the Ruby in which Rails is built. That’s too bad, because they’d be missing out on something truly lovely. Still, there are other truly lovely languages out there too. “Let a hundred flowers bloom, let a hundred schools of thoughts contend,” except without all the reeducation camps.
Third, it’s possible that Rails will hit a wall due to personality problems. It’s also possible that, being young, Rails will grow out of its personality problems. If you don’t like the personality of the rails community right now, just wait, it’ll probably change. Or jump right in there with your own personality problems, mix it up a little.
Whatever happens, though, I think that Rails has a few good tricks that the rest of the web development community has and will continue to learn from. I think that Rails, like all frameworks, will someday go out of fashion, and then, out of date, and then, eventually, fade into obscurity. And I think more good and interesting and beautiful things will come out of Ruby.
In any case, as I wrote to one of the students who was a bit depressed by the recent rails flame wars:
For me, I know that if it had not been for rails getting popular, I would not have gotten into Ruby, and if I had not gotten into Ruby, it might have been much, much longer before I’d realized that life could get a whole lot better than:
Iterator iter = collection_thingy.getIterator();
while (iter.hasNext()) {
Thingy thingy = (Thingy) iter.next();
}
No one can take each away from me.
Fearless Play. Or, What We Did in 2007
This morning I just rediscovered a year-old post on James Gray’s (of Textmate: Power Editing for the Mac fame) blog, in which he answers the question “How do you get so much done?”
I can’t tell you how often I see people say things like, “I’m not really qualified to do that,” or similar excuses. Oh hell, neither am I, but I wouldn’t let a little thing like that stop me! You learn as you go, you drag in the help you need, or whatever. Passion will conquer so care enough to have some. Be the driving force and the rest will take care of itself.
He fingers both fearlessness and passion as important to getting things done.
Me, I don’t much care for passion. I distrust passion. Except, as I pointed out in August, as regards cheese:
I still think passion is overrated, though. Except where cheese is concerned. I am passionate about cheese. For example, this Vermont Brie is really fantastic. If only someone would make a truly artisan domestic parm…! But I digress…
I like interest, friendship, love, playfulness, curiosity, satisfaction, absorption, and joy. Maybe that’s because passion implies a kind of singlemindedness that I’ve finally accepted that I just don’t have, and don’t want. Maybe it’s because I find that I cannot be passionate and fearless at the same time: passion makes me cautious. My best work, my best ideas, and my best productivity come when I am playing with something that is not excruciatingly important to me. It’s a spirit of fearless play, not passion, that drives what I do.
Not, note, that I am claiming to actually accomplish an awful lot. I’m just pointing out that, to the extent that I accomplish anything, it’s because I don’t take it too seriously. The second I start taking something seriously, I completely freeze up.
For example, this time last year, I’d just had a baby. I hadn’t worked for pay in about three years, and I had no plans for that to change anytime soon. Then Max had a contract end and decided he wanted to learn Ruby on Rails (this was back when he thought he really wanted to be an app developer, before he realized that his sweet spot is all the technical stuff that has to do with app development that isn’t actually about writing application code.) Anyway, so he was having a hard time motivating himself to do the AWDR tutorial. Fine, I said, I’ll do it too, maybe we can motivate each other.
Then I convinced him that we should try to start consulting together, and we started the blog. Hey, I thought, no one is reading this thing, I can write whatever I want. For example, here’s a quote from my very first blog post, in March:
Someday soon we’ll be able to say “yep, we know Ruby on Rails” and we’ll have our fantastic contributions to the open source world to prove it. “Right,” you’ll say, after reading this blog. “We’re looking for someone with five years experience with Ruby on Rails. You have three months.” And we’ll say “That’s the way it goes, suckas. You want to hire people who don’t actually exist. We, on the other hand, exist.” About Ruby. We’d originally decided that Max would pick up Ruby on Rails, and I would freshen up my Java skills with STRUTS, which was just coming out last time I did serious Java coding and which I am, by all rights, long past due for learning. This felt very serious and sensible. Also not fun.
And then, later that day, the key to it all:
How are we able to be so marvelously decisive? We just pretend that everything we’re doing is fake, and therefore of no consequence.
If we’d been really passionate about the whole thing, and utterly convinced that this was our calling in life, that our business absolutely had to succeed, that everything had to be done right, we would never have gotten anywhere. But we started out not caring. We did not know ruby on rails. We did not know any ruby on rails developers. We had no idea where we would find clients. I hadn’t done any programming whatsoever for nigh on three years, having devoted my time instead to recovering from the nervous breakdown I had when I was pregnant with Ari, learning to garden, grinding my own wheat for baking bread, writing a political blog, rediscovering my love of painting, visiting and eventually applying for and receiving visas for permanent New Zealand residency and, finally, being bedridden and anemic and puking during most of my second pregnancy. So hey, why not try something new? Who knows if we’ll like it? Who knows if we’ll be any good at it? Who knows if it’ll work out? Who cares?
Here’s me a month after we started the blog, in April:
I don’t know where this all is going, exactly. I’m not ready to work full-time right now. I’d rather Max not work full-time either. I want us to find a way to work together, and not all the time. I want everything — the perfect setup! I am not sure how we’ll get to our dream work from where we are right now. Will we find a job to share, or will we be laughed out of any company we tried to convince to hire us for one? Will we do some consulting, or will it turn out that we can’t stand all the self-promotion required to consult? Will blog.thirdbit.net end up going to that great bloggie graveyard in the sky? Will I work for pay again, or spend my days sitting in the park snickering at the bugaboo strollers? Is the final cylon really who we think it is, or was this year’s season finale a red herring?
In May, we got our first clients. In July, I saw a post on the Boston Ruby Group that someone needed a TA for a Ruby on Rails class at Harvard Extension. Hey, I thought, I’ve been a TA at extension before, maybe I could do that. I went to the interview and was like “yeah, I’ve been using RoR since, uh, March.” And John, bless his heart, was like “oh that’s cool, whatever.” He wanted a TA who already knew how very much work it was to grade all those programming projects, and how very little money Harvard thought all that work was worth.
In August I wrote a blog entry about method_missing which somehow got Reddited and then mentioned on Ruby Inside, which resulted in a huge spike in blog traffic.
And I ended up TA’ing this class. And it’s been absolutely a blast, and John hired Max to do some systems consulting work (migrating his company over to a new bug database).
And after John introduced me to Steve Yegge’s blog I started feeling I was just a completely crap developer who knew nothing about anything, and that gave me an idea for a book one night when I was up with Aya who was teething, and wrote up a proposal the next morning, and sent out the proposal, and got a book contract. So now I am writing a book, about which more soon.
And since I was TA’ing the RoR class I made sure to show up to the Boston Ruby Group meetings and eventually everyone got used to me being there and started to know who I was, and I started corresponding a bit with Greg Brown over email so when he came up to speak at the December Ruby Group meetingI was like, what the hell, and invited him to dinner, which was a lot of fun.
And Max and I each got more clients doing exactly the kind of thing we each like most to do right now. ( Obligatory self-promotion: Look here for more info if you might want to hire one or both of us!)
Anyway, it has worked out for us. Not exactly the way we imagined it might, but nothing ever does. And since we weren’t all that invested in what we’d imagined in the first place, it didn’t bother us that much to change it.
I don’t know what will happen next. But I do know that everything great that we’re getting to do, all the good stuff happens when we treat our lives like a game, and play, fearlessly.
Joel Spolsky Gets It Wrong
Joel Spolsky recently posted the transcript a speech he gave to the Yale CS department on November 28th. It reads a bit like an extended recruiting pitch, which, of course, it is. Because why would he give a talk at Yale CS and not attempt to pick up some smart people to work for him while he was there?
Anyway, one section of the talk is all about how it sucks to write in-house software. Joel says it sucks because, first, you don’t get to work with cool technologies, because no one will let you:
you’re not going to allowed to build things with Ruby on Rails no matter how cool Ruby is and no matter how spiffy the Ajax is going to be. You’re going into Visual Studio, you’re going to click on the wizard, you’re going to drag the little Grid control onto the page, you’re going to hook it up to the database, and presto, you’re done.
Second, it sucks because you don’t get to work on a project past the point where it minimally solves the business problem at hand and because of that, you’re stuck building and fixing ugly, broken things for not enough money and no respect.
The key point about in-house development is that once it’s “good enough,” you stop. When you’re working on products, you can keep refining and polishing and refactoring and improving, and if you work for Facebook, you can spend a whole month optimizing the Ajax name-choosing gizmo so that it’s really fast and really cool, and all that effort is worthwhile because it makes your product better than the competition. So, the number two reason product work is better than in-house work is that you get to make beautiful things.
Third, it sucks because no one thinks in-house developers are very important:
Once at a Viacom Christmas party I was introduced to the executive in charge of interactive strategy or something. A very lofty position. He said something vague and inept about how interactivity was very important. It was the future. It convinced me that he had no flipping idea whatsoever what it was that was happening and what the internet meant or what I did as a programmer, and he was a little bit scared of it all, but who cares, because he’s making 2 million dollars a year and I’m just a typist or “HTML operator” or whatever it is that I did, how hard can it be, his teenage daughter can do that.
Therefore, says Joel, serious programmers should work at software product companies, like, say Fog Creek Software.
I’m sure a lot of in-house software development jobs are just like Joel says. But there are plenty of really rewarding in-house positions available. For example, what he describes is not at all what I experienced while working at Millennium Pharmaceuticals (2001 -2003, with some consulting work on and off after that). Informatics was pretty crucial to the company’s vision of how it would revolutionize drug research and development. Developers were respected, and we tried to make our software, if not very beautiful, at least not completely butt-ugly. There was room for plenty of innovation in what technology we used. It was a great place to work, and I worked with some amazing people there. I felt like the software I was making was actually helping people do their work, and it was work that they cared passionately about, and I understood how they could be passionate about it, even if I wasn’t myself passionate about it. Most of the code I wrote went to helping the molecular pathology department manage their experiment workflow. I thought the domain (biotech, and as far as what molpath was doing, basic disease research) was interesting. I was really happy there.
Conversely, I’ve found that I’m not really at my happiest working on consumer products. I don’t get excited about consumers. I think that their consumption is pretty much the least interesting aspect of people, and I think that when people are acting as consumers, they tend to be at their most demanding, irrational, and childish. I also don’t think that people like that Viacom executive who had so little respect for Joel are found only in big companies with big in-house software teams.
I like to help people get their work done. I like the philosophy of ‘good enough’. I don’t really care that much about ‘really fast and really cool’ unless someone convinces me there’s a very good reason to care about it, and the reason is better than “well, people will think it’s cooler and buy more of it.” I’m just not a very good capitalist that way.
In any case, plenty of software product companies make butt-ugly software that’s only just good enough, using awful techonology, so I really don’t think the distinction is a valid one. And I think that we’ll see that an increasing proportion of in-house software written in ruby on rails. Maybe it won’t have cool AJAX livesearch widgets in it. So what?
It’s not that I think appearances aren’t important. It’s not that I don’t think that there’s a place for consumer software products. And I know that lots of in-house software development sucks. But I think Joel is over-generalizing in order to make a stronger recruiting pitch. And I think that he wrongly assumes that what makes him happy is going to be what makes everyone else happy. That’s true at the level of basic human needs, of course, but not at the level of what floats your boat at work. Or rather, not in the way that Joel talks about it. Your satisfaction at work probably has a lot more to do with the length of your commute, whether you have clear goals and a sense of control, and if you have friends in your workplace than about whether you get to work with cool technology or make things faster and better just for the hell of it. Respect, sure, that’s important to have. But plenty of software product companies respect sales and marketing over development, and plenty of non-software-product corporations respect their developers.
Joel’s not really wrong here, of course. He just over-generalizes. He thinks his own experience must be everyone’s experience. He is sure that what he wants must be what everyone else wants.
Actually, it’s probably not that at all. He just really, really wants to pick up the cream of the Yale CS crop. He needs good developers, and gosh darn it, he’s gonna make his pitch to get them.
Ari invents recursion
“Mom, let’s play the wishbone game!”
“Okay, here we go. Pull! … Oh, look, you won!”
“You know what I wished for, mom?”
“No, what?”
“I wished for the bigger piece of the wishbone!”
O, Happy Solstice, and Business
Kieran Healy of Crooked Timber, talking about the giant Celtic clock at Newgrange, and the Winter Solstice:
A society—a civilization, if you like—is a hard thing to hold together. If you live in an agrarian society, as the overwhelming majority of people did until about two hundred years ago, and you are on the western edge of Europe, few times are harder than the dead of Winter. The days are at their shortest, the sun is far away, and the Malthusian edge, in Brad DeLong’s phrase, is right in front of you. It’s no wonder so many religious festivals take place around the solstice. Here were a people, more than five millennia ago, able not only to pull through the Winter successfully, but able also to build a huge timepiece to remind themselves that they were going to make it. It’s astonishing.
I am in a post-Christmas-party fog this morning, so I can’t do my usual “really, this is totally related to software development even though it seems to be a cute story about my kid or something else off-topic” thing. Crooked Timber is a group academic blog having nothing to do with software (though some of the academics on it do research on web stuff; here’s a recent note about some research being done on social networking sites, for example.)
Actually, I’ll at least try to relate this to work/software/consulting/business: Sometimes you hear people lament the December slump in productivity, and blame it on the ‘holiday season’. As though if there were no pesky holidays to get in the way, then we’d all be going full-bore on our goals. The other day I read a post about how I could be using this holiday lull in billable hours to get a bunch of really useful stuff done. “Oh man,” I thought, “We totally need to do that stuff.” All the extra stuff on our site, for example, (the non-blog stuff) has not been updated for months, because we’ve been too busy working to change it to reflect more accurately the work that we’re actually doing these days. (And we are rapidly approaching the time when we can no longer claim to be in ‘really-real beta rather than google-style fake beta’, as it says in the sidebar.) And we need a better invoicing process. And so on. But the truth is that, like most everyone else, I’m not that productive right now, even though I don’t have the excuse that I have too many holiday commitments, or that I’m traveling.
People who think that it’s the holidays that cause a December drop in productivity have it totally backwards. It’s the December drop in productivity that causes the holidays.
We don’t live in the stone age anymore. We do not spend the long dark winter starving and freezing, huddled together in our huts. But we are still part of that rhythm. Our artificial lights and central heating and snowplows and de-icers do not entirely erase the feeling we have that now is the time to huddle together around a fire, not go to meetings and launch new projects.
Which is to say that the site will not come out of beta until 2008. Happy Holidays, everyone!
REST vs. SOA: thoughts from a member of the unwashed masses
I have no recollection of how I ended up here:
On the REST front, if you’re claiming that it’s harder than the alternatives, to me that’s just a sign that you don’t understand it. Is REST simple? No, but neither is SOA. However, unlike SOA, which is fairly wishy-washy, noncommittal, and loose, REST’s constraints provide real, actual guidance for developers, and those same constraints also provide opportunities for significant flexibility, extensibility, performance, scalability, and serendipity. SOA’s contracts come with no rules or constraints, and thus can easily result in a system that’s extremely brittle, tightly-coupled, and virtually impossible to upgrade. SOA itself isn’t inherently bad, as it’s certainly a step above the “every application for itself” mode of development that’s so widely practiced. Unlike REST, though, SOA doesn’t go nearly far enough to provide real, useful guidance to the poor developer who has to actually write the stuff, make it work, and keep it running.
The author was responding to this guy:
This is the reason I am against dynamic languages and all of the fan-boy parts of IT. IT is no-longer a hackers paradise populated only by people with a background in Computer Science, it is a discipline for the masses and as such the IT technologies and standards that we adopt should recognise that stopping the majority doing something stupid is the goal, because the smart guys can always cope.
And that guy was responding, in turn, to this guy, who said that REST was like dynamic languages because both are loosey-goosey and flexible and don’t enforce contracts and type-checking.
The SOAP/WSDL/WS-* SOA view of the world is like a statically typed programming language, i.e. C++ or Java — everything is pre-defined, contracts govern everything, nobody can interact without following formal rules … and ideally, everything violating the rules (and policies) will get caught before even going into production.
So the chain is: 1) REST is very flexible compared to SOA, and that presents the danger that things that don’t work will be put into production. 2) REST is too complicated to be implemented by ordinary dumb programmers, and should be avoided. 3) REST is easier than than SOA because it provides very strict constraints.
So is REST easier or harder than SOA? Is it looser or stricter?
I just implemented my first REST API. I don’t see how anyone could say that it is ‘harder than the alternatives’, or that it doesn’t constrain developers very much. So I agree with the first quote, above. REST seems like a great idea to me. Anything that allows me to mostly avoid the complications of this many standards is good.
And also, obviously, I’m a big fan of dynamic languages now. I think I’d rather look at someone else’s crappy Ruby code than someone else’s crappy Java code, because at least there’s less of it. But I am, arguably, a Ruby fangirl right now, and given that I don’t have a CS degree, I guess I also count as one of the unwashed masses. And as a member of the masses, I can attest that no programming language in the world will stop us from doing something stupid. So we may as well enjoy ourselves while we’re doing it!
Amy’s guide to choosing and using rails plugins (With Bonus Checklist!)
Last week a student asked for advice about rails plugins: where to find them, how to evaluate them, and how to use them. I promised a blog entry on the subject, since it’s been on my topic list for three months and I’m behind on blog entries anyway. so here it is.
Where to find plugins
www.agilewebdevelopment.com is one of the main rails plugin directories. It has a stars and comment system for the listings, but given the number of rails developers out there in the world, there is surprisingly little community activity, so you have to take both the stars and the comments with a grain of salt. (And many of the comments are of the “I installed your plugin and it does not work. How do I fix it?” variety.) Nevertheless, it is the largest plugin directory I know of. And here’s the ruby-on-rails core plugin repository.
After that: google is your friend.
When should you look for a plugin?
Lots of people use acts_as_authenticated or restful_authentication as their starting points for user authentication, so it’s a good idea to become familiar with them yourself, even if you plan to roll your own auth code, because people frequently talk about general auth issues in the context of those plugins.
If you have to implement something that every single web 2.0 site out there has, it’s worth looking for a plugin. DHH wrote the quintessential web2.0 plugin, acts_as_taggable, although there’s also the popular acts_as_taggable_on_steroids. Rick Olsen aka technoweenie, who is a busy plugin bee, provides attachment_fu, which is an easy way to provide gravatars and other image upload/processing capability to your app. will_paginate is the current pagination code flavor of the week (You know not to use rails’ built-in pagination, right? It’s getting yanked out in rails2 anyway). There are a bunch of tutorials on adding star ratings to your app with one of the rateable plugins and some CSS.
Some plugins are more general-use and are meant to make your life as a rails developer easier and more fun. Sexy migrations, for example, DRY up migrations, and were such a popular plugin that they’ve been integrated into rails 2. Annotate-models is a plugin Dave Thomas wrote that adds some comments to your model objects telling you what precisely their database tables look like, so you don’t have to dig around in schema.rb. There are some plugins to improve active record finds, which are generally useful. There are helper plugins, builder plugins, markup plugins, and just plain silly plugins (acts_as_enterprisey).
When you first start using rails, you can go a little plugin-crazy. OMG, I never have to write any code again! you think, and get lost in an orgy of plugin downloads and installations.
Don’t get too excited yet.
I just had a discussion with Robert Oliver of OCS Solutions, rails fellow-traveler and current collaborator on a client project, about the value of plugins. He doesn’t use ‘em much. (“And I don’t use capistrano, either!” he says. “I am a rails heretic! Burn me at the stake!”* ) Anyway, so Robert says plugins are rarely exactly what you need, and it’s too much trouble to put them in and then rip them out when you discover they’re not precisely what you wanted. I say that if they save you time when you start out, and later you have to modify them to suit your purposes, it’s still saved you time, as you probably would have had to modify whatever you wrote yourself too. He says, yeah, but it’s easier to mod your own code than it is to mod other peoples’ code.
Robert has been developing in rails longer than I have, and the more I think about it, the more I think he’s probably right, and that I am only now coming out of the newb over-reliance on plugins phase. Some of the advantages of publicly available plugins fade as you get more familiar yourself with how to make things happen in rails. Rather like scaffolding, which seems awesome at the beginning, and then you realize that the generated code is not that useful. (Note that the advantages of the plugin format for your own code re-use remain after the first flush of newb plugin-love fades.)
For a rails newb, though, plugins do serve some important purposes. Their very lack of documentation and YMMV nature forces you to read the code. sometimes repeatedly. Not all plugin code is worth a damn, of course, but, especially for some of the plugins put out by rails-core members or other luminaries, a lot of it is good stuff. Complex good stuff, full of ruby idioms, metaprogramming, and other stuff the newbie rails developer thinks of as magic. After a while, when you’ve looked at similar magic sixty different times, it starts to become slightly less magic. Oh yes, you think, when you see something like ActiveRecord::Base.send(:extend, Technoweenie::AttachmentFu::ActMethods), there they are mixing themselves into your models for you. And, of course, generous use of plugins is an excellent way to convince non-technical clients that you are a total rails ninja. Hey, look ma, I implemented full-text search in 20 minutes!
Bonus Checklist for choosing and using rails plugins
- Who wrote it? Are they a big name in the community?
- Or: do big names use it and talk about it?
- What kind of documentation, both original and blogged/forum’ed can you find about it?
- What do people say about it?
- What’s the code look like?
- Is it really worthwhile for you to use it, or should you just review it for a general approach to the problem you’re trying to solve and then write your own code?
- Does it have tests? Do the tests run?
- Do you really need what the plugin gives you, or are you just putting it into your app because you can? (does every single thing on the web really need to be friendable? )
- Any glaring security issues? SQL injection, passwords in the clear, unescaped html, etc.?
- Read the readme. It may be thin. But it should tell you at the very least the steps you need to take to get going with it, which might include generating some code, running a migration, adding a line or two to a model class, etc.
- You have to read the code. Did I mention that? Look at the code. Don’t use a plugin whose code you haven’t looked at! And also, read the code.
Further Resources
Geoffrey Grossenbach’s Nuby On Rails offers an excellent two-part tutorial on plugins: Part 1, and Part 2.
There’s a whole short cut (or whatever it’s called — you know, one of those mini-e-books) about Rails Plugins. It looks pretty good, but i’ve only skimmed it on Safari. If you plan to write your own, check it out.
On the Proliferation of Crappy Plugins
Dear readers: please think twice about releasing your own plugin into the wild just so you can check off the ‘wrote plugin’ item on Working With Rails. Please make a plugin you release generally useful, reasonably well-tested, secure (don’t leave your plugin finder methods vulnerable to sql injection, for example), and documented. If it’s similar to another plugin already out there, be sure to point out how yours is different in a way that helps people choose between them. Plugins are a fantastic way to re-use code on your own projects, but not all such code really wants to be free. Is this a heretical anti-Open-Source comment that I should not be making? I am not sure. Anyway, I am sure that someone will turn around and suggest that I quit littering the internets with my crappy blog posts.
robert says: “as for capistrano.. Do you really want anyone who has the source to be able to deploy your app? That’s dangerous! Use custom scripts.. They’re easier to write than capistrano tasks and you must have access to the servers to run them!”
