Sun 16 November, 2008

- 安装前提条件:
- ruby version 1.8.6
- gem version 1.3.1
- rails version 2.1.2
- git version 1.6.0.1
- 说明
- 在Mac OS X上使用上面所说的方法一切正常
- 在Debian Sarge 3.1 Server上使用上面所说的方法,在使用命令“rake vasco:explore”时,就会出现问题。
- 在使用Mongrel服务器可以正常访问
- 在使用Thin服务器可以访问vasco时,会出现下面错误:
No route matches ”/vasco” with {:method=>:get}
- 参考资料
- Introducing Vasco: A Route Explorer for Rails http://tinyurl.com/59pacg
- Minor bug fix to Vasco http://tinyurl.com/5dk37r
- Vasco now supports nested routes http://tinyurl.com/6n8v6y
add to del.icio.us. look up in del.icio.us.
add to furl
I've talked to lots of PHP and Java programmers who love the idea and concept of Rails, but are afraid of stepping in because of Ruby. The argument goes that since they already know PHP or Java, that it would be less work to just pick one of the Rails knockoffs in those languages. I really don't think so.
Ruby is actually an amazingly simple language to pickup the basics on. Yes, there's a lot of depth in the meta programming corners, but you really don't need to go there to get stuff done. Certainly not to get going. The base mechanics of getting productive takes much shorter than you likely think.
After all, Ruby is neither LISP nor Smalltalk. It's not a completely new and alien world if you're coming from PHP or Java. Lots of concepts and constructs are the same. The code even looks similar in many cases, just stated more succinctly.
Learn Ruby in the time it would take to learn a framework
I'd argue that most programmers could get up and running in Ruby in about the same time it would take them to learn another framework in their current language anyway. I know it sounds a lot more scary to learn a whole new language rather than just another framework, but it really isn't.
The number one piece of feedback I get from people who dreaded the jump but did it anyway is: Why didn't I do this sooner?
Learn while doing something real that matters to you
Also, speaking from my own experience learning Ruby, I'd actually recommend trying to do something real. Don't just start with the basics of the language in a vacuum. Pick something you actually want done and just start doing it one step of the time. You'll learn as you go along and you'll have to motivation to keep it up because stuff is coming alive.
So don't write off Rails because you don't know Ruby. Your fears of starting from scratch again will quickly make way for the joy of the new language and you'll get to use the real Rails as a reward. Come on in, the water is fine!
See the Rails Myths index for more myths about Rails.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
“ The dog was created especially for children. He is the god of frolic. ”
Henry Ward Beecher
add to del.icio.us. look up in del.icio.us.
add to furl
Rails is often accused of being a big monolithic framework. The charges usually contend that its intense mass makes it hard for people to understand the inner workings, thus making it hard to patch the framework, and that it results in slow running applications. Oy, let's start at the beginning.
Measuring lines of code is used to gauge the rough complexity of software. It's an easy but also incredibly crude way of measuring that rarely yields anything meaningful unless you apply intense rigor to the specifics. Most measurements of LOCs apply hardly any rigor and reduces what could otherwise be a somewhat useful indicator to an inverse dick measurement match.
Applying rigor to measuring LOCs in Rails
The measurements of LOC in Rails have not failed to live up to the low standards traditionally set for these pull-down-your-pants experiments. Let's look at a few common mistakes people commit when trying to measure the LOCs in Rails:
- They count all lines including comments and whitespace in Ruby files, thus punishing well-documented and formatted code
- They count tests, thus punishing well-tested code
- They count bundled dependencies, thus punishing dependency-free code
Now let's take a simple example of committing all these mistakes against a part of Rails and see how misleading the results turn out to be. I'm going to use Action Mailer as an example here:
- 12,406 lines including comments, whitespace, tests, and dependencies
- 7,912 lines including tests and dependencies
- 6,409 lines including dependencies (t-mail and text-format)
- 667 lines with none of the above
So the difference between committing all the mistakes and reality is a factor of 20. Even just the difference between committing the dependency mistake and reality is a factor of 10! In reality, if you were to work on Action Mailer for a patch, you would only have to comprehend a framework of 667 lines. A much less challenging task than digging into 12,406 lines.
Rails measured with all it's six major components without the mistakes is 34,097 lines divided across Action Mailer at 667, Active Resource at 878, Active Support at 6,684, Active Record at 9,295, Action Pack at 11,117 (the single piece most web frameworks should be comparing themselves to unless they also ship as a full stack), and Rail Ties at 5,447.
Looking at the monolithic charge
That Rails is big in terms of lines of code is just one of the charges, though. More vague and insidious is the charge that Rails is monolithic. That is one giant mass where all the pieces depend on each other and are intertwined in hard-to-understand ways. That it lacks coherence and cohesion.
First, Rails can include almost as much or as little of the six major pieces as you prefer. If you're making an application that doesn't need Action Mailer, Active Resource, or Active Record, you can swiftly cut them out of your runtime by uncommenting the following statement in config/environment.rb:
# config.frameworks -= [ :active_record, :active_resource, :action_mailer ]
Now you've reduced your reliance on Rails to the 23,248 lines in Action Pack, Active Support, and Rail Ties. But let's dig deeper and look at the inner workings of Action Pack and how much of that fits the monolithic charge.
Taking out the optional parts
The Action Controller part of Action Pack consists of 8,282 lines which breaks down into two major halves. The essential, stuff that's needed to run the bare minimum of controllers, and the optional that adds specific features, which you could do without.
First the essentials of which there are 3,797 lines spread across these files and directories: base.rb, cgi_ext, cgi_ext.rb, cgi_process.rb, cookies.rb, dispatcher.rb, headers.rb, layout.rb, mime_type.rb, mime_types.rb, request.rb, response.rb, routing, routing.rb, session, session_management.rb, status_codes.rb, url_rewriter.rb.
The more interesting part is the optional parts of which there are 3,481 lines spread across these files and directories: assertions, assertions.rb, benchmarking.rb, caching, caching.rb, components.rb, filters.rb, flash.rb, helpers.rb, http_authentication.rb, integration.rb, mime_responds.rb, performance_test.rb, polymorphic_routes.rb, rack_process.rb, record_identifier.rb, request_forgery_protection.rb, request_profiler.rb, rescue.rb, resources.rb, streaming.rb, test_case.rb, test_process.rb, translation.rb, verification.rb.
All these optional parts can actually very easily be turned off as well, if you so please. If you look at actionpack/lib/action_controller.rb, you'll see something like the following:
ActionController::Base.class_eval do
include ActionController::Flash
include ActionController::Benchmarking
include ActionController::Caching
...
This is where all the optional bits are being mixed into Action Pack. But they didn't need to be. If you really wanted to, you could just edit this 1 file and remove the optional bits you didn't need and you'd have some 3,500 lines of optional goodies to pick from.
For example, let's say you didn't need caching in your application. You comment the include ActionController::Caching line out and delete the associated files and that's 349 lines for the savings there. Or let's say that you don't like the flash, that's another 96 lines.
The reason many of these pieces can be optional is because of a wonderful part of Active Support called alias_method_chain. With alias_method_chain, you can latch on to a method to embellish it with more stuff. For example, the Benchmarking module uses alias_method_chain like this to hook into perform_action and render:
module Benchmarking
def self.included(base)
base.extend(ClassMethods)
base.class_eval do
alias_method_chain :perform_action, :benchmark
alias_method_chain :render, :benchmark
end
end
ActionController::Base declares render and perform_action, but doesn't know anything about benchmarking (why should it?). The Benchmarking modules adds in these concerns when it's included similar to how aspects work. So as you can see, alias_method_chain is a great enabler for clearly defined modules in Rails.
All the other frameworks in Rails works in a similar fashion. There's a handful of essential parts and then a handful of optional parts, which can use alias_method_chain if they need to decorate some of the essential pieces. This means that the code is very well defined and you can look at just a single piece in isolation.
But why on earth would you bother?
The analysis above of how you can bring Action Controller down to some 3,500 lines carefully side-stepped one important question: Why would you bother? And that's an answer I don't quite have for you.
The important part about being modular is that the pieces are understandable in isolation. That the individual modules have coherence and cohesion. Not that they're actually handed to you as a puzzle for you to figure out how to put together.
I'd much rather give someone a complete picture, which they can then turn into a puzzle if they're so inclined. As I've shown you above, it's actually really simple to deconstruct the frameworks in Rails and you can make them much smaller really easily if you decide that's a good use of your time and energy.
See the Rails Myths index for more myths about Rails.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlSat 15 November, 2008


