Fun with the simple_form Rails Gem

It’s been a long time since I sat down to write a blog about a programming related topic. I’m really hoping that changes this year, but I’ll do my best not to make promises I can’t be sure I’ll keep. I definitely hope to share more of the things I’m learning about and playing with. With that in mind, I was playing with the simple_form gem earlier today and I thought I would share the experiment that I was working on.

Often when working on a project I’ll have a few basic forms that I need for data entry within the system. Nothing too complex, just a few simple fields. For those of you who haven’t checked out simple_form yet, I highly recommend it. After getting the gem installed I created the form I needed:

<%= simple_form_for @member do |f| %>
  <%= f.input :firstname %>
  <%= f.input :lastname %>
  <%= f.input :email %>
  <%= f.input :bio %>
  <%= f.button :submit %>
<% end %>

Knowing that I would need a few more simple forms I wanted to figure out a way to be able to reuse this code snippet. Although I might not do this same approach in a large project with more complex forms I proceeded to pull out the column symbols within the snippet and came up with this:

<%= simple_form_for @member do |f| %>
  <% @member.class.column_names.each do |field| %>
    <%= f.input field.to_sym unless %w{id created_at updated_at}.include?(field) %>
  <% end %>
  <%= f.submit %>
<% end %>

This takes the @member instance variable and get its class, which in this case is Member. It looks at the column names of Member and loops through them. If the field isn’t “id”, “created_at”, or “updated_at” it creates an input field for it. This was a step closer to what I was going for. I imagine there are many opinions about this approach especially when it comes to thoughts on performance. The focus here was about experimentation. So I keep going and made some additional adjustments, caming up with this:

<%= simple_form_for form do |f| %>
  <% form.class.column_names.each do |field| %>
    <%= f.input field.to_sym unless %w{id created_at updated_at}.include?(field) %>
  <% end %>
  <%= f.submit %>
<% end %>

This allowed me to call the code as a partial like:

<%= render :partial => 'shared/form', :object => @member %>

It’s not perfect, I can’t customize the fields in any way, but it let’s me get some basic forms quickly together for testing concepts with a customer.

Anyway, that’s my recent experiment, feel free to share your thoughts and feedback.


Magic-Ruby 2011 Conference Talks

I was lucky enough to be able to spend the last few days with some amazing Ruby developers. I enjoyed meeting so many new people and getting the chance to learn about some seriously awesome projects that they are working on. In an effort to consolidate some of the slides and information shared by the speakers I’ve created this post. If you have any updates please leave them in the comments and I’ll continue to complete the list.

Friday

  • Cultivating Cucumber: Slides
    Les Hill, Hashrocket
  • Geospacing Your Ruby: Slides and Video of similar talk from July 9, 2010
    Peter Jackson, Intridea
  • Loving your customers, loving your peers
    Alan Johnson, Carsonified
  • Code Isn’t Enough
    Gregg Pollack / Caike Souza
  • Exceptional Ruby: Slides, Code, and Review | Video
    Avdi Grimm
  • What Happened to Desktop Development in Ruby
    Andy Maleh, Obtiva
  • Keynote
    Dave Thomas, Pragmatic Programmers

Saturday

  • Meditation + Code: Slides
    Mike Gehard, Pivotal Labs
  • Crank Up Your Apps with TorqueBox: Slides | Video
    Jim Crossley, Red Hat
  • How I Learned to Stop Worrying and Love the Cloud: Slides
    Wesley Beary, Engine Yard
  • Developing Cocoa Applications with MacRuby: Slides
    Brendan Lim, Intridea
  • Documentation is freaking awesome: Slides and Links
    Kyle Neath, Github
  • Lightning Talks: Videos
  • Keynote – McDonalds, Six Sigma, and Offshore Outsourcing: Notes
    Chad Fowler, InfoEther

A special thanks to all the speakers and Jeremy McAnally for putting it all together. Anyone wishing to stay in touch can find me on Twitter @timknight.


Why The Nook Isn’t a Kindle-Killer

