Fork me on GitHub

Posts Tagged ‘jquery’

Because everybody has an opinion…

Friday, April 15th, 2011

In case you’ve been living in a cave this week you’ve probably heard that Ruby on Rails is going to be including both the CoffeeScript and SASS libraries, it will also make jQuery the default JavaScript framework, replacing the Prototype framework.

I would like to start by addressing my experiences with CoffeeScript. My opinion of it is of ambivalence. I’ve used it on a project, I’ve played with and in the end I’ve come out with the opinion of “it’s ok”. It didn’t blow me away, but at the same time I can see why so many people like. It offers some really cool features that I really wish JavaScript had and you can cut down on the amount of code you have to write. On the other hand the apps I tend to write don’t tend to be that JavaScript heavy that I really needed to reach out for something like CoffeeScript.

So, how do I feel about CoffeeScript being included with Rails? Well, I’ll get to that. Let’s go over some of the most common arguments I’ve heard from people this week about why they’re anti-CoffeeScript in Rails.

“It’s an abstraction layer of JavaScript! JavaScript isn’t that bad, why can’t you just write JavaScript?”

“It’s going to be a hinderance to newbies. It’ll be too much of a learning curve!”

Let’s start with that second point first, shall we? I agree, it does represent a new element that needs to be learned when coming to Rails. But here’s the pretty nifty thing about how it’s all implemented in Rails. In order to actually use CoffeeScript in Rails you have to create your files named foo.js.coffee if, however, you just name your file foo.js then, guess what? You will have to write plain old JavaScript! Seems like newbies, and those who don’t like CoffeeScript, can just keep writing plain old JavaScript without anything stopping them at all.

Now, let’s talk about the abstraction layer argument. Yes, CoffeeScript is an abstraction on top of JavaScript, but let’s take a look at a few other parts of the Rails stack and see how they hold up against this argument.

Here’s a fairly common Rails stack:

  • ActiveRecord
  • Haml
  • jQuery
  • RSpec

What do all those things have in common? Well, they’re all abstraction layers that sit on top of something else, don’t they? Let’s look at that list again?

  • ActiveRecord – SQL (Structured Query Language)
  • Haml – HTML
  • jQuery – JavaScript, you could just as easily hand roll those AJAX calls in pure JavaScript.
  • RSpec – Test/Unit

What I’ve found funny about the particular argument is that I’ve heard it MOST from those who use things like HAML, which is a DEFINITELY an abstraction layer that sits on top of HTML. See where I’m going with this one? Good, I don’t want to belabor the point. :)

So, finally, where do I stand on this whole thing? Well, I view like it Test/Unit and Prototype. Those are both the current standard (although jQuery will replace Prototype in 3.1) and I don’t like or use either of them. Instead I configure Rails to use jQuery and RSpec. I don’t like Haml, but those that do simply replace ERB with Haml and they move on with their day. So my take is this, it’s there, it’s included. Use it if you like, or don’t. Is it really that big a deal? No, it really isn’t. If Rails dropped ERB and went with Haml as the default, would I bitch and moan, probably a bit, but then I’d just install the Rails-ERB gem and move on with my day, just like I do with jQuery and RSpec today.

So sit back, relax, use the libraries that you want to use, Rails let’s you do that. Oh, while you’re relaxing why not try out CoffeeScript, who knows, you might just enjoy it. Or not.

 

Release 0.8.3

Sunday, January 18th, 2009

Thanks to the cold and snowy New England winter this year, I’ve been able to devote quite a bit of time to getting Mack to run on Ruby 1.9, so with that said, here’s the 0.8.3 release of Mack, featuring… TADA… Ruby 1.9!! Of course there are a few other features and improvements in this release. Here’s a quick run down:

Ruby 1.9

The big one. Mack runs very well on Ruby 1.9, unfortunately I can’t say the same thing about some other frameworks. I’ve had some run ins with DataMapper on 1.9, but I’m sure those will be ironed out shortly.

A few weeks ago I announced I was working on getting Ruby 1.9 support for all my gems and libraries. I started out with Configatron, then upgraded Cachetastic and Genosaurus. Now Mack is 1.9 compatible. When I made the announcement the guys at RailsEnvy picked up on it and said that I made a call to arms to the community to pick up 1.9 support. Now granted, I didn’t actually say those words, but I think the intent was there, so I’m going to now officially say those words. This is a ‘call to arms’ to the Ruby community to upgrade their gems, plugins, libraries, frameworks, etc… to work on Ruby 1.9. I’ve done it, and I can tell you, it’s not that tough. Just use multiruby, and you’re off and running.

ActiveSupport In, Facets Out

What with the world getting smaller these days, well, at least the world of Ruby web frameworks. A lot of great work is going into refactoring ActiveSupport and making it faster, better, and smaller. Because of that and the fact that every time a new release of Facets comes out it breaks a whole lot of stuff, I’ve decided to use ActiveSupport as the basis of the mack-facets gem. So basically mack-facets is just ActiveSupport with a few more enhancements.

JavaScript Effects

Thanks to the tireless efforts of Gerardo Pis-Lopez, mack-javascript, has been upgraded to add helpers methods for effects for both Prototype/Scriptaculous and jQuery. Thank you to Gerardo for the much needed upgraded to mack-javascript.

Upgrades

Mack has been upgraded to use Rack 0.9.1, DataMapper 0.9.9, and a few other smaller gems.

Changelog:

  • [#243] Upgraded to Rack 0.9.1
  • [#242] Upgraded to DataMapper 0.9.9
  • [#241] Removed dependency on Facets
  • [#239] Add do_sqlite3 to gems.rb
  • [#166] Effects for mack-javascript
  • [#133] Added Form Builders
  • [#22] Ruby 1.9 Support
  • gem: rack 0.9.1
  • gem: rspec 1.1.12
  • gem: configatron 2.2.2
  • gem: cachetastic 2.1.2
  • gem: data_mapper 0.9.9
  • gem: addressable 2.0.1
  • gem: extlib 0.9.9

Why so quiet?

Monday, June 23rd, 2008

I’m sure everyone is wondering why things have been so quiet around the Mack front recently. Well, there are a couple of reasons. One, I’m on vacation in Ireland right now, so my coding time has dropped dramatically. Second, I’m still very much so patiently awaiting the 0.9.2 release of DataMapper, which the next version of Mack needs. Third, there is a lot of Mack work afoot at the moment.

The company I work has seen fit to give me a few more resources to help me make Mack the most kick ass framework out there. I’ve not got 1.5 more bodies diligently working away on Mack, with another body to hopefully be hired in the next full weeks. That will mean, within a few weeks there will be 3.5 full time bodies working on Mack! Awesome!

There are some great things that are going to be in the next build, but mostly it’ll be a nice refactoring. We’re going to splitting a bunch of stuff out of the core of Mack and putting into a mack-more package, similar to the approach Merb and DataMapper have adopted. In mack-more there will be l10n internationalization, RJS support (Prototype AND jQuery), DataMapper 0.9.x support, HAML, Markaby, PDF::Writer support, amongst others. It’ll be nice. Trust me. :)

We hope to have the next release out within the first or second week of July, of course, this really depends on when the DataMapper release can get out there. Once we get this release out, we can really focus on some extremely kick ass new features. Stay tuned!