- 相关资料
- Merb, Rails Myths, Language Popularity and other Zenbits http://tinyurl.com/6pjfrn
- http://www.zedshaw.com/blog/2008-11-13.html
- MythBusting — Rails is not a monolith http://tinyurl.com/6adalf
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
The important news in edge Rails this week is the imminent release of Rails 2.2.1 – otherwise known as Rails 2.2 RC2. Getting ready for this release did lead to some significant changes in the Rails codebase.
First, it’s very likely that you’ll need to upgrade rubygems to run RC2: the required version of rubygems is now 1.3.1, which was just released yesterday. This dependency is part of the continued work to make vendored gems useful and stable. You may find that updating rubygems is less than smooth, depending on your current version; check out this article if you have any trouble. commit
The Rails routing engine has seen some serious work over the past week as well. For starters, Jeremy Kemper committed several fixes to the core routing engine that cut down on object creation and RegExp creation, trimming memory use. commit commit There are also new :only and :except options for map.resources, which can help cut down memory use if you have a lot of resource routes – see these articles for details (though there have been some tweaks in the way nested limited routes work after those were written). commit commit commit
The new ActiveRecord connection pooling code has seen some tuning as well, making it more efficient in development model and avoiding some issues with the Oracle adapter. commit
Polymorphic URLs now behave more intuitively if one of their parameters is nil. For example, a call to polymorphic_path([@project, @filter, @issue]) with a nil filter now returns project_issue_url instead of a NoMethodError. commit
The request forgery protection feature in Rails has been tightened up so that it only applies to HTML-formatted content requests. There is substantial discussion on the Lighthouse ticket that led to this change, but the bottom line is that the old implementation had some bugs, notably making destroy actions inaccessible via XML. Other types of requests are protected by other means – for instance, the same origin policy on AJAX requests substitutes for request forgery protection there. commit
add to del.icio.us. look up in del.icio.us.
add to furl
Rails 2.2 has been baking for long enough now. This is the last taste before the goodies are served. So please install and check it out. See if you can find any regressions or bugs in any of the new stuff, so we can have it all delicious by the time we ring the dinner bell (ok, ok, I’ll put down the food metaphor now).
This release also conciedes with the fact that we’ve branches 2-2-stable, which means that master is now actually targeting Rails 2.3/3.0. There’s also a tag available for this RC as v2.2.1.
If you missed RC1, have a look at the Rails 2.2 release notes to see the major additions. You can see what’s new since RC1 in these two This Week in Edge Rails.
To install, you must first have RubyGems 1.3.1:gem update --system.
Then you can:gem install rails -s http://gems.rubyonrails.org
Enjoy!
add to del.icio.us. look up in del.icio.us.
add to furl
There are lots of great JavaScript libraries out there. Prototype is one of the best and it ships along Rails as the default choice for adding Ajax to your application.
Does that mean you have to use Prototype if you prefer something else? Absolutely not! Does it mean that it's hard to use something else than Prototype? No way!
It's incredibly easy to use another JavaScript library with Rails. Let's say that you wanted to use jQuery. All you would have to do is add the jQuery libraries to public/javascripts and include something like this to the
in your layout to include the core and ui parts:<%= javascript_include_tag "jquery", "jquery-ui" %>
Then say you have a form like the following that you want to Ajax:
<% form_for(Comment.new) do |form| %>
<%= form.text_area :body %>
<%= form.submit %>
<% end %>
By virtue of the conventions, this form will have an id of new_comment, which you can decorate with an event in, say, application.js with jQuery like this:
$(document).ready(function() {
$("#new_comment").submit(function() {
$.post($(this).attr('action') + '.js',
$(this).serializeArray(), null, 'script');
return false;
});
});
This will make the form submit to /comments.js via Ajax, which you can then catch in the PostsController with a simple format alongside the HTML response:
def create
@comment = Post.create(params[:comment])
respond_to do |format|
format.html { redirect_to(@comment) }
format.js
end
end
The empty format.js simply tells the controller that there's a template ready to be rendered when a JavaScript request is incoming. This template would live in comments/create.js.erb and could look something like:
$('#comments').append(
'<%= escape_javascript(render(:partial => @comment)) %>');
$('#new_comment textarea').val("");
$('#<%= dom_id(@comment) %>').effect("highlight");
This will append the newly created @comment model to a dom element with the id of comments by rendering the comments/comment partial. Then it clears the form and finally highlights the new comment as identified by dom id "comment_X".
That's pretty much it. You're now using Rails to create an Ajax application with jQuery and you even get to tell all the cool kids that your application is unobtrusive. That'll impress them for sure :).
Rails loves all Ajax, not just the Prototype kind
This is all to say that the base infrastructure of Rails is just as happy to return JavaScript made from any other package than Prototype. It's all just a mime type anyway.
Now if you don't want to put on the unobtrusive bandana and instead would like a little more help to define your JavaScript inline, like with remote_form_for and friends, you can have a look at something like jRails, which mimics the Prototype helpers for jQuery. There's apparently a similar project underway for MooTools too.
So by all means use the JavaScript library that suits your style, but please stop crying that Rails happens to include a default choice. That's what Rails is. A collection of default choices. You accept the ones where you don't care about the answer or simply just agree, you swap out the ones where you differ.
See the Rails Myths index for more myths about Rails.
add to del.icio.us. look up in del.icio.us.
add to furlFri 14 November, 2008

