Archive Monthly Archives: May 2015

How To Get The Most Out Of Criticism

Have you ever built something you’re proud of, only to have it torn to shreds when you show it your audience? Get burned in a code review? Rejected after a job interview? I know I have. Today, I’m going to write about some strategies to deal with it.

If someone is able to show me that what I think or do is not right, I will happily change, for I seek the truth, by which no one was ever truly harmed. It is the person who continues in his self-deception and ignorance who is harmed.
― Marcus Aurelius, Meditations

One of the most underestimated soft skills of the modern software developer is the ability to take criticism well. This is an industry where things change so quickly that there’s no way to be perfect. There is always someone who knows more than you and even if they don’t know more than you, you can certainly learn from them.

Besides being bad at taking criticism, most developers are not good at giving good criticism. Anyone can slag another person’s creative output, but how often can someone say something that helps the person they’re critiquing? Being able to deliver a useful critique is almost as valuable as taking one. Software development is a complex craft and being able to help others is essential.

On Dealing With Criticism

One particularly powerful sting-elimination strategy is to consider the source of an insult. If I respect the source, if I value his opinions, then his critical remarks shouldn’t upset me.
– William Irving, A Guide to the Good Life: The Ancient Art of Stoic Joy

I’m going to define criticism broadly. To me, criticism includes any comments you receive on your creative work. It includes well meaning advice, sharp attacks, and trolling. It also includes situations when you don’t get picked for the job, get passed over to speak at a conference, or lose a contest. Call it criticism from life. Regardless of the source and intent of the criticism, the following tips apply.

Don’t take it personally.

Even if someone meant to harm you, you choose how you respond to criticism. You can choose not to interpret it as insult. At the end of the day, all criticism is information. Treat it like any other data stream. Some data is higher in quality, some data is lower in quality, but it’s all just data.

The reality is the people who sling insults are not doing it because of you, they’re doing it because of their own issues. You can’t control them, but you can control you.

Mine for actionable feedback.

When someone criticizes your work, even if they were trying to hurt you, look for things you can improve on. For example, let’s say your users throw some scathing criticism your way in a product review. While it’s easy to get angry or frustrated, try to figure out the root cause of their pain and use it to improve the product. If you get rejected for a job, try to think of where you went wrong and fix those things in future interviews. Remember, failure is temporary. Learning is everything.

Sometimes, you are going to get comments that have no useful information. Trolls excel at leaving useless criticism. If you can’t find actionable advice, then disregard the comment. Remember, people being mean is their fault, not yours.

Consider the source.

Like in the quotation above, it’s important to consider who is criticizing you. Do you respect them? Are they considered experts this particular area? Do they adhere to the same philosophy as you? Use these considerations to weigh comments. Do you think that Peter Thiel, Elon Musk, Ray Kurzweil and others like them care one shred about what luddites think about them? I doubt it.

On Giving Good Criticism

Giving good criticism is almost as important as being able to take criticism. Being able to deliver useful feedback to your peers helps them grow. Being able to do it in a way that doesn’t make them hate you is good too. Here are a few tips to help you with that.

Be mindful of other people’s egos.

While it’s easy to say that you should make all criticism into dispassionate feedback, actually doing it is hard. I still have a ways to go myself. Because of this, you should make it as easy as possible for the person you are critiquing to turn what you say into useful feedback. An important way to do this is by being mindful of their ego.

Software development is a tough craft. People invest their time and energy to get good at it and a well timed insult and can trigger all kinds of pain. If you want to see how fragile people’s egos are, Google “imposter syndrome”.

To help preserve ego, start with compliments. For example, I attended a session last year that had some content issues. When asked how it went, I started off with the good things about the session. I complemented the presenter on their topic selection and presentation style, which were both excellent. Then I made a point about how they tried to do too much for their time slot. This gave the person something they could use without hurting their feelings.

Remember that negative feedback has more weight than positive feedback. Start off on a positive note and try to achieve at least a 2:1 ratio of positive to negative comments. (if possible)

Focus on giving actionable advice.

Telling someone “that sucks” does nothing useful for either party. You don’t get a better product/employee/code and the person being criticized doesn’t learn anything. Additionally, you’ve angered the person you are critiquing, which benefits no one. Instead, focus on making things better. Try saying “This would be better if…” or “These X things would improve your product because of Y reasons”. Using direct, but non personal phrases focuses the attention to where it needs to be. Remember, there are no bad people, just bad ideas.

Conclusion

The key lesson for this post is to always look for value in criticism. When someone criticizes you, focus on extracting useful information from the experience. Use it to fuel your abilities to the next level. When critiquing others, try to focus on making it easy for them to find value in your comments. Help them get to the next level. Remember, criticism is just data. You choose how to use it.

Image:
Roman Emperor and Stoic, Marcus Aurelius
Photograph by Jean-Pol GRANDMONT

