Using Hotwire with Ruby on Rails

I’ve been pretty quiet recently - that’s because I’ve been having way too much fun playing with Hotwire.

Hotwire’s a Javascript library that adds really easy “single-page-application” and web-socket support to your web application - without having to learn a whole new front-end framework.

It intercepts links and form submissions, so instead of doing a full page refresh, it looks at the response coming back from the server, chooses which parts of the page to replace and just swaps them out inline. Not only does this mean the browser doesn’t need to redraw the whole page, it also means all your Javascript and other assets don’t need to be reloaded - making things really fast.

In addition, you can specify areas of the page to be loaded on demand - so your initial page load can be really fast and the other stuff deferred till when it’s needed (for example, I’ve done a menu that only loads when you click the drop-down icon - and then it can check your permissions in real time to make sure you only have access to the correct options).

Finally it includes a layer over web-sockets so as stuff changes on the server, you can broadcast those changes to your client - as HTML fragments. It uses the same swapping technique as before to update your page without a full refresh - so you get live updates in two lines of code.

The advantage of not using a front-end framework for this kind of stuff (apart from being able to stick with the technology you’re already familiar with) is that you don’t need to replicate your logic. You’ve already written your models and business rules on the server - so why duplicate those rules and structures on the client as well?

If you want to see it in action, I’ve done a quick video and, I’m so impressed, I’m going to be doing more in-depth stuff on it as the next few weeks progress.

Watch now

What if you only had one year?

How would you spend your time?

If you knew you had one year left, how would you spend your time?

A while back I realised my answer would be “play guitar” - even though I’ve not played for 20-odd years. Every time I try nowadays I get frustrated as my fingers don’t move the way my brain expects them to. 

But I figure I should try again. So I’m going to do at least five minutes per day until my fingers move by themselves, like they used to (my style was kind of unique, where my left hand just sort of did things and my right hand was generally useless). 

This stuff is important. The answer to that question can tell you a lot about what you really want in life - and for me, I don’t want to spend my time sat in front of a computer, writing code. So much so that I returned the new Mac I just bought and am now scouring eBay for Les Paul guitars (cherry sunburst or tiger-stripe, solid pickups, preferably gold).

What about you? How will you spend your final year? And does anyone want to join a band?

How do you specialise?

It's the done thing, apparently

You've seen all the "experts" tell you that "the riches are in the niches" (if you pronounce it that way).

But the idea of positioning yourself like that is terrifying.

Turning away clients? Saying no?

It's hard enough getting clients as it is.

However, without even realising it, you're already doing it.

Every time you write a custom proposal, you're doing the same task.

You're positioning yourself as the expert.

In a niche of one.

Your proposal is a sales document, telling your prospective client that you know what they want, you understand why they want it and you have a plan to deliver it for them.

Because the proposal is a one-off, it doesn't feel like you're excluding others.

But because the proposal is a one-off, it also takes you a load of time to write.

All niching does is save you time by generalising your proposal writing.

Instead of a new sales document, custom-written for every client, you're saying "I've already got one for this group of clients".

Write once, use many.

If you want to attract several groups of clients, you just research them, find out what they're looking for and write a proposal for each group in turn.

You don't have to exclude anyone you don't want to.

You're just saving yourself time.

Perfectly positioned.

Charge more

if you want a happier life

If I could only give you one piece of advice, it would be this.

Charge more.

Some clients will complain.

It will feel uncomfortable.

It might make your "hourly rate" seem astronomical.

But charging hourly is harmful for both you and your client.

Bad for your client as they does not know how much they are going to pay. And once the project has started you have them at your mercy.

Bad for you because you have no incentives to get better at your craft, learn new tools and techniques. It's better for you to work slowly.

Ultimately, it comes down to this.

Clients don't care about your hourly rate.

They only care about the results you deliver. And when you deliver them. And how much grief they have to put up with in order to get them.

Who do you think the client would prefer?

The person who charges $1000/hour and works for 10 hours to deliver a $1,000,000 result?

Or the person who charges $10/hour and works for 1000 hours to deliver that same result?

Do you think the client would even believe that someone who charges so little could deliver a $1,000,000 result? Or that someone who charges so little won't need a whole load of hand-holding, cajoling and management?

So charge more.

- Do your research.

- Know your clients, understand what they are looking for and what it's worth to them.

- Learn what stops them from buying and what makes them feel safe.

- Focus in a method of delivering what they are looking for as quickly as possible. No frills, no extras, just the results.

Look at your prices.

And charge more.

How can I keep my client from requesting one update after another?

Shoot them?

We've all been there.

We think we've done the work, but the client comes back with a change request. Fair enough. So you make the change and they come back with another. And another. And another.

Where do you draw the line?

How can you politely say enough is enough?

Ultimately, this is something you can only answer at the beginning of the project.

Firstly, you have to set expectations, set your boundaries. Make it clear how the project will be run, how change requests are dealt with. How your experience and expertise are going to guide the client to success.

Secondly, you need to understand the objectives of the project. The true objectives of the project - not the vanity objectives, but the business reasons.

Because, if the changes the client want are aligned with those objectives then it's vital to the project success that you deliver them. But if the request won't move you further to the objectives, or if you believe the client doesn't really know how to get to those objectives, then you can step in and say "as an expert in this field, this will not help you".

The key word being "expert".

Be the expert and show the client where the boundaries are drawn.

Loading more posts…