add to del.icio.us. look up in del.icio.us.
add to furlThu 13 November, 2008

Zed Shaw's infamous meltdown showed an angry man lashing out at anything and everything. It made a lot of people sad. It made me especially sad because this didn't feel like the same Zed that I had dinner with in Chicago or that I had talked to so many times before. I actually thought he might be in real trouble and in need of real help, but was assured by third party that he wasn't (Zed never replied to my emails after publishing).
But Zed's state of mind isn't really what this is about. This is about the one factual assault he made against Rails that despite being drenched in unbelievable bile somehow still stuck to parts of the public conscious.
The origin of the claim
Zed insinuated that it's normal for Rails to restart 400 times/day because Basecamp at one point did this with a memory watcher that would bounce its Mongrels FCGIs when they hit 160MB 250MB. These FCGIs would then gracefully exit after the current request and boot up again. No crash, no lost data, no 500s.
But still an inconvenience, naturally. Nobody likes a memory leak. So I was happy when a patch emerged that fixed it and we could stop doing that. I believe the fix appeared some time in 2006. So even when Zed published his implosion at the end of 2007, this was already ancient history.
Yet lots of people didn't read it like that. I've received more than a handful of reports from people out talking Rails with customers who pull out the Zed rant and say that their consultants can't use Rails because it reboots 400 times/day. Eh, what?
Fact: Rails doesn't explode every 4 minutes
So let's make it clear once and for all: Rails doesn't spontaneously combust and restart itself. If we ever have an outright crash bug that can take down an entire Rails process, it's code red priority to get a fix out there.
A Rails application may of course still leak memory because of something done in user space that leaks. Just like an application on any other platform may leak memory.
Update: Zed points out that the leak was occurring while Basecamp was still on FCGI, not Mongrel, which is correct. I don't know how that makes the story any different (it was the fastthread fix that stopped the leak and our minor apps were on Mongrel with leaks too), but let's definitely fix the facts.
See the Rails Myths index for more myths about Rails.
add to del.icio.us. look up in del.icio.us.
add to furl
Ruby on Rails has been around for more than five years. It's only natural that the public perception of what Rails is today is going to include bits and pieces from it's own long history of how things used to be.
Many things are not how they used to be. And plenty of things are, but got spun in a way to seem like they're not by people who had either an axe to grind, a competing offering to push, or no interest in finding out.
So I thought it would be about time to set the record straight on a number of unfounded fears, uncertainties, and doubts. I'll be going through these myths one at the time and showing you exactly why they're just not true.
This is not really to convince you that you should be using Rails. Only you can make that choice. But to give you the facts so you can make your own informed decision. One that isn't founded in the many myths floating around.
- Myth #1: Rails is hard to deploy
- Myth #2: Rails is expected to crash 400 times/day
- Myth #3: Rails forces you to use Prototype
- Myth #4: Rails is a monolith
- Myth #5: Rails is hard because of Ruby
add to del.icio.us. look up in del.icio.us.
add to furl
(If you don't want to bother with the history lesson, just skip straight to the answer)
Rails has traveled many different roads to deployment over the past five years. I launched Basecamp on mod_ruby back when I just had 1 application and didn't care that I then couldn't run more without them stepping over each other.
Heck, in the early days, you could even run Rails as CGI, if you didn't have a whole lot of load. We used to do that for development mode as the entire stack would reload between each request.
We then moved on to FCGI. That's actually still a viable platform. We ran for years on FCGI. But the platform really hadn't seen active development for a very long time and while things worked, they did seem a bit creaky, and there was too much gotcha-voodoo that you had to get down to run it well.
Then came the Mongrel
Then came Mongrel and the realization that we didn't need Yet Another Protocol to let application servers and web servers talk together. We could just use HTTP! So packs of Mongrels were thrown behind all sorts of proxies and load balancers.
Today, Mongrel (and it's ilk of similar Ruby-based web servers such as Thin and Ebb) still the predominate deployment environment. And for many good reasons: It's stable, it's versatile, it's fast.
The paradox of many Good Enough choices
But it's also a jungle of options. Which web server do you run in front? Do you go with Apache, nginx, or even lighttpd? Do you rely on the built-in proxies of the web server or do you go with something like HAProxy or Pound? How many mongrels do you run behind it? Do you run them under process supervision with monit or god?
There are a lot of perfectly valid, solid answers from those questions. At 37signals, we've been running Apache 2.2 with HAProxy against monit-watched Mongrels for a few years. When you've decided on which pieces to use, it's actually not a big deal to set it up.
But the availability of all these pieces that all seem to have their valid arguments lead to a paradox of choice. When you're done creating your Rails application, I can absolutely understand why you don't also want to become an expert on the pros and cons of web servers, proxies, load balancers, and process watchers.
And I think that's where this myth has its primary roots. The abundance of many Good Enough choices. The lack of a singular answer to How To Deploy Rails. No ifs, no buts, no "it depends".
The one-piece solution with Phusion Passenger
That's why I was so incredibly happy to see the Phusion team come out of nowhere earlier this year with Passenger (aka mod_rails). A single free, open source module for Apache that brought mod_php-like ease of deployment to Rails.
Once you've completed the incredibly simple installation, you get an Apache that acts as both web server, load balancer, application server and process watcher. You simply drop in your application and touch tmp/restart.txt when you want to bounce it and bam, you're up and running.
But somehow the message of Passenger has been a little slow to sink in. There's already a ton of big sites running off it. Including Shopify, MTV, Geni, Yammer, and we'll be moving over first Ta-da List shortly, then hopefully the rest of the 37signals suite quickly thereafter.
So while there are still reasons to run your own custom multi-tier setup of manually configured pieces, just like there are people shying away from mod_php for their particulars, I think we've finally settled on a default answer. Something that doesn't require you to really think about the first deployment of your Rails application. Something that just works out of the box. Even if that box is a shared host!
In conclusion, Rails is no longer hard to deploy. Phusion Passenger has made it ridiculously easy.
See the Rails Myths index for more myths about Rails.
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furl
add to del.icio.us. look up in del.icio.us.
add to furlWed 12 November, 2008


- 设置方法
- 在桌面的程序栏中,打开“系统偏好设置”
- 在打开了的窗口中,点击“语音”
- 选择如上图的设置,“按下按钮时朗读所选文本”
- 点击按钮“设置键”,输入一个任意组合键,如“Option+A”
- 使用方法
- 在浏览器中,选择需要朗读的英文内容
- 使用组合键“Option+A”,就会朗读该英文内容
- 说明
- 可惜朗读中文内容功能好像没有。
- 参考资料
使用苹果电脑朗读英文文章 http://tinyurl.com/5a4keu
使用苹果电脑共享上网 http://tinyurl.com/6s3xdy
add to del.icio.us. look up in del.icio.us.
add to furl
I have, of course, been doing much work with JRuby. Most of this has been desktop development with Monkeybars but occasionally I need to do some Web work.
I’m a big fan of Ramaze, mainly because it approaches that sweet spot of strong features with minimum magic. A recent Web app needed to use some Java libraries, and since Ramaze runs fine under JRuby I set out building the site.
I really wanted to deploy to Glassfish as well. Warbler is a terrific gem from Nick Sieger that will bundle up your Rack-based app, including any specified gems, and create a WAR file that can be deployed to a Java app server.
Last time (about a month or so ago) I tried this with a Ramaze app, I was not too successful. Since my application did not have much of a UI to it I opted to write a sparse Rack app instead.
However, my needs changed and I found myself starting to add assorted framework-y features, such as routing and templating, to the site. Rather than reinvent these particular wheels I thought to give Ramaze another shot. Having had to do some amount of trial-and-error experimentation to get even my simple Rack app running smoothly I figure perhaps my earlier frustration with Ramaze was because of my Warbler ignorance.
My renewed attempt didn’t start off so well, but I saw that my JRuby install of Ramaze was bit out of date, so I updated the gem. It looked as though something has been changed in the how Ramaze is dispatching requests because my ealrier errors vanished after the gem update.
A little tweaking of config.ru and config/warble.rb, and presto, it worked.
You can create a bare-bones Ramaze app by running the generator:
$ ramaze --create myapp
This gives you (among other things) start.ru and start.rb.
I renamed start.ru to config.ru and, in config.ru, replaced the require 'start' with most of the contents of start.rb. Here’s what it looks like:
require 'rubygems'
require 'ramaze'
require './controller/init'
require './model/init'
Ramaze.trait[:essentials].delete Ramaze::Adapter
Ramaze.start!
run Ramaze::Adapter::Base
When you start out to warbleize your app, you run (assuming you have already create a config/ directory):
$ warble config
and you get config/warbler.rb. That file is, by default, full of stuff your Ramaze app doesn’t need. Here’s my warble.rb:
Warbler::Config.new do |config|
config.dirs = %w( controller model public view)
config.gems = %w( ramaze )
end
I then ran
$ jruby -S warble
and copied the resulting WAR file to the glassfish autodeploy dir.
And it Just Worked.
I expect no problems adding in my own libraries and the use of a database with an ORM. My first warbled Rack app was doing all that (Sequel with MySQL), and given that Ramaze is loaded and running and handling requests then adding that in should be a non-issue.
Now we can use Ruby’s most elegant Web framework with the fastest Ruby implementation and a robust, full-featured Web application management tool.
add to del.icio.us. look up in del.icio.us.
add to furlTue 11 November, 2008


- 问题说明
- 创建一个项目
- 再创建新自己的跟踪标签,注意顺序。
- 问题出现了,在项目创建项目新的问题时,自己所创建的跟踪标签并没有出现。
- 解决办法
- 这个问题的原因是软件代码把跟踪标签依赖于项目。
- 代码改写如下面代码所示。第二行代码是源代码,而第三行代码是新增加的代码。
- 所有@project.trackers及其类似的代码都改写Tracker.all。
add to del.icio.us. look up in del.icio.us.
add to furl
中国人最大的愿望就是鲁迅所说的“但求做稳奴才”
做惯了几千年的奴才,突然要他自己作主人,短时间内会很不适应,会不知所措的。
因为作主人就要拿主意,主动承担责任,进而要讲诚信。
当奴才就很“轻松”,无须拿主意,接受领导安排就好;不用承担责任,天塌下来,有领导顶着;更不必讲诚信,只要领导不亏待自己就好。
奴才毕竟是奴才,主见自然没有,更不用谈创新了。
稍微煽风点火,就会被人愚弄、操纵。要作主人,先要提高主人翁的素质和思想觉悟。
不知道要说什么,无语


add to del.icio.us. look up in del.icio.us.
add to furl
MountainWest RubyConf 2009 will be held March 13-14, 2009, in Salt Lake City, Utah, USA.
Proposals to speak at this regional conference are now being accepted. Please send your proposal to proposals@mtnwestrubyconf.org.
The submission deadline is midnight (MST) on December 31st, 2008.
The current plan is that presentations will be a mix of 30 and 45 minutes in length, including any Q+A period. So if you’re planning a talk keep that in mind.
There are sponsorship opportunities available as well. Please contact sponsorship@mtnwestruby.org if you are interested.
Please see mtnwestrubyconf.org for more details as they become available.
add to del.icio.us. look up in del.icio.us.
add to furlMon 10 November, 2008

Implementation Patterns
按照惯例,空闲的状态下,负责招聘的同事就会找上门来。在这个校园招聘如火如荼进行的时段,他们更是要充分利用“beach”上的每一个人。去年,我荣膺了公司的“Code Review Machine”,所以,当之无愧就成了他们找人的首选。这不,今天一口气做了14个Code Review。
我们的招聘环节中,有一个环节,就是让应聘开发角色的人去写代码,然后,我们会根据内部的标准对代码进行评审,这就是Code Review的由来。有兴趣的人,不妨搜搜,我知道,我们公司最近用的这几道题在网上都是可以找到的。其实,仔细一读便不难发现,这几道题并不是那种难到让人摸不到头脑的题。按照我当初应聘时,冰云给我的说法,两个小时就可以完全搞定。
或许你会疑问,如果试题不难,那如何区分应聘者的编码能力呢?事实上,仅仅完成功能是不够的。我们更多的是在看代码中展现出来的内容。
当然,我无意在这里讨论公司Code Review的标准。
之所以会想起写这个话题,完全是今天的代码看多了,好吧,找一些精采的部份分享在这里:
* 一个类的名字叫做A(我不记得我们的题里面有这样的概念……)
* 一个C#/Java程序只有一个文件(我们的题没有简单到只有一个概念吧?)
* 所有的方法都是static的(确定用的是OO语言?)
* 长长的方法(虽然鼠标有滚轮,看着也麻烦)
* 太多的switch..case(很勤劳,写那么多一样的switch都不嫌烦)
* 嵌套许多层(看来是用有自动格式化的工具了,要不然,打tab或是空格,自己就会觉得麻烦)
……
我曾经和同事开玩笑,我应该写一篇《ThoughtWorks应聘代码过关指南》,争取让自己在今后的Code Review过程中稍为舒服一些。
其实,ThoughtWorks所遵循的评审标准完全是业界公认的一些标准。所以,真正的《过关指南》已经有了,比如Martin Fowler用《重构》告诉我们什么是不好的代码,比如这篇blog开头列着的那两本书告诉你怎么写好代码。
如果这算泄密的话,那么就让我去评审更多的好代码,累累自己。
add to del.icio.us. look up in del.icio.us.
add to furl
IBM have just wrapped up a new DB2 adapter that fixes a bunch of bugs, adds support for a range of features, and works with the rails -d setup to create a new Rails application straight for DB2. Check it out: A major milestone for DB2 on Rails.
add to del.icio.us. look up in del.icio.us.
add to furl