What We Need More of is Hubris: A Review of Zero to One

What We Need More of is Hubris: A Review of Zero to One

We wanted flying cars, instead we got 140 characters.

– Peter Thiel

According to Peter Thiel, an amazing future lies ahead. All we have to do is build it. Unfortunately, cultural shifts have steered us away from audacious, grandiose, and truly innovative projects. We need to stop focusing on making slight improvements to existing technology (going from 1 to 1+n) and start making new things (going from 0 to 1). In short, we need more of the hubris that America has had in past decades.

Zero to One: Notes on Startups, or How to Build the Future is an excellent book by the self proclaimed contrarian and billionaire Peter Thiel. It’s about building startups and thinking big. Zero to One will inspire you and make you think. It’s one of the few business books that can’t be re-written in five pages.

Contrarian Truth

Zero to One starts off with a big question:

What important truth do very few people agree on?

This is a tough question to answer well. Most people come up with something widely believed, like the healthcare system is broken, or an opinion, like how chocolate ice cream is better than vanilla. The key is to find something that is both true and unpopular.

For example, think about the housing crisis. Right before the crisis, the important truth was “the housing bubble is about to pop”. Most people thought the good times were going to last, but some people saw the impending crunch. They used that knowledge to make a lot of money, while the rest of the country lost their shirts.

Finding these contrarian truths gives you an insight into the future. An insight that can you can use to build a business or make an investment. Think of how many truths we take for granted today that were science fiction a few decades ago.

  • We can prevent most infectious disease.
  • It is possible for humans to land on the moon.
  • We will have enough food to feed everyone on the planet.
  • The Internet will connect the world with each other

These things were once considered impossible, but now are obvious.

Here’s a few contrarian truths that I think about on a regular basis:

  • The world is a becoming a much better place for all humanity, despite what the news tells you.
  • Deference to authority is not a good tool for solving social problems.
  • The first human to live past 150 years old is probably alive today.
  • Most people won’t drive cars in 20 years.

So when looking for business opportunities, you should ask yourself: What valuable business is nobody building?

Zero to One vs. The Lean Startup

a startup is the largest group of people you can convince of a plan to build a different future.

– Peter Thiel

Since the .com bubble popped, the startup community has moved towards the Lean Startup model.

The Lean Startup model goes as follows:

  1. Target an existing market with competitors or take something that already exists and apply it in a new context. ie. rip, pivot, and jam
  2. Build a small version of your product. (a Minimum Viable Product)
  3. Release that product and gauge it’s traction
  4. Evaluate the tests and either:
    a. Make small incremental changes to improve the product
    b. Pivot into a new product
  5. Release the new version and test again
    … repeat 4-5 until out of money or you have a killer business.

The beauty of this approach is that it’s a scientific way to build a business. No one knows exactly what’s going to work, so you run as many tests as you can to get to a market.

Thiel doesn’t agree with this method. He advocates something a little different. His philosophy is that startups should make big plans and carve out their own monopoly. They can do this in one of two ways.

  1. Make a 10x improvement over an existing product. (Google did this with search)
  2. Make a totally new product segment.

In my experience, I have noticed that most big companies fall into the category of 10x improvements. Even companies that are credited with creating new markets, like Apple, are usually just improving existing technology. MP3 players, smartphones, tablets, and smart watches all existed before Apple took them to the next level. When I think of companies that made something new, I think about Pirates of Silicon Valley

He also mentions that head to head competition always results in a drop in profits. Look at any commodity market and you will notice that profit margins are razor thin. To avoid this, you need to stay so far ahead of the competition that you can charge enough to make a healthy profit. This profit can then be used to build moonshots or attract the best employees by giving them a world class working environment. Google is a great example of this. Thier monopoly status allows them to treat their employees like royalty while trying to tackle large problems.

To build a monopoly, Thiel advocates starting small and dominating a niche market. Be the big fish in the small pond. I think the bootstrapping community has this down on the small scale. They advocate niching down your product so that it serves your target audience perfectly. The primary difference with Zero to One is that once you master that small scale niche, you then expand your reach. Facebook is a great example of this. It started off with just one college and spread like a zombie plague from school to school. I remember the day when Facebook arrived at my school. Nearly everyone on campus was signed up within a week. It was insane.

Honestly, I think Thiel overstates his contrarian-ness here. While his criticisms of the lean model are legitimate, his alternative is very similar. Start small and blow up. I like how he focuses on sales, which is a dirty word to most developers. The importance of selling is often understated in the Valley. Even the best product will fail is no one’s heard of it.

Fail to plan or plan to fail

Shallow men believe in luck, believe in circumstances… Strong men believe in cause and effect
– Ralph Waldo Emerson

Indefinite attitudes about the future explain what’s most dysfunctional in our world today. Process trumps substance
– Peter Thiel