First, I have to say that I’m a very happy Kindle owner who tends to read about 6 books a month. That might make my opinion bias when it comes to the Kindle itself, but as reader – I still exist as a consumer of information and books.

The Kindle’s innovation came first with it’s connectivity and delivery platform. It simplified the searching, downloading, and let’s not forget purchasing ease of getting books on the go. Never again did you have to make a trip to the airport bookstore while traveling. Its black and white interface using strict E Ink itself wasn’t innovative, it didn’t reinvent the way people read books. However, Amazon has taken a route taken by Nike and Apple, the long-term iterative improving experience. While the Kindle itself still has it’s limitations (to which many might point to its position on data openness), the constant changes that Amazon does allows the Kindle to adapt, keeping it competitive.

Many Kindle readers already know they can purchase and read books on their iPhone, but there is something that was announced a little more quietly. Amazon now has http://kindle.amazon.com – which at first sight is a bit mediocre. Its initial explanation for its existence too, is a bit… weird. Praising how many customers love their notes and highlights, I can’t imagine that reading the information out of context provides some level of insight in the thought process someone had while making the annotation within the book. This could instead be a preview for online and community shared book notes and annotations. Imagine sharing your books with friends and being able to read the notes each other thought were the most important about a book? Now that’s what will convert traditional readers.

What the Nook has done is something that is a necessary step in the evolution of ebook readers – like CDs, it will change the way things are done from this point forward – though it hasn’t envisioned anything extraordinary. The built in Wi-Fi connection means nothing to the everyday user. Why would they care to configure an additional connection when the always-on 3G network can take care of things without any additional configuration. Adding the idea that people are going to come to Barnes and Noble with their Nook because of the “Free Wi-Fi” is just asinine. The point of having a digital book reader is to reduce trips to a bookstore. Sure there is a touch screen – but it’s for navigation, and yes you can lend to friends for 14 days. When I loan a book my friends typically take it for more then that… but to each his own.

For an ebook reader to truly be a Kindle-Killer they are going to need to change the way people read and communicate about books. Book readers have a connection to the tangible feeling behind books, the feel, the smell of the paper. There is more there then just pages. You are going to have to combat history by changing the conditions of what reading means. Bring people together in either book sharing, long distance book clubs that can allow users to read everyone else’s comments and annotations, or simplifying book publishing. Amazon themselves, while they have ways to publish quickly on the device really drops the ball when it comes to supporting would-be authors with real information about publishing to the device.

Maybe Apple has something that will really shake things up?

Time will tell. Anyone considering making the switch from either a Sony Reader or Kindle to the Nook? I’d love to hear your thoughts.


Consensus is the Foundation of Mediocrity

I consider myself somewhat of a “Lifetime Learner” always trying to learn new things and listen to perspectives of other people, even when I have my own opinions. The biggest reason I started studying business as a developer was because I saw the gap growing between business understanding and technical implementation and wanted to do something about it.

Recently I attended a seminar on “Managing Project Teams” where various areas of the project process were discussed in how you can help make the team work effectively together. Something really stood out for me. During the training the discussion moved to negative team dynamics.

The slide went up showing examples of “Negative Team Dynamics” which showed in bullet point examples. Most of the items seemed to make sense as they included things like, “Team Members Refuse to Work Together”. But then there was one that really caught my attention:

Team members disagree about an important topic.

Think about that for a minute… “Team members disagree about an important topic.

For me this couldn’t be more wrong and is a fundamental reason behind teams that just don’t work well together. If teams can’t engage in healthy conflict and disagree on points they will never grow past their preexisting beliefs. All too often the practice of team building encourages the process of finding consensus within the group. In my opinion, consensus is a lie. When you put a bunch of intelligent bright people into a group the last thing that you’ll ever get them to do is agree on an important topic. If they do, the topic either isn’t really that important or your team has been conditioned to “let the matter go” in favor of a sense of consensus.

Of course the team should decide before the discussion how the solution will be decided upon, and it’s important for the team to stick with the selected solution knowing that they have put all of their opinions on the table. Patrick Lencioni talks a great deal about this type of healthy conflict in “The Five Dysfunctions of a Team“.

