How to Future Proof Your Web Application

What do traditional archers and old Linux hackers have in common?
Terrible looking websites.

I’ve recently started getting into traditional archery. Like any other geek, the first place I looked for information was the Internet. In my quest to suck less at hitting targets, I scoured the Internet for resources. I found lots of content, especially video content, but most of the websites were so outdated it made them hard to read. Not only were they unusable on my phone, but many sites didn’t even look good on my computer. While there are lots of videos on YouTube, I could only find one well designed site. (http://www.archery360.com/)

The thing about traditional archery is that it’s been around for thousands of years. It’s about the most evergreen content you can find. A well written archery site should be able to last indefinitely.

This got me thinking about how to build a future proof (or at least future resistant) web application. The benefits of future proof apps are obvious, but even if you don’t plan for longevity, your app is probably going to be running longer than you expect. I’ve seen many instances of businesses running ancient apps that no one thought would last that long. Think about the trillions of lines of COBOL happily chugging away in server rooms across the world.

Additionally, most people have better things to do than redesign their sites every year. Not everyone needs to keep up with the latest web design trend. This is especially true for people who are producing evergreen content, as opposed to news sites and blogs.

How do we make our web apps future proof?

Make things easy to change

Great software is software that can be efficiently maintained. Pay attention to proper design principles. Separate your concerns, don’t get too clever, and keep things simple whenever possible. Program to interfaces to isolate dependencies. There’s a reason why we call these concepts “best practices”. Additionally, use a robust suite of automated tests. Automated tests will save your ass when trying to make changes. Software that can be properly maintained lasts longer and is easier to deal with. It’s also less expensive. Realize that most of the stuff you write isn’t going to be scrapped in the next few years. The web is a mature platform and most applications are going to be around for a while.

Pick technologies with a future

Thinking about using that sexy new JavaScript framework for your mission critical business application? You may want to reconsider. Picking the right stack means balancing a lot of different factors. Here’s a few things to think about:

The Lindy Effect

https://en.wikipedia.org/wiki/Lindy_effect

The Lindy Effect predicts the lifetime of nonperishable media, like books or JavaScript frameworks. It states that the longer something has been in use, the longer it will likely remain in use. For example, the Bible will likely remain in print far longer than the book at the top of the New York Times best seller list. This makes sense. For something to stay in print for a long time, it probably offers significant value. This effect applies to software too. Ruby on Rails, ASP.NET, and PHP have been around for a while. They are mature platforms and don’t appear to be going anywhere any time soon. Meanwhile, there’s a hot new JavaScript framework every week. It’s hard to tell which one of these frameworks is going to emerge from the pack. (… though we all know Angular.js already won)

Is there new stuff being written in the technology?

While the Lindy Effect is useful, relying on it alone will steer you wrong. COBOL and FORTRAN have been around since forever, but there’s no way in hell anyone should be writing new code in them. Think about what other people are doing with your chosen stack today. Are people writing anything new in it or is the technology on it’s way out?

Who’s backing the community?

Another predictor of longevity is who’s backing the technology in question. ASP.NET has Microsoft behind it. Ruby on Rails and PHP both have large communities of users. Angular.js has Google (and to a lesser degree, Microsoft) behind it. You don’t need a large corporate backer to be viable, but if you see lots of people and companies get behind a technology, the likelihood of it being around in ten years is high.

Design for the future

People access the web from all sorts of devices. From computers to phones to Internet enabled refrigerators. One thing we know about the future is that the number of device form factors is not going down. When I was looking for archery sites, the most common problem was the text was too small. This was because most of the sites were designed with one viewport in mind.

There are two things we can do to make our designs future proof.

Keep it simple.

This is Google’s homepage in the year 2000

How to Future Proof Your Web Application

How dated does it look? Can you still use it?

While Google isn’t the most beautiful site, it’s simplicity gives it long term appeal. When building something to last, stick with a simple design. You don’t need to go as spartan as Google, but keep the content to chrome ratio firmly in the content side.

Use responsive design

With frameworks like Bootstrap and Foundation, it’s easier than ever to make your site responsive. Responsive design should be the default for everything you build on the web. You never know what kind of device someone is going to visit your page with, but with a little bit of effort, you can make your web application work on most of them.

Conclusion

Future proofing should be an important design consideration. By making good choices in the beginning, you can ensure your web app will live a long life.

Now if you’ll excuse me, I have a traditional archery website to build…

How to: Ionic in Visual Studio

Mobile devices are taking over the world. If you are a web developer, you need to be prepared for a world where people spend the majority of their computing time on mobile devices. This doesn’t mean “the web is dead”, just that you need to be able to write code that works on mobile devices. The primary way to do this is by writing responsive web sites. However, sometimes you want to be on your user’s home screen. For that, you need to build an app. While learning the native platforms is a possibility, there’s a significant learning curve. Fortunately, there are hybrid applications.

What’s a hybrid application?

A hybrid application is a mobile app (it sells in the app store) that runs within an internal web browser. Hybrid apps use standard web technologies like HTML, CSS, and JavaScript. For the average user, hybrid apps are indistinguishable from standard native apps. There are two main advantages. First, you can use one code base for all three platforms. Second, you use existing web skills to build that code base.

My Path to Hybrid Development

I spend most of my time developing ASP.NET applications, but I’ve been experimenting with mobile technologies for the past year. I’ve built native apps in Android and Windows Mobile. I’ve played around with Swift. I tried to use Xamarin Forms (and hit the paywall at File -> New). The one technology that’s been on my list that I haven’t gotten around to until recently, is hybrid.

A big part of why hybrid technologies got kicked to the back of my list is because of the ongoing debate between hybrid and native. Hybrid apps got off to a lousy start. They were slow and clunky compared to their native counterparts. Turns out DOM manipulation is slow, especially on a phone with 128mb of ram and a single core processor.

In recent years, a combination of improving web browsers and Moore’s law have fixed this issue. Unless you are building a video game, hybrid apps are fast enough.

Another barrier for hybrid technologies is that each native environment has it’s own design language. Each of the native environments has a standard list of controls and design guidelines that help you fall into the pit of success. You don’t have to work hard to make something that looks professional.

When building my Windows and Android apps, I went from zero knowledge to a simple, but decent looking app in a few days. I used the standard controls with some minor color tweaks and had something that looked like it belonged.

Most hybrid environments, like Apache Cordova, don’t have this built in design. You start with a blank canvas. This gives you lots of room to shoot yourself in the foot.

In the web world, we solved this problem with front-end frameworks. You can use Bootstrap, Foundation, or a host of other frameworks to give your app a default design you can override later. This has made it a lot easier for developers to build professional looking web applications.

Fortunately, people who build hybrid applications caught on and built their own frameworks. While there’s quite a few of these, the one I’m going to cover here is Ionic.

What is Ionic?

Ionic is a hybrid application framework that uses Angular.js to build cross platform hybrid apps. It sits on top of Apache Cordova and provides a standard set of controls for building hybrid applications. Think of Ionic as Bootstrap (+5) for hybrid applications. It gives you starting point and way of doing things that speed up development.

Why Ionic?

There are lots of advantages to using Ionic, but ultimately, I care about building great applications as fast as possible. Before learning about Ionic, I had recently downloaded an app. I was impressed with it’s design and functionality. When I first heard about Ionic, I noticed that they had a showcase of apps built using the platform. In that showcase, I saw the app I recently downloaded. At that point I was convinced. If an independent developer can build an award winning application that rates 4+ stars in both app stores, the technology that created it is worth a look.

Another reason that I’ve decided to try hybrid development is that Microsoft is embracing hybrid. Cordova tools for Visual Studio is now built into Visual Studio 2015. Microsoft is also building their own set of emulators to aid in hybrid development. This means that people that are using Microsoft technologies can use familiar tools to build mobile applications.

Overall, I think this is a big win for ASP.NET Developers.

How to get started?

Install Node.js

There are two paths to using Ionic with Visual Studio, but both of them start with some basic setup. Like many front end frameworks, Ionic uses the Node Package Manager (npm) to run commands. NPM is basically NuGet for Node.js. You can find Node.js here.

Install NPM Packages

Once Node.js is installed, fire up a command shell (in admin mode) and enter the following command:

npm install -g cordova ionic

This command installs both Apache Cordova and Ionic.

Now that you have the basic tools setup, there are two ways to use Ionic with Visual Studio. The first option is to use Visual Studio. In this case, we’re going to use Visual Studio 2015.

Visual Studio 2015

To develop with Ionic on Visual Studio 2015, do the following:

Install Tools for Apache Cordova

These come with the default installer. They’re listed under “Cross Platform Mobile Development”. If you need to add the tools in after the fact, you can just run the installer again.

Use the Ionic Template

The makers of Ionic have published some handy templates for you to use in Visual Studio. In the new project screen, go to Online and search for “Ionic”. You should then see the Ionic Tabs template. This template will set you up with a basic Ionic App to check out.

Ionic Template

Run Your App

To run your app, select either select an emulator and hit “Run”. The easiest emulator to use is the Ripple Emulator, which brings up your Ionic app in your web browser.

Ionic in Ripple

Visual Studio Code

Another way to get off the ground with Ionic is to use Visual Studio Code. If you haven’t checked out Code yet, you really need to. It’s a lightweight code editor that’s fast and optimized for ASP.NET and Node.js development. If you want to use Code to do your Ionic development, do the following:

Install Visual Studio Code

Download code here and follow the installation instructions for your platform.

To add the “code” command to your command line on a Mac:

Start up Terminal

Type cd ~/ to go to your home folder

Type touch .bash_profile to create a bash profile file.

Edit .bash_profile with your favorite editor (You can just type open -e .bash_profile to open it in TextEdit.)

Add the line code () { VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;}

Type . .bash_profile to reload .bash_profile and update any functions you add.

Create an Ionic Project

Open up a command window and browse to the folder where you want your project.

To start an Ionic project type ionic start appname template.
For “appname”, substitute your app name. For “template”, Ionic comes with three basic templates. Try the “tabs” template for now. (Additional Info on starting an Ionic App)
This command builds your Ionic app using your chosen template.

To Edit Your Ionic Project

To open up VS Code, you can use the UI, or you can just type code . in your ionic project folder.

To Run Your Ionic Project

Type the command ionic serve
This will open up your Ionic project in a web browser. You can also use emulators to run your Ionic app. (Instructions here)

Additional Resources

Ionic Framework
Visual Studio Code
Node.js
Ionic Showcase

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

Visual Studio Goes Cross Platform with Visual Studio Code

Today, Microsoft kicked off Build 2015. Among the long list of exciting developments, Microsoft released the first cross platform version of Visual Studio. This new version of Visual Studio is called Visual Studio Code (or VSCode). It’s a lightweight code editor that runs on Windows, Linux, and OSX.

VSCode is built for Node.js and ASP.NET web app development, but it also support lots of other languages. In addition to the languages you’d expect from a Microsoft code editor (C#, JavaScript, TypeScript, F#, etc…), VSCode also supports a laundry list of other languages like C++, PHP, Python, Java, R, Objective-C, PowerShell, and Markdown ( full fist of supported languages ).

While VSCode isn’t a full IDE like the Visual Studio we all know and love, but it does have a lot of features that take it beyond a basic text editor.

Features:
  • Node.js debugging (ASP.NET 5 and other languages are on in progress)
  • Built in Git support
  • Multiple cursors, just like Sublime Text or Atom
  • Intellisense (for Node.js and ASP.NET)
  • Static Code Analysis and Refactoring (for C#, JavaScript, and Typescript)
  • Automatic updates
  • A fast release cadence, with releases coming every few weeks, instead of every few months.
  • Ability to customize keyboard shortcuts and add custom tasks

First Impressions

As a Mac owner who does ASP.NET development, I immediately downloaded a copy of VSCode and started playing with it. To me, VSCode feels like a cross between Visual Studio and Sublime Text (or Atom). On my Mac, it feels snappy and responsive. The intellisense is instant, but I’ve noticed some that it doesn’t include all the files (probably a setup issue on my part).

Visual Studio Goes Cross Platform with Visual Studio Code

VSCode also supports static analysis. This means you can find references and view definitions. I tried a “Find All References” and it took a little longer to pop up, but I like the inline reference window. “Goto Definition” and “Peek Definition” were instant, however.

Visual Studio Goes Cross Platform with Visual Studio Code

Multi-cursor is my favorite text editor feature. I bought a copy of Sublime Text specifically for it’s multi-cursor support. Multi-cursor has saved me tons of time. VSCode has the best multi-cursor support I’ve seen. ( More Info )

Visual Studio Goes Cross Platform with Visual Studio Code

Verdict

In the past few years, I feel like code editors have taken some huge steps forward. Sublime Text set a benchmark for excellence and several competitors have stepped up to the plate. The best one I’ve seen before VSCode was the Atom editor. While it wasn’t good enough to take me away from Sublime, I thought it was a solid piece of software.

At my day job, besides Visual Studio 2013, I use Sublime Text. Sublime has saved me countless hours of time by making repetitive code chores easier. VSCode does all the things I currently use Sublime for AND it has built in support for ASP.NET. I’m definitely going to add VSCode to my developer tool belt.

Where Can I Get It?

Visual Studio Code is available for free at https://code.visualstudio.com/

Documentation can be found at https://code.visualstudio.com/Docs

Book Review – Essentialism: The Disciplined Pursuit of Less

Book Review - Essentialism: The Disciplined Pursuit of Less

Being an adult is hard.

People are constantly vying for chunks of your attention. As you become more successful, you have to weigh lots of options. There are dozens of competing commitments and everyone is so busy trying to fit them all in. It’s maddening.

According to Greg McKeown, it doesn’t have to be this way. In his book, Essentialism: The Disciplined Pursuit of Less, he lays out a case for eliminating the unimportant things in your life, creating boundaries, and focusing on the important few over the trivial many. I recently listened to this book and found a lot of actionable advice.

This book is especially useful for people in the technology industry. We have to deal with lots of stress and constant change. It can be painful to keep up. This book provides some guidance on how to focus and get better results with less stress.

Summary

Less, but better.

The main point of the book is that life is a series of trade offs. You can make these trade-offs yourself or you can let other people make them for you. To control your destiny, you need to figure out what’s essential to you. Then, you can focus on these few essentials and eliminate everything else.

The book divides the process of focusing on the essential into three phases:

Explore

Block off time for exploration and play. Because you’re only going to focus on a few important things, it’s important to explore what’s available. Essentialists spend more time exploring because they don’t go “all in” on every task that comes their way. They have more time and incentive to explore.

Eliminate

Come up with a clear purpose for yourself and use that clear purpose to eliminate extraneous things from your life. Use extreme criteria to reduce the number of options available. Set boundaries for yourself and others. Learn to say “no” gracefully.

Execute

Build systems that reduce the friction of doing essential things. Build smart routines and prepare for setbacks. Focus on small wins to stay motivated.

In addition to the three steps, Essentialism offers specific techniques on how to achieve simplicity in your life. One example is zero based budgeting. Most organizations budget based on last year’s numbers. Zero based budgeting starts everything off at zero. Starting from a fresh place may lead to a budget that is more in line with the priorities of the organization.

Why should you read this book?

Technology professionals have to deal with tidal waves of information while balancing competing interests. Becoming an essentialist can make balancing those interests a lot easier. The essentialist philosophy has many practical applications to software professionals.

Here are some examples:

Requirements
In any given project, people want more features than there’s time to build. Essentialism illustrates the necessity of trade-offs and highlights the need to prioritize.

Career Skills Planning
Essentialism makes a strong case for being a “jack of all trades, master of one” approach to skills training.

Writing
Both code and prose become better with the elimination of extraneous items.

Lean Software
The Lean Software movement displays a solid grasp of focusing on the essentials.

Conclusion

Essentialism is a great read for any software developer or technology professional. It’s made me reevaluate my life and focus more on the essential. I highly recommend it.

How to Find The Best Tech News

How to Find The Best Tech News

Staying well informed is important to every professional, but how do you navigate the sea of infinite content? How can you filter out useful information from political nonsense, irrelevant junk, and clickbait? As someone who tries to focus the essentials, I don’t want to waste time separating the good from the bad. I want useful information that helps me in my life. To address this need, I’ve created an information funnel. I get news from a variety of sources and filter out the best stuff. In this post, I’m going to describe my information funnel and how you can use a similar process to get your own slice of news.

Define Goals

The most important thing to do when trying to find good information is defining what you are looking for and what you want to avoid. I’m looking for the following things:

  1. Useful articles on software engineering and ASP.NET
  2. Mobile platform how-to articles and major product releases (the Apple Watch, Xamarin Forms)
  3. Mobile trends and statistics (smartphone adoption)
  4. Bleeding edge future tech (self driving cars, 3D printed organs, etc…)
  5. Any new developer trends that I should check out (Ionic, Node.js)

This list represents a combination of things I need for my job, things I’m interested in, and potential future technical investments. I’m interested in a lot of different things, but the goal of this list is to focus on the technology.

I also want to avoid any unactionable news. If it doesn’t help me, then I generally don’t care about it. Heres some examples:

  1. Holy wars. I don’t care about which platform is “better”.
  2. Product reviews for things I’m not going to buy.
  3. Political drama.
  4. Uninformed opinions about the future.

Additionally, I don’t want to waste a lot of time finding news. Being well informed is a good, but this endeavor has diminishing returns. News is the information equivalent of carbs. You need a few, but not too many, and you want to stick with high quality sources.

Sources

The next step is to find decent news sources. This is a huge challenge because there are so many news sources. I get my news from a variety of places and have tried various methods of filtration to avoid the junk. I find that a combination of Podcasts, RSS, Twitter, and Prismatic works well for me. I get a variety of sources, which is important to avoid filter bubbles, but I also get some selection, so I’m not buried in junk.

Here’s a list of news sources I use now or have tried in the past:

Podcasts

I listen to a variety of podcasts on technology. Podcasts are great for getting in depth information about technical topics. Podcasts are also great because you can listen to them while doing other things, like driving to work. It’s a good way to multitask. The only disadvantage is that podcasts can be long. Here’s two of my favorite podcasts:

http://www.dotnetrocks.com/
http://msdevshow.com/

RSS Feeds

While other media has chipped away at my RSS feeds, I still subscribe to a few blogs. RSS is good for following specific products or people. The disadvantage is that you can get behind if you subscribe to too many news sources. I subscribe to less than 20 feeds.

Twitter

I get a lot of news on Twitter now. There are two things I like about news on Twitter. First, because it’s a social network, the good stuff tends to find it’s way to the top. Second, if I don’t pay attention to it for a while, I don’t have a huge inbox waiting for me when I come back. It’s also great for keeping up with organizations, like PEW or the Visual Studio team. The big disadvantage of Twitter is it can be a cesspool of ignorant political bickering. You can’t have a political discussion in 140 characters. The key is following the right people. I tend to unfollow folks who use Twitter for politics or idle chit chat.

Here’s a few accounts I like to follow:
https://twitter.com/pewresearch
https://twitter.com/Ionicframework
https://twitter.com/DotNet
https://twitter.com/singularityhub

Prismatic

I’ve recently started using Prismatic. It’s a service that delivers content to you based on your interests. It also tries to learn from you and deliver increasing good content (like Pandora for news). I’m still getting the hang of it, but Prismatic offers interesting articles. I check it every few days. The key to making Prismatic work is only starting with a few interests. I’m interested in a lot of things, so I checked lots of boxes and had to filter out a lot of noise. I ended up removing about 2/3’s of the interests I started with.

Flipboard also gives you streams of news based on your interests. It’s a beautiful app, but I didn’t like it. I could see why some people would prefer it to Prismatic though.

Hacker News

I used to read Hacker News, but it’s become too whiny and political for my tastes. Hacker news still has some good stuff though. I check it once in a while.

Google

Google News is good for getting news for a lot of sources, but it’s not specific enough for me. Google Now, however, has delivered some interesting content to my phone. It’s finds things related to what you’ve searched for or read in the past. My biggest Google Now win is when it delivered the answer to a problem I unsuccessfully searched for the previous day. It’s creepy, but amazing.

Reddit

I’ve recently started using Reddit. While I don’t use it for tech news, you could. There’s a subreddit (a topic specific group) for almost every technology. I found that the same thing that applies to Prismatic also applies to Reddit. It became much more useful once I stopped following so many topics.

Filtering

I prefer to do my reading in long sessions, so I use a “read it later” app to save links. I check the sources mentioned above when I get bored and save anything interesting to my “read it later” app of choice (Pocket). I ignore the vast majority of what I see, but filtering has gotten easier as I’ve gotten better at selecting news sources.

Archiving

If I find something good, I’ll save it to Evernote so I can refer to it later. I only do this for evergreen articles that won’t lose their value over time. Usually these are on business development, software best practices, or personal development.

Conclusion

Separating the signal from the noise is tough in the age of infinite content, but we have many tools at our disposal. What do you do to stay well informed?

How to Build HTML Helpers like Html.BeginForm() in ASP.NET MVC

If you’ve used ASP.NET MVC for more than five minutes, you’ve probably used the Html.BeginForm helper method.


@using (Html.BeginForm()) {
// Form Fields go here
}

This method wraps your content in a form tag. It’s a handy way to build forms, but we can also create our own html helpers for other container elements. In this post, I’m going to show you how to wrap a Bootstrap row in an HTML helper.

Bootstrap, the UI library that comes with .NET, makes it easy to build professional looking web applications. One of it’s primary disadvantages, however, is that you have to write a lot of markup to get your layouts to work correctly. We can reduce this by creating a custom HTML Helper that works like Html.BeginForm().


@using (Html.BeginRow()) {
// Grid content goes here
}

Step 1

Create a Private Class that implements IDisposable. Have the constructor take a TextWriter object. Set the dispose method to use the text writer to output the closing tag for the row.


private class RowContainer : IDisposable {
    private readonly TextWriter _writer;

    public RowContainer(TextWriter writer) {
        _writer = writer;
    }

    public void Dispose()
    {
        _writer.Write("</div>");
    }
}

Step 2:

Create an HTML helper extenstion method that creates the beginning tag and returns the object created in Step 1. You can use ViewContext.Writer to directly output the markup.


public static IDisposable BeginRow(this IHtmlHelper htmlHelper, string cssClass = "") {
    var writer = htmlHelper.ViewContext.Writer;
    writer.WriteLine(string.Format("<div class='row{0}'>", cssClass));
    return new RowContainer(writer);
}
 

Step 3

Use the helper in your Razor view with a using statement, just like BeginForm(). When the using statement disposes the returned object, it’ll close out the tag.


@using (Html.BeginForm()) {
// Form Fields go here
}

Additional Information

Full Code

How the Monty Hall Problem Can Make You a Better Software Developer

Being called the smartest person in the world makes you huge target for trolls. Marilyn vos Savant was listed in the Guinness Book of World Records under “Highest IQ”. This propelled her into the national spotlight. She then proved that IQ doesn’t mean everything by becoming columnist for Parade. The listing also made her a popular target of criticism, especially by academics. There are whole websites devoted to proving her wrong. This is not one of them. This is a story about how she was right and what we, as software developers, can learn from her experience.

How to Play “Let’s Make a Deal”

The Monty Hall problem is a famous math problem that’s based on an old game show called “Let’s Make a Deal”. The game begins with three doors. One of the doors has a fabulous prize. You don’t know what’s behind any of the doors and each door has an equal chance of containing the prize. You are then asked to select a door. After selecting your door, the host of the show reveals one of the other losing doors. You are then given the option to switch.

The question is:

Would switching doors give you a better chance of winning the prize?

The intuitive answer is that switching doors provides no benefit. Remove one door and your 1 in 3 chance becomes a 1 in 2 chance of winning. Since each door has an equal chance of being correct, the remaining door isn’t any better than the one you picked. This is the answer most people come up with when they first hear this problem.

This logic, while intuitive, is flat wrong.

The correct answer is that switching gives you a 2/3 chance of winning, as opposed to your 1/3 chance you have sticking with your door. The key to this problem is that revealing one of the incorrect doors doesn’t change the initial probability. You already know one of the doors is going to be wrong. What is important is that the host is basically giving you the option to select two doors instead of one.

Here’s another way to think about it. Switching and losing means that your initial selection was the right one. Your probability of winning with your initial selection is 1/3. Thus, the probability of you losing when you switch is 1/3, which means your probability of winning is 2/3.

If you still don’t believe me, the Khan Academy explains this problem well:
https://www.khanacademy.org/math/precalculus/probcomb/dependentevents_precalc/v/monty-hall-problem

The Time the Smartest Person in the World Got Flamed by Everyone

Marylin vos Savant answered this same question in her column in 1990. Even though she was correct, the public sent her a truckload of hate mail. Many academics also piled on the criticism.

Here’s a sample of the feedback she received (Source):

Since you seem to enjoy coming straight to the point, I’ll do the same. You blew it! Let me explain. If one door is shown to be a loser, that information changes the probability of either remaining choice, neither of which has any reason to be more likely, to 1/2. As a professional mathematician, I’m very concerned with the general public’s lack of mathematical skills. Please help by confessing your error and in the future being more careful.

Robert Sachs, Ph.D.
George Mason University

May I suggest that you obtain and refer to a standard textbook on probability before you try to answer a question of this type again?

Charles Reid, Ph.D.
University of Florida

And my personal favorite:

You made a mistake, but look at the positive side. If all those Ph.D.’s were wrong, the country would be in some very serious trouble.

Everett Harman, Ph.D.
U.S. Army Research Institute

It took Marylin several tries to explain the concept well enough for the majority of her readers to understand it. I found her explanation to be clunky, so I posed the problem to my Facebook friends. What resulted was the longest comment string I’ve had in a long time. My friends, several of whom have advanced degrees, had a tough time with the problem. The people who knew the correct answer had a tough time explaining it to the doubters.

What can this story teach us about building better software?

There are several lessons this story can teach us about psychology, thinking things through, and humility.

1. People are bad at estimating risk

This story illustrates that people are not good at understanding probability. There’s a whole slew of cognitive biases (brain fails) related to estimating probability.

List of Cognitive Biases

This is important to software development because much of what we do is estimate and mitigate risk. For example, mitigating security risks is incredibly important. Due to our inability to measure risk well, we may spend resources fixing low risk problems that were recently featured in the news instead of fixing high risk issues.

Risk also factors into software estimation. People are terrible at estimating how long it takes to do anything over a day. This is why agile software projects measure tasks using relative complexity (story points, T-shirt sizes, etc…) instead of hours. Agile projects also break down work into bite sized pieces, which are easier to comprehend.

2. Watch out for red herrings

Another important aspect of software development is filtering out irrelevant information. In the Monty Hall problem, the host opening the losing door doesn’t change the probability. You already knew one of the doors was a losing door. I find that it’s important to remember this when I’m debugging code. Good testers tend to report more information than you need and it’s up to you to figure out what’s useful and what’s not.

3. Be skeptical of “experts”

Many of Marylin’s critics were highly educated. All three of the quotations I mentioned were from PhD’s, including one professional mathematician. In our society, we tend to take the opinion of experts at face value. Pew Research recently did a survey on the beliefs of scientists vs the beliefs of the public. (link) This survey was widely reported on.

While the opinion of experts is vital, remember that they specialize in narrow areas. Any opinions they have outside of those areas should be subject to the same scrutiny that you give any smart person. Too often, people who are experts in one area are considered experts in other areas as well. A good example of this is when the media asks famous actors about their opinions on political issues. The tendency to allow irrelevant traits, such as beauty or skill in an unrelated field, to effect our judgement someone’s ability is called the halo effect.

You can use the halo effect to your advantage. Dressing sharp and being a good conversationalist can increase your credibility. While it’s acceptable to go a tech conference in a t-shirt and jeans, people will think you are more professional if you wear something nice.

The halo effect also applies to software. In the book Emotional Design, Don Norman explains how people find aesthetically pleasing objects to be more effective. When building your own software applications, pay attention to the design of the interface. Making things look good will make your software appear to be more useful.

4. Don’t be mean.

When doling out criticism, be nice. It hurts a lot less if you’re later proven wrong. This doesn’t mean you should sugar coat things, but you can deliver sharp criticism without being mean about it. Many of the people who wrote in nasty comments ended up apologizing for it once they realized their mistake.

Conclusion

The story of Marilin vos Savant and the Monty Hall problem has many lessons for software developers. If you want to learn more about the topics in this post, check out the resources below.

Khan Adademy: Monty Hall Problem
Maylin vos Savant: Game Show Problem
List of Cognitive Biases
The Availability Heuristic
The Halo Effect
Emotional Design (Amazon)