One of the major themes of Zero to One is the importance of making plans. One of the biggest problems with our society right now is this indefinite attitude towards the future. America used to be a country of big ideas. Even normal people felt they could come up with something big and pitch it to the public. Today, people who think big are often attacked. Ambitious initiatives, like seasteading and life extension, are regularly attacked by lovers of the status quo. If people like Tim Ferriss or Peter Thiel are indicative, having detractors is evidence that you are doing something right. People who change the world are going to make some enemies.

Conclusion

The most contrarian thing of all is not to oppose the crowd but to think for yourself.
– Peter Thiel

The best part of Zero to One is that it will make you think. Unlike many business books, which can be summarized in a page or two, Zero to One is packed full of interesting and useful information. It’s one of my favorite business books and I think that it’s a good book for developers who want to build something great.

Purify Your Razor Views With Tag Helpers

Hate mixing HTML and C# code in your Razor views? Work with designers who are markup ninjas, but scratch their heads at a view full of HTML helpers?

If so, then ASP.NET vNext has a feature for you. It’s called tag helpers. Tag helpers are custom HTML attributes or tags that you place in your view code. Using tag helpers, you can remove most of the C# code from your views. You can use them instead of HTML helpers. Like HTML Helpers, they render in the browser as standard HTML.

Note – This post covers Tag Helpers in the *-beta4 version of ASP.NET MVC.

All of the source code used in this post can be found on github at https://github.com/DustinEwers/dot-net-mvc-ui-demos. Look in the ASPNET5 folder.

Using Tag Helpers

Here’s an example of tag helpers in action:
Tag Helper View Photo

Notice the lack of C# code. Almost everything here is markup. All the HTML attributes that begin with “asp-” are tag helpers. This form is from the default ASP.NET template. For comparison, here’s a similar form (from the template in the last version of ASP.NET MVC) built using standard HTML helpers:
Standard View Photo

ASP.NET MVC comes with lots of built in tag helpers. Here’s some of the more notable ones:

  • asp-for -> Adds the model specific attributes to the HTML element. This replaces HTML Helpers like “Html.LabelFor” and “Html.TextBoxFor”
  • asp-controller and asp-action -> Works with your form tags to emit the appropriate route. These replace “Html.BeginForm”
  • asp-items -> Populates your dropdown list with items from the model.
  • asp-validation-for -> This attribute is used to populate the validation summary at the bottom of each element.

To use tag helpers in your project, you need to ensure the tag helper directive is in your project.

@addTagHelper "*, Microsoft.AspNet.Mvc.TagHelpers"

This directive points to the assembly that contains the tag helpers. This will give your project access to the standard ASP.NET tag helpers. You can either put this on the page that uses tag helpers, or you can put it in a global page like _ViewStart.cshtml. In the default template it’s in _GlobalImport.cshtml.

Making Custom Tag Helpers

The built in tag helpers are great, but you can also make your own tag helpers. A tag helper is a filter. They allow you to change the tag’s output while it’s being written to the view. Here’s a tag helper that creates a Bootstrap form group container:

    public class FormgroupTagHelper : TagHelper
    {
        private const string SizeAttributeName = "size";

        public override void Process(TagHelperContext context, TagHelperOutput output)
        {
            int size;
            Int32.TryParse(context.AllAttributes[SizeAttributeName].ToString(), out size);

            output.TagName = "div";
            output.Attributes["class"] =  string.Format("form-group col-md-{0}", size);
            output.Attributes.Remove(SizeAttributeName);
        }
    }

In this example, we change the name of the tag to a div, take a parameter from an attribute, add a css class, and remove the size attribute (a custom attribute we are using as a parameter).

To build a custom tag helper, you first need to build the tag helper class. Naming is important. The class name must end with “TagHelper” and inherit the TagHelper class. Then you can override the Process or ProcessAsync methods to add your custom logic. In the process method, you can alter the tag in any way you like. You can add or remove attributes and classes. You can also change the name of the tag.

After building your tag helper class, you need to add another addTagHelper directive to your view. This one will be for the assembly that contains the tag helper.

Then, you can use your tag helper in your views. Here’s our formgroup tag helper in action. The “size” parameter is used by the tag helper to set the container size for the form group.

<formgroup size="4">  
   <label asp-for="Address1"></label>
   <input asp-for="Address1" class="form-control" />
   <span asp-validation-for="Address1"></span>
</formgroup>  

And this is a whole page using both custom and built in tag helpers:
Custom Tag Helpers Photo

Conclusion

Tag helpers are a great new feature in ASP.NET vNext. With them, you can make views that look more like web pages than a weird hybrid of web pages and C#. Start up a project in Visual Studio 2015 or grab my demo code and check out tag helpers for yourself.

Additional Resources:
Demo Code

Tag Helpers Source Code