It frustrates me when I hear the idea of teams and team members that don’t want to stand up for something, that aren’t passionate about a specific solution. Just as I said in Start Standing for Something – be passionate, have an opinion and let that passion pull you into creating something great.


Start Standing for Something

Around my office I can often be heard saying something that has for me, become a bit of a mantra.

If you want clients to absolutely love you, you have to stand for something. There will be those people that don’t like what you stand for, but the people that follow you – they will absolutely love you.

And I really do honestly believe that. If you don’t stand for something, how do you matter?

The example I always use with my conversation is of course Apple and Microsoft. This is not a conversation about which one is better. It’s simply understanding their approach to their market. Think about it… Microsoft has mass adoption. The majority of computer users use Windows and they further target new clients through mass marketing and mass partnerships with hardware vendors like Dell, HP, and the like. Now consider Apple. They have exclusive use of their software on their own hardware. They focus on early adopters and gadget lovers. They aren’t concerned about mass adoption but rather instead target a certain subculture for their success. They believe that beauty is part of functionality and have clients willing to pay a premium that agree with them.

Rarely have I come across, even in my past history as a Microsoft Certified Systems Engineer, users that absolutely loved their Windows machine. Never have I heard a user talk about how impressed they are with how the start button works or how easy to use Microsoft Word was. But look at the Apple folks… the people even call themselves “fans”. They love everything the company is about. Of course there are many people that dislike Apple and find their products silly, but they rarely matter… because the people that love Apple, absolute love them.

Another thing that fans will do is forgive. If they absolutely love your product they will tend to forgive small mistakes or inconsistencies that might come up. They would rather be involved with helping make something better so they often are the types that will email, or tweet you unsolicitedly with ideas of making the experience better, or even reporting a bug they found. The important thing is they want to be involved. They want to feel like they too are making a little bit of a difference by helping you improve your product so it’s important to listen.

Where Geeks and Business Folks Collide

A complaint I’ve always heard from business people tends to be that their technology group is so opinionated about everything. They have a passion for either a specific language, a technology, or whatever. I say, “learn from this!” The business side should take this as an example of passion, and purpose, and start standing for something from the top. Too many companies just sit there, they do the same things that all the other companies in their industry do. If one company pushes out widgets, the other company tries to make a better widget and then push those out. We are greatly amidst an Experience Economy, where purpose and well-functioning, collaborative teams will be the greatest competitive advantage any organization could ask for. The company that can grasp the power of purpose will breed an environment of passionate people ready to stand up and make a difference.

Ready? Because your competitors are hoping you fail at it. They want you to be as mediocre as they know to be, with a templated mission statement and services that hint at average. Seriously, the world has enough “average”, so start standing for something and evolve – or die.


Is The iPhone The New Idea Napkin?

Lo-Fi Wireframe Creating with Brushes on iPhone

Lo-Fi Wireframe Created with Brushes

Last week I was at dinner with a colleague and I was trying to communicate an idea I had. Like many people I’m a visual thinker, so I always look for a pen, and most of the time I have a little notebook in my pocket. I had nothing with me at the time, there were a few napkins on the table but grabbing the only pen used at the register for people to sign their receipts didn’t seem like something I was comfortable doing.

I remembered hearing about an App on the iPhone/iTouch called Brushes [App Store Link], they designed the newest New Yorker cover with it, so I heard anyway. I pulled out my phone and looked it up on the App Store, it was $3.99. I’m already one of those people that area accustomed to the 99¢ apps, but I bought it anyway. I immediately started sketching my idea. I’ve now used it at least once a day to communicate an idea to someone. People already ask me what the app is. It’s small enough on the iPhone that you can put it in the middle of table and collaborate with a small group on ideas. Brushes has quickly changed the way I talk about ideas with my colleagues and prospects. After talking with someone about an idea of their’s I send the image to them over email so they could have a copy of it themselves. That is something I was never really able to do with my napkin sketches.


The End of Bullhorn Salesmanship

A few days ago, I was at the car dealership having some routine service done on my car. I was sitting in the waiting area quietly reading. Five other people joined me in the room, some reading, some chatting, you get the idea – they were all generally self-entertained and seemed comfortable.

