Posted by Eric Stewart
Tue, 29 Aug 2006 03:51:00 GMT
Earlier this year I ventured back from a very enjoyable year building and deploying a project in Ruby on Rails into the familiar territory of Java. Ruby has become cemented as a valuable tool that will certainly remain near the top of my tool box, ready for use.
Right now, however, I’m working on problems that are outside the realm of where Ruby shines (though I’m certain it’ll catch up soon enough). In particular, I recently had the need to research some ideas on creating a solution for a problem that lends itself to distributed computation.
Read more...
Posted in Software Development, Ruby, Java, Technology | Tags computing, distributed, java, ruby | no comments
Posted by Eric Stewart
Sun, 09 Apr 2006 23:08:00 GMT
Can Ruby be useful in the enterprise? Sure! Of course, that depends on what you’re considering it for, how you define Enterprise, and what day it is (the Ruby community is very active on many fronts, and support that was once lacking is rapidly growing in many areas).
I mostly stayed away from the whole James McGovern fracas recently, but since this was one of the blogs he sent a trackback to, I’ll add one little comment that I haven’t seen too many others express. Ruby was never too bothered about its lack of widespread public adoption in the enterprise. It is doing just fine being quite useful in all kinds of environments, meeting needs and providing an increasing number of developers another powerful way to please their customers and themselves. That being said, there are definitely inroads being made.
Consider the public positions of companies that make their living in the enterprise. For example, look at the position posted by MomentumSI. Jeff Schneider has linked to some analysis done by them recently on the applicability of Ruby in the enterprise. I know and have worked with many Momentum consultants over the years and they are very bright people who have a lot of experience in that arena. Of course, ThoughtWorks thinks pretty highly of Ruby too.
Ruby (and Rails) aren’t really striving to become the great enterprise platform. They are trying (and succeeding) to be great tools to help people get things done, be productive, and enjoy their work. I don’t think the community in general cares too much if they aren’t making great strides in the enterprise (even though I think we’ll see much higher adoption there). They are having too much fun using it to do things they are doing now. And as for wondering how Ruby will continue to grow, only time will tell.
Posted in Software Development, Ruby, Ruby On Rails | Tags enterprise, rails, ruby | 1 comment
Posted by Eric Stewart
Sun, 12 Mar 2006 08:03:00 GMT
I never realized the amaroK developers had any affinity toward Ruby.
As a part time user of Linux, usually Kubuntu these days, I occasionally use amaroK for playing music to work by. As Linux music player + library applications go, it’s one of the nicest you can find with some features that you don’t find in many other players.
amaroK, like an increasing amount of modern software, supports scripting to allow users to extend the software’s capabilities. They do this by taking advantage of amaroK’s DCOP interface.
This makes it possible to write scripts in almost any programming language, like Ruby, Python or bash scripting. The recommended programming language is Ruby, which is easy to learn and very well suited for amaroK scripting. The amaroK team will be happy to assist you if you have questions regarding Ruby programming.
Not surprisingly, they even recommend Ruby as a nice way to script the application, though they support other languages.
As development goes on, in fact, they are converting compiled portions of code to scripts that can be customized or replaced. This solution came to light after requests by users to support additional sources of song lyrics and deal with the brittle way they interfaced with such sites.
Sooooo, what to do? Scripts to the rescue! What I did is, ripped the hardcoded Lyrc code out. Ported the C++ code to Ruby. Then added a couple of DCOP calls and script notifications for the communication Script <—> amaroK. Added a slice of XML, and you get your spicy new Scriptable Lyrics Feature, mmh.
There was a bit of reaction in the post referenced above to the dependency on Ruby for the newly converted portion of default functionality. If KDE had a default scripting language (similar to the OS X/Applescript relationship) I’d understand those complaints a little more. But then again, OS X installs Python and Ruby by default along with Applescript and nobody really complains.
Is a dependency on a language runtime very different from a dependency on a given library?
Update: As Cornelius Schumacher points out, other KDE projects beginning to do similar things.
<!- technorati tags start ->
Technorati Tags: kde, linux, scripting, ruby
<!
- technorati tags end ->
Posted in Software Development, Ruby, Technology | Tags extensibility, kde, linux, ruby, scripting | 2 comments
Posted by Eric Stewart
Sat, 04 Mar 2006 20:22:00 GMT
Richard White has released the latest version of his Ajax Scaffold Generator for Rails. Since I have been heads down on a mostly non-Ajax application until recently I had missed this.
If you appreciate the value of scaffolding in helping you get going in a Rails project and you want to use ajax in your application, this is a very handy way start. It also is a nice way of just generating some code you can play with if you are new to Ajax and want to quickly be able to experiment. And it doesn’t look bad. What is generated looks nice, seems to work well, and might not be too far from production ready depending on your application.
I did perform an accidental experiment. I had previously generated scaffolding for a model/controller in my test project and and re-generated scaffolding using this new ajax generator. All worked well, but I ended up with tests that were testing the original non-ajax scaffold methods. The action methods are just about the same, but they now are designed to only be called via ajax calls. My original functional tests for the controller broke. Enter redirect_or_render.
With Courtenay’s helpful method, it’s pretty easy to get this tests passing again and have these controller actions now support ajax or non-ajax calls. For example, consider the ajax generator created scaffold method create on my sample controller for objects called Tasks:
def create
@task = Task.new(params[:task])
if @task.save
@headers['task-id'] = @task.id
@headers['Content-Type'] = 'text/html; charset=utf-8'
render :partial => 'task', :layout => false, :locals => { :hidden => true }
else
render :partial => 'form_errors', :layout => false, :status => 500
end
end
This method expects to be called via xhr request and only needs to return a snippet of code. If we apply redirect_or_render the action becomes something like:
def create
@task = Task.new(params[:task])
if @task.save
@headers['task-id'] = @task.id
@headers['Content-Type'] = 'text/html; charset=utf-8'
redirect_or_render(
{ :action => 'list' },
{ :partial => 'task', :layout => false, :locals => { :hidden => true } }
)
else
redirect_or_render(
{ :action => 'new' },
{ :partial => 'form_errors', :layout => false, :status => 500 }
)
end
end
Now the create action can be called directly as well via a normal request and still function as expected. Note that there is still a bit of work to be done in this case, since we’d really like to have the action render the new action template again so we can show validation errors on the Task. So for these cases, maybe a render_or_xhr_render method would be useful.
<!- technorati tags start ->
Technorati Tags: accessibility, ajax, rails, ruby
<!
- technorati tags end ->
Posted in Software Development, Ruby, Ruby On Rails | Tags ajax, generator, plugin, rails, scaffold | 1 comment
Posted by Eric Stewart
Wed, 01 Mar 2006 00:57:00 GMT
Dave Thomas (of Pragmatic Programmers fame) has created the annotate_models plugin.
This one solves a pain I have been feeling for quite a while now. Say you are in Textmate, RadRails, vi, or whatever your tool of choice is working on one of your ActiveRecord model classes and you just can’t remember all the field attributes from your schema. This plugin gives you a command line tool to help keep that information close to where you are going to use it most.
Thanks Dave!!!
<!- technorati tags start ->
Technorati Tags: rails, ruby
<!
- technorati tags end ->
Posted in Software Development, Ruby, Ruby On Rails | Tags rails, ruby, tools | no comments