Newsletter May 2016
Last updated 10 July 2016Greetings, my Trailblazer friends!
Winter is coming down here in Australia and it’s getting a bit colder - the perfect excuse for us to work more on the Trailblazer project.
Here’s what happened during the past couple of weeks. We had some exciting new releases and discussed a bunch of interesting opportunities for the project and its community.
Our Gitter Channel
It is a great thing for OSS authors to see a community evolve around projects. Our Gitter channel is growing every day and seems to be a great place for support, even if it’s just “a little thing” you’re stuck with. Come join the community today - we love helping each other and often, there’s intense debates about software architecture, programming languages or wine tastings going on. Luckily, you can turn off notifications. ;)
Cells 4.1 Released
We’re super excited to announce the release of Cells 4.1. This version cleans up the core even more and paves the way for a super fast Cells 5.0 that we’re planning. It also got rid of any Rails dependencies, so Cells 4.1 won’t import or need anything of Rails and works perfectly fine in Sinatra or Hanami.
I’ve written a blog post about Cells 4.1 and all the features, but here’s a few canapés for you.
Layouts
My absolute favorite addition is that every cell can now have an external layout cell. While the actual content cell is responsible to represent the fragment, the layout cell will present the outer container. This is very similar to how Rails or other frameworks handle layouts around content.
Instead of configuring the content cell on the class level, you can inject the layout cell. This allows a more flexible way of handling layouts, and can easily be abstracted in the ApplicationController
.
cell(:comment, comment, layout: LayoutCell)
The LayoutCell
is a simplistic cell class and yield
s the content in its view.
!!!
%html
%head
%title= "Gemgem"
= stylesheet_link_tag 'application', media: 'all'
%body
= yield
What’s pretty awesome about this: It now, finally, allows to complete ditch ActionView and use Cells for everything. Great, isn’t it?
Hand in hand with the layout comes the context object in Cells 4.1. We now maintain a special object that is automatically being passed from cell to cell and allows to propagate “global” objects such as the current user or helper objects via a clean, explicit mechanism.
cell(:comment, comment, layout: LayoutCell, context: { user: current_user })
Both content and layout will have access to the user via context[:user]
now. This also works “downwards” when nesting cells into cells.
Trailblazer::Cell
As a logical conclusion, we’ve released the trailblazer-cells which helps you using the Trailblazer file structure and optimized semantics in your project. It really is a very thin “reconfiguration” of the Cells gem, only.
Cell classes now have a very constrained naming scheme which greatly improves productivity as you don’t have to think about cell names anymore.
module Comment::Cell
class Show < Trailblazer::Cell
end
end
Ideally, cell classes can be empty as the show
method is automatically added. In Trailblazer cells, views are resolved differently. In this class, the looked up view will be expected in app/concepts/comment/view/show.haml
. Note that the cell’s class name dictates the view name, and not the state.
The new behavior introduces very strong conventions and many Trailblazer users love it already. You should try it out if you’re using Cells.
Gemgem-Hanami
In my spare free time, I started working on an example application that shows how Hanami and Trailblazer work together. It is so much fun working on this project and the two fit together just great.
I use Trailblazer::Cell
for the views and let operations handle the business logic in Hanami::Action
s - fantastic stuff!
The project also plays with some advanced features such as Postgres’ JSONB
columns for complex data types to be used within the operation and contract. We will surely write about this once it’s a bit more, well, let’s say readable.
Also, a new gem trailblazer-hanami will soon be pushed. It won’t be more than a few dozens lines of code, but simplifies the workflow of using Trailblazer in Hanami.
Blog Posts
In the past months I’ve started writing some articles for Sitepoint. The first article introduces Cells, the second speaks about advanced features such as dependency injections or testing in Cells.
Especially the first post has been the most popular Ruby post for many days and generated a lot of comments around Cells - it’s worth a read!
New 20-Minutes Guide
After around two years of trailblazing I finally managed to write up a very brief guide what is Trailblazer and how does it work. Check out the Trailblazer In 20 Minutes article, it actually takes only 12 minutes.
We’re confident that this short guide will help many more people to get onboard and understand Trailblazer and its architecture within a few minutes, without having to read an entire book.
Trailblazer Pro
We are currently discussing how to “professionalize” Trailblazer and support. We’re thinking about offering a monthly Trailblazer Pro plan soon, which will give clients access to a private chat channel and ticket system for instant response support, and a new premium documentation area with cookbook recipes (for Trailblazer, not spaghetti bolognese), curated content and screencasts.
We are very interested in hearing your opinions about that and what you would like to see happening in Trailblazer, such as an LTS version, a trailblazer-enterprise
project with higher-level building blocks, and so on. Please let us know what you think.
Ruby Tapas
While we’re at it: since living off Open Source is extremely hard and involves a lot of work, I’d like to mention my friend Avdi Grimm, an absolute Ruby legend and inspiration for the community with his books, talks, blog posts and screencasts for years.
He is kindly asking to help him not go broke by subscribing to his incredibly cool Ruby Tapas screencast. If you’re interested in learning about programming from him, join the Tapas gourmet’s circle.
Rails-Criticism Everywhere
Waves of controversy were being generated by my friend Piotr Solnica’s blog post My Time With Rails Is Up. He explains why it is incredibly hard for alternative Ruby library authors like us to work in the Rails environment and criticises workflows in and around Rails core. A justified standpoint and a really good post that every Ruby developer should read.
A fantastic follow-up post was then published by our best Fabio Akita. In his post Rails Has Won: The Elephant In The Room he seconds many of Piotr’s statements but also explains why we can’t get around Rails at the moment.
You can spend several hours going through all the comments on the posts, Reddit, Twitter, and so on.
I’ve tried to stay out the conversation wherever possible, though, since my opinion about the problems with Rails’ lack of innovation are well known. I think we’re doing a good job in providing an alternative architecture with Trailblazer, and thanks goes out to the two bloggers and friends for mentioning us in both articles!
Conferences
A bunch of hand-selected conference talks are coming up this (northern-hemisphere) summer! I will be talking about Trailblazer, the problems with Rails and why sticking to 10-years old APIs is the opposition of stability.
Come and join us if you can!
- RISE in Hong Kong, I’ll be speaking June 2, but have several “mentor hours” (whatever that is).
- WIDS in Hong Kong is on 7-8 June. There will be a talk about Trailblazer and Rails, and a Trailblazer workshop.
- I will then attend the Pivorak RUG meetup in Ukraine July 22. Most probably, there will be a free TRB workshop on Saturday. This is still a secret and I’m not supposed to talk about it.
- A full-day TRB workshop is happening at Deccan RubyConf in Pune, India on August 7.
- September 2-3, I’ll be at Rubyconf Colombia in Medellín. Very excited since I’ve never been to Colombia!
- After years, I’m finally speaking again at Euruko in Sofia, Bulgaria this year’s 23-24 September. The line-up looks massive already.
- 14 November it’s time for Rails Israel which is another country I haven’t visited so far and can’t wait to go.
It would be great to see you at one or more of those events!
Links
- A pretty cool talk by Matthew Jording about Trailblazer at the Ruby Roundtable.