At our recent RWDevCon tutorial conference, in addition to hands-on tutorials, we also had a number of “inspiration talks” – non-technical talks with the goal of giving you a new idea, some battle-won advice, and leaving you excited and energized.
We recorded these talks so that you can enjoy them, even if you didn’t get to attend the conference. Here’s our next talk – Craftsmanship, by Chris Wagner – I hope you enjoy!
Transcript
Craftsmanship. What do you think of when you hear that word?
Maybe what an artisan or an artist does, or maybe a skill in any craft? If that’s what you were thinking, then you were spot on with the definition according to some.
If you’re like me, you’re not very good at precise definitions. Maybe you’ve pictured an image in your mind instead. When I think of craftsmanship, I envision:
Clean lines
Attention to detail
Things created with passion
I want to tell a story about the first time that I recall noticing craftsmanship with regard to computers.
When I was a teenager, I started building computers and I would piece together different parts that I could afford or things my Dad had lying around the house, and it was fun. I was proud of what I was doing. It was rewarding.
I became pretty good at what I was doing, at least others assured me that I was, and it wasn’t long until people started asking me for help with their computer problems. One time my Dad came to me and he said that his friend needed help with his computer.
Mind you, most of what I had learned at that point was from my Dad, so in hindsight, there was no reason he needed me to help him. He could probably do it on his own. This was probably one of those fatherly lessons you don’t realize occurred until later in life.
Anyhow, his friend had just bought a top tier Alienware computer.
Now this was late 90s or early 2000s, so it was a big deal. These things were expensive.
What he needed help with was transferring the files from his old computer to the new one.
My Dad and I decided we’d pull out the old hard drive, put it in the new computer and do the transfer that way. Not many people had networks back then and they were pretty slow to be honest.
We cracked open that old computer. I can’t remember what it was, maybe a Packard Bell or a Compaq, and it was a mess.
Not just a dusty mess, but the wiring inside looked no better than something that I had built before myself, but that was normal, right?
We got the drive out and it was time to open up the Alienware tower. We weren’t prepared for what we were about to behold.
In Awe Of The Alien
We didn’t even need a screwdriver. It had thumb screws on the back. Pretty neat. No more stripped screws. The side panel just slid right off, revealed the components that you needed access to. Wow!
After carefully removing the side panel and revealing the internals, I’m pretty sure we both gasped.
It was gorgeous. At first glance, I don’t think we even saw a cable. Everything was cleanly routed and zip-tied in place.
It was very clear that somebody had made a deliberate decision that these computers would be built with craftsmanship.
It’s Hard To Find the Time
This brings me back to my part about this computer being expensive. Things of high craftsmanship intrinsically cost more to make.
To make great things, you must have great skill and a great amount of time.
Today, I’m here to inspire you to continue or to start practicing and exuding craftsmanship.
In almost every case, when we start a new project, we set out to do the right things or fully unit test or just not that again. We have green pastures, the sun is bright, and the world’s our oyster.
Then comes crunch time. It’s time to ship, the deadline’s approaching, your significant other has told you for the last time it’s time to leave, they’re pulling out the driveway, and you’re frantically typing that last line of code.
Whatever it may be, oftentimes we forget about what we set out to do. We get overwhelmed and we rush ourselves.
Then, we let the cows into our green pastures, they eat all the grass and shit everywhere.
But you’ll clean it up later, right? Right?
Yeah, I didn’t think so.
As programmers, it’s easy for us to let our code get sloppy because the end user will never see that source code anyway. As far as they know, the code is a bunch of incoherent symbols and squiggly lines.
I would argue that this is the driving factor for the level of apathy that I’ve witnessed when it comes to writing beautiful code.
Finding The Time Is Worth It!
There’s a biography that came out about four years ago called Steve Jobs and I’m sure most of you are familiar with Steve.
He had an unwavering stance on quality and craftsmanship, and in the biography he attributes that to his adoptive father. He says:
–Steve Jobs
The parts you couldn’t see. Sounds like our jobs, right? We’re constantly working on the parts that nobody’s going to see.
The people that built that Alienware computer were working on the parts that most people wouldn’t see.
Do you know what happens when you focus so much energy on the parts that no one sees?
That energy is amplified on the parts they will see.
Your pride for the resulting product is also amplified. You’ll be proud to show people what you’ve done and you’ll be confident in what you’ve done.
Have You Experienced Bad Code?
Some of you may be indie, you aren’t working on a team, or have an inherited project before, but for most I suspect that you have. You’ve walked into somebody else’s code before and you probably looked at it and asked yourself, “What the heck?”
Let’s enjoy this one for a little bit.
for (NSInteger i = 0; i < 3; i++) { switch(i){ case 0: label0.text = title0: break; case 1: label1.text = title1; break; case 2: label2.test = title2; break; } } |
It’s a for switch loop. Makes sense, right? :P
Sometimes you’ve inherited a project that won’t even run without some voodoo scripts you had to find yourself, or some tribal knowledge that you had to hunt around the office for.
How many times have you run across a class with a single method, it’s 200 lines long and it’s 200 columns wide, you know the ones that look they’re playing Flappy Bird if you turned it on its side?
The people that wrote those things are by no means dumb. We’ve all been there. You’re quickly prototyping something and you try new things until it works. I don’t’ see anything wrong with that.
Where things go wrong is when you don’t go back and clean up what you’ve created and encapsulate that logic into small, easy to consume pieces that you can test.
How Good Code Can Happen
I like this quote by Ken Auer that describes the three phrases that you should take when crafting software,
–Ken Auer
- Make it run is a stage where you’re trying things out. You’re just hacking away, you’re not quite sure what you’re doing. You’re just playing around and you’ve got things commented out, all jammed into one method.
- Make it right is where you take what you’ve learned, encapsulate that into small methods, classes, using architecture and make it easy to read for “future you” whether future you is actually you or your replacement.
- Make it fast is where you worry about performance. Now that all your routines are neatly packed away, you can profile them and use instruments like a true craftsman, and you can make isolated changes without breaking things.
Oftentimes we stop after make it run. I think it’s time to stop stopping.
Find Balance By Setting Clear Expectations
Now you may complain there’s no way that I can make it right and make it fast. My boss is nagging me, deadline’s approaching, or if I spend all of my time making it right and making it fast, that’s going to take up too much time.
Time is money, and I get it. I’ve been there. We all have.
Craftsmanship’s not just about creating great things. It’s about knowing your craft and its limits so that you can clearly understand what can and cannot be done.
Set expectations with:
- yourself
- your peers
- your boss
- your client or customer
That’s all part of the craft.
No one’s going to be happy when you ship something and it falls on its face. Be clear with everyone involved about what can and can’t actually be done, and if anything changes in the process, make everyone aware.
Craftsmanship Is Appreciated
Let’s take a moment to step outside of the computer programming world and talk about consumer retail space. Now over the past few years, I’ve noticed a trend.
Now this may vary depending on where you’re from, but what I’ve noticed here in the States is people are starting to appreciate handcrafted goods.
- Craft beer brewing has exploded. The mass beer producers are being hit hard as consumers prefer local brews.
- Alternate coffee brewing methods are becoming popular.
- Etsy.com, a website for handmade and vintage goods, reported over $1 billion in sales in 2013.
People are flocking to handcrafted merchandise and they’re staying away from the big box stores.
The prices for goods on Etsy are nowhere near as competitive as the big box stores. Coffee typically is 2 times as expensive, and maybe upwards of 10 times as expensive for those special beans.
The craft beers are typically 2 to 4 times as expensive as the mass-produced competitors.
People appreciate craftsmanship and people pay a premium for craftsmanship.
If John Lennon Wrote Code
Let’s think about this for a moment. What would a world of craftsmanship as far as programming goes look like?
Consider every library on GitHub that’s reached it’s self-proclaimed Version 1.0.
Imagine a world where all of those libraries are fully unit tested, a world where 90% of their methods are less than 15 lines of code. Every public API is well-documented, and there’s a clear readme with a getting started tutorial.
Imagine a world where the difficult questions on Stack Overflow are answered rather than the simple ones being cherry-picked by point seekers.
Imagine a world where you start at a company and you check out the source code, and you can build and run with a couple of commands.
Imagine a world where every developer on the team consciously respects and follows the style guide.
Imagine a world where craftsmanship programmers are the norm. They
- Are appreciated by their employers
- Are paid well
- Can survive the app store
This is a good world. I like this world and I think you would too.
The Trap Of Thinking Craftsmanship is Optional
Well-crafted things are often considered a luxury and I’ll agree with that. What I won’t agree with, though, is that shoddy software is acceptable.
Prototype’s fine, I won’t argue there. Proving a point, again, hack away, but when you’re shipping a product that people depend on, give them your best.
I would wager that the reason people are apprehensive to buy apps on the apps store is they’re not confident in the developer or the company behind them. They don’t know if what they’re getting is built with craftsmanship or that it’s high quality.
Maybe we can change that perception.
You may be working on products that have a short life span or have a small amount of users, and you might think it’s okay to cut some corners here or there.
But remember that when you do anything, you’re building up tolerance and you’re creating habits. Eventually you’ll have cut that corner 5 times and it went all right so why not just keep doing so?
Our Responsibility as Software Architects
How would you feel if a civil engineer thought that way when they were designing a bridge that you drive your family across?
How would you feel if corners were cut by an aerospace engineer designing a commercial airliner that your parents might use to fly to you for the holidays?
Engineering is a huge responsibility. Society depends on engineers to do the right thing and to do it well.
As software engineers, we may not building applications that can directly harm somebody or maybe we never will, but we’re constantly working with other software engineers that we influence, and someday they might.
As we move further into the future, software is arguably becoming the crux of how our world operates. Just some examples:
- Robotics are beginning to take over jobs that humans used to do.
- Cars are starting to drive themselves.
Engineers of all disciplines are using software to design bridges, buildings, vehicles, what have you. There are so many lives that depend on software now and even more that will in the future.
Software architects are designing and building the pillars for which our society stands on.
From now on, when you’re writing code, I hope that you think of it in terms of craftsmanship.
Whether you’re heading down the road, starting a new project, or working on an existing one, take pride in what you’re doing. Don’t skimp on the parts that you think nobody’s going to see.
You’ll never know who’s going to crack open that Alienware box of your code and walk away inspired.
RWDevCon Inspiration Talk – Craftsmanship by Chris Wagner is a post from: Ray Wenderlich
The post RWDevCon Inspiration Talk – Craftsmanship by Chris Wagner appeared first on Ray Wenderlich.