A pudgy gentleman comes into the waiting area to partake on the coffee machine. Coffee in hand, turns to everyone and asks, “Any decisions been made on the television?” A closer look at the gentleman revealed a name tag for the car dealership. Most people didn’t really understand what he meant about the television. “Would you like the television on?” Again, most people there were quietly reading, only two were talking amongst themselves, and all of us just looked at him and shrugged, not really offering a solid decision either way. “Any arguments to not turn it on?” Some gentle mumbles of, “not really” were revealed from the group. So he walks over and turns on the news. With a new look of accomplishment he looks back to all of us and inquires, “So who here is interested in looking at some new cars while you wait?” Most people didn’t really take it seriously. One person did explain, “my car is pretty old, but it has low mileage.” She talked briefly to him about her car, but said she wasn’t really interested. “We have some great deals”, he offered. To which she gently nodded and declined.

As he turns back to refill his coffee another woman announced, “what a salesman!”, in a similar tone as if she was using it as a synonym for “gentleman”.

I looked at him and teased, “perhaps offering to refill her coffee and at least introducing yourself could have helped?” (as I noticed the woman he was speaking with had an almost empty cup of coffee next to her). “Time is money”, he said. To which I argued back, “looking at things that way will likely assist you in losing more then just that sale.” He nodded, and walked off.

He seemed to be completely disconnected from the people he was trying to sell on something. Starting with the television, if he was paying attention he would have seen that most of us were wrapped up in other things. Saying, “anyone NOT want me to turn on the television” seems almost humorous. Rarely would anyone speak up at that, in my opinion anyway… I mean who am I to tell someone that they can’t watch television? But no one was saying they wanted it on, he turned it on anyway. Then he immediately jumped on us about wanting to buy something. I didn’t even know this guy’s name yet. He didn’t earn my trust yet so what makes him think I would want to talk with him about buying something? It is no wonder why car salesman get such a bum rap.

These people weren’t cattle, and he wasn’t offering anything we needed. We all had cars. A coffee refill, and introduction with a kind smile, and a business card had a better chance at closing that sale, it would have just taken a little time.

Building a Relationship

I guess I’m a little old-school when it comes to these things. I believe business relationships are built on trust, and trust is built through reputation and word of mouth. I might not know this guy now, but I bet if he made it a habit of introducing himself to the waiting area and passing out some cards it would have been a step closer. Additionally learning peoples names that come in often for oil changes and whatnot tells me that he enjoys talking to me (even if he might not) and isn’t just trying to sell me something (even if he really is). If I just learned from the Service Manager that I was going to have to pay for a new transmission, the last thing on my mind in the waiting area might have been how much money a new car would have cost me (or hey, maybe it would have been the first).

About 6 years ago I was doing some freelance web development work. I had about 15 clients that I worked with somewhat often. I was the type that took impeccable notes about each client and kept the information in my address book about them. Everything down to the names of their children, spouse’s name, sports their kinds played, conflicts they were having… anything and everything. When I saw them I would ask about them, or just send them a quick note via email, “I hope the issue with (blank) worked out, you seemed pretty stressed.” I built a relationship with my clients. When I saw something in an article online that I thought would interest them, I would send it over. If it was in the paper – I would fax it. Not everyday, nor every week. But when I saw something that I knew would be genuinely helpful, I would send it. The trust grew. When I was then starting to work in other areas of development, they were interested in hearing what I had to say and how it might help them. I would tell them straight up if I thought something would help or not. They trusted me to help them make the right decision because they knew I valued their success in business just as much as they did, and it was true, because I honestly did.

I still do this today with business contacts using Highrise. All of my notes about my contacts go in there. Anytime I’m about to email or meet with them about something I look at my notes to see what they were up to the last time we chatted. A solid connection is made, and people typically prefer to do business with people they like and trust, rather then someone just trying to get something out of them or sell them something. The experience a client or prospect has with you is a big deal, in every interaction they have with your company, so don’t let it be the last thing you think about.


Follow

Get every new post delivered to your Inbox.