A pleasant walk through computing

Comment for me? Send an email. I might even update the post!

Three Rules for Successfully Starting a Habit

Image: Henry Mühlpfordt / CC-BY-SA-3.


This post is a summary of the November 6 episode of the Developer Tea podcast, 3 Rules for Designing Lasting Habits. I encourage you to listen to the entire episode, and to subscribe to Jonathon's excellent podcast.

Too often we conflate the goal with the habit. For example, getting up at 7am each morning isn't a habit. (It seems like one at first, right?) I'll use that goal to illustrate each of the three rules.

Concept: What is a Habit?

A habit is a repeated behavior we do in regular cirumstances.

A habit is part of us, it's normal. It's our default. For example, whenever I'm about to walk out of the house, or leave a restaurant, I pat my pockets to be sure I have everything: keys-phone-wallet. I don't even think about doing it. But if something's missing, I notice. My goal? To not lose those three critical items when I'm in transit.

Rule 1 - Focus on Triggers, Not Outcomes

What are the very earliest, small actions that will start the cascade toward the goal? They don't have to even directly support the goal.

Example habits:

  • Set an alarm for 7am. This doesn't guarantee I'll get up, but makes it harder to stay asleep.
    Note: since I'd set a repeating alarm, this isn't really a habit. It's a stacking action (see below)
  • Place my phone on my bedside table each night.
  • Before going to bed, write down the one thing I'll do at 7am the next morning.
  • First thing after lying in bed and lights out, envision with enthusiasm the first thing I'll do at 7am the next morning.
  • Schedule meetings for 8am whenever possible. This makes it unlikely I'll sleep in.

There are more, but this should give you an idea.

Rule 2 - Slow-Pitch Yourself Softballs

Make the first, small habits things you can easily accomplish. Make it easy to hit home runs, both by slow-pitching softballs, and by making the field smaller. Ramp-up instead of going all out.

Confession I've been getting this wrong most of my life. I'd barrel into not just one, but several new goals and habits all at once, succeed for a day or two, then collapse in frustration and shame.

  • For the first week, have only one meeting at 8am. The next week, two, and so on.
  • For two weeks, pick one day to turn on your alarm for 7am, and keep it off the rest of the days. It could be "Fresh-Start Monday." Then increase the number of days over remaining weeks.

It might seem like "Oh, I got up at 7am one morning, big deal." But it is a big deal. If you were getting up at 7 zero days before, then getting up early one day is--technically--an infinite improvement! Seriously, reward yourself for your accomplishments, no matter how small.

Rule 3 - Focus on Compound and Stacking Returns

Choose triggering habits that stack with the other habits. These can also be actions. An example from above is setting the alarm. That'sa one-time action, but it stacks on the habit of putting the phone on the beside table. The metaphor is compounding interest. What are the early habits and actions that make future habits even more valuable?

  • No computer or screen use starting an hour before bedtime. Research shows this improves sleep quality, which is a key toward waking up when I want to. This benefits every other habit, and carries other benefits for my health as well.
  • (Gently) stretch when I get up. Notice that this habit isn't time-dependent. But it's a natural and healthier way than coffee to start up the body's blood, oxygen, cortisol, etc.

While all the above are true, for this particular goal it might be valuable to check whether I'm working against my own body. Am I naturally a morning person? Or an evening person? Biology isn't always changeable, and often not easily changeable.

Encouragement

It's easy to say--or be told--"this needs to be a habit!" But knowing what a habit is, and how to form a habit, is too often left out of the admonition. The rules above can help you be successful. You can do it!

References

Jonathan Cutrell cites these two books in his podcast:

Going Full Screen: When and Why

The Screen Dilemma
One screen
Two screen
Full screen
Lots-o-Windows screen


OK, I'm no Dr Seuss.

Whether you're working on an 11" ultraportable, or have three 25" 4K monitors, minute-by-minute you are faced with a decision:

Do I run the current application windowed or full-screen?

This may not seem to require much thought. Whatever works, right? But is our decison working for our productivity, or against it?

Lots of people blow up every application to full-screen and switch back and forth in a mad fit of mouse-clicking. Others keep all their apps on screen and fling them around like Tom Cruise in Minority Report. I have some opinions on when one or the other is more effective.

Caveat Alert!
I don't have science to back up all of these opinions. If you do (or evidence against), send me an email!

Contents

Principles

The rest of this post really rests on two principles:

1. Reduce distractions
2. Reduce task-switching

These are pretty good ideas for lots of things, not just computer use.

Windowed: Reduced Context-Switching

Better for:

  • Research
  • Data Entry from one source to another

The biggest leap in productivity and joy for most people is when they move from one screen to two. Even fifteen years ago, Albert Balcells, the vice-president of CoActive Marketing Group's development department, told me, "The studies show that you'll make back the few hundred dollars you spend on a second screen within three weeks."

What I commonly hear is, "Wow, now I can have one document open on one screen while I'm working on another!" This is a perfect use case. For example, if I'm researching for a blog post, I'll take notes on one screen while zooming around the web browser in the other. When I'm programming, I have to look up lots of stuff. Keeping the editor in front of me, and a browser full of tabs on a separate screen, triples my productivity.

What about three screens?, you ask.

I use three screens, and find it effective. I'll bet many people do the same thing as I do. One screen is dedicated to just a few apps that are always open and visible. For me it's email, journal and time-boxing timer. I have that monitor oriented in portrait mode.

So, yeah, if you can afford it, do it. But don't increase your distractions! Apply the same rules to three monitors as you do to one!

Tip: Minimize, Don't Close
Avoid closing windows when you're temporarily done with them. Learn and anticipate when you'll be going back and forth between applications. If you don't need an application on the screen, minimize it. I've seen lots of users waste lots of time opening Word, opening a document, doing one thing, closing the document, opening another window, then a minute later closing that window and opening Word again. It's exhausting.

Tip: Use Effective Layering
Even with multiple large screens, layering windows on top of one another is inevitable. Do this effectively if you're switching between them. You should always be able to see enough of a window to identify it and open it without completely obscuring some other window.

Medical Reality
Of course, if you have bad eyes, you'll be going full screen more often. But you can still apply the principles.

Full-Screen: Reduced Distractions

Better for:

  • Writing
  • Heads-down programming
  • Long-form reading
  • Image/Video editing

We think we can do creative or cognitively intensive work while listening to music, reading and commenting on social media, checking email, and playing with our phones. We can't. Humans don't multi-task (really, they don't), and are poor at task-switching.

Lecture Alert
You're not an exception. You think you are. I know you do. But you're not. The science on multi-tasking and task-switching is consistent. You shouldn't use the phone in the car either, not even hands-free, because every study for the last twenty-five years shows it doesn't matter, it's just as dangerous as drinking and driving. Stop it. Your life's more important, and so is mine.

When you're writing your grant proposal, or need to get into the programming zone, or focusing on that merchandising layout, go full-screen, minimize any other window that you can, and turn off your distractions. There is science to back this up, so you don't have to trust me, you can look it up. But save yourself some time and just try it.

Going full-screen not only helps focus on the job at hand, but is also valuable because of the number of tools, toolbars, menus, etc. on high-end applications. For example, if you do photo editing, programming, vector drawing, there could be a hundred or more things to click in front of you. Multiple windows aren't the only distraction. You might want to reduce what the apps show, too (I touch on this later).

Mixed Mode: Just Be Careful

Better for:

  • Multi-monitor, especially three

Most of the time, I work in mixed mode. I have my important windows open and arranged so I can reduce task-switching, and I go full-screen when the need arises.

Tip: Don't Have Actively Moving Windows Open
In movies, it's really cool to see all these screens with stuff constantly moving on them. But in heads-down mode, it's just another eye-catcher. Just as you can't help watching the TV when you're on a date at a bar, anything else flickering or moving nearby only adds to your distraction. Either minimize it or, in the case of a web browser, switch to a tab that's static.

Don't tell yourself you can watch The Lost Room while coding a banking data integration. You won't fully enjoy the former, and will screw up the latter.

Apply the Same Principle to Applications

There's a class of applications called "zenware." The idea is that they focus on providing a distraction-free experience. Even if you don't stick with it, try out a few. This may really influence your experience of your everyday apps, and you might find yourself paring down what's on the screen.

Applications' default layouts are often not the most efficient. They're there to show you the application's capabilities, not improve your work flow. Only keep the tools/frames open that you use frequently. Reduce clutter, but also make it easy to open what you need.

Distractions: Thoughts on Wallpaper

This is a sensitive subject, so definitely take it or leave it. Computer desktop wallpaper is one of the few things users can easily personalize. Except in rare situations, I think businesses should let users set whatever wallpaper they want as long as it's work-appropriate. What that means can be vague, but if there's a question there's an opportunity for better communication.

Regardless, I prefer wallpapers that are interesting but also truly fade into the background. My favorites are black-and-white photos that aren't very busy. Try thinking of your computer wallpaper as a canvas, not a photo album.

Do you really want to find out what difference it makes? Switch your wallpaper to plain black, dark grey, or whatever color pleases you (but I wouldn't go super bright). Try that for a week. Then switch back to your other wallpaper. Which is less stressful?

Here's a wallpaper I like. It's a photo I took of Winton Woods in Cincinnati, Ohio.

Download

Distractions: Thoughts on Desktop Icons

I hate them. I especially hate when users have hundreds on their desktop plus a picture of a puppies playing with ribbons.

Unfortunately, the reason so many users use the desktop for storing files and folders is because they've never been taught how to use the Windows Explorer as originally intended. And I don't blame them, because for years Microsoft and Apple have tried to make file management "better" by hiding something everyone can understand if given half a chance.

The computer file system is based on physical file cabinets, which have been around for centuries.

The big problem with icons on the desktop is that, in order to work with them, you have to minimize open applications. That's a huge time sink.

Here's my advice.

  • Don't open applications using desktop shortcuts. Pin them to the task bar, instead, because it's always available. Then delete those shortcuts.
  • On Windows 7 and 10 you can right-click a taskbar app icon to see the most recent files.
  • Organize your files in the Documents folder, then keep the Windows Explorer window open or minimized.
  • If you must keep icons on the desktop, limit yourself to only the most important you're working on right now, no more than a dozen, and put them all on the left or right side. Most people seem to prefer the left. This lets you resize windows so that the icons are still in view.

Distractions: Final Note

Keep other distractions to an absolute minimum. Do you really need to be notified whenever an email arrives? Does your job require following messaging feeds while trying to focus on the task at hand?

In most cases, the answer is "no." Don't let applications interrupt you when they want to. They are not the boss of you. You decide when to check email.

Summing up

As I discovered when writing this post, the real issue isn't whether to run apps full screen or not. It's why, and that boils down to distractions.

Maybe this will help in some way. I hope it'll inspire you to examine how you're working and try some experiments.

Work well!

NuGet PackageReference in Visual Studio

The information is accurate as of this writing, as far as I know.

Contents

What's the Change?

Today, a project's NuGet package information is stored in a project-level packages.config folder. The assemblies are stored in a separate packages folder, usually at the solution level. The project's .csproj file contains Reference elements that point to the assemblies.

Packages.config format folder layout and text samples

Argonautics
|_packages
  |_ParseText.1.0.4.0
    |_lib
      |_net45
        |_ParseText.dll
        |_PersistText.dll
|_Argonautics.sln
|_PlainPlanning
  |_PlainPlanning.cproj
    <Reference Include="ParseText.dll, Version=1.0.4.3, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\ParseText.1.0.4.0\lib\net45\ParseText.dll</HintPath>
      <Private>True</Private>
    </Reference>
    <Reference Include="PersistText.dll, Version=2.3.4.0, Culture=neutral, processorArchitecture=MSIL">
      <HintPath>..\packages\ParseText.1.0.4.0\lib\net45\PersistText.dll</HintPath>
      <Private>True</Private>
    </Reference>
  |_packages.config
    <package id="ParseText" version="1.0.4" targetFramework="net45" />

The PackageReference format moves the package information out of packages.config into the .csproj file, and removes the assembly references. The packages folder is removed, as well, in favor of a user-profile folder found at %userprofile%\.nuget\packages.

PackageReference format folder layout and text samples

Argonautics
|_Argonautics.sln
|_PlainPlanning
  |_PlainPlanning.cproj
    <PackageReference Include="ParseText">
      <Version>1.0.4</Version>
    </PackageReference>
|_%userprofile%\.nuget\packages
  |_ParseText.1.0.4.0
    |_lib
      |_net45
        |_ParseText.dll
        |_PersistText.dll

When the project builds, Visual Studio finds the packages in the expected location and copies the assembly dependencies to the bin folder.

What Are the Advantages?

  • Binaries that can be restored are very hard to accidentally include in source control.
  • Only the package information is shown in References, which is usually what the developer wants to see.
  • Package restore is faster because files aren't copied to a solution folder. Continuous Integration benefits, as well, by having just one well-known package location.
  • Importantly, since the paths to assemblies aren't stored in the .csproj file, version control thrash due to differences between developer environments is eliminated. No more update-package -restore because DLLs can't be found.
  • The PackageReference elemnt allows more flexibity and direct use by MSBuild.
  • For NuGet Package authors, the nuspec information is stored directly in the project file, not in a .nuspect file. Also, Build and Pack tasks are included in MSBuild.

Which Visual Studio Editions and Project Types Does It Work With?

PackageReference is availabe in Visual Studio 2017. As of this writing, per NuGet.org:

Although we’re working to bring the PackageReference goodness to all project types and to make all packages compatible with PackageReference, migration is not presently supported for C++, JavaScript, and ASP.NET (.NET Framework) projects.

Also, some packages capabilities are not fully compatible with PackageReference.

Some examples of scenarios that will not be supported include content folders (we have introduced ContentFiles), XDT transforms, PowerShell scripts i.e. install.ps1 and uninstall.ps1 (only init.ps1 is supported) .

Author Note
Obviously ASP.NET support is important, and projects may depend on packages that aren't compatible. However, its lack doesn't prevent migrating compatible projects.

Is There a Converter?

Yes, there is! It's currently available in the Visual Studio Preview edition. It has some known issues, but seems to work well. See the References for a link to instructions.

Manually Converting to PackageReference.

This works with ASP.NET, too, but is more likely to have problems because of content files (stylesheets, scripts, etc). Need to look into this further.

  1. Backup solution
  2. Open solution
  3. Open a project's packages.config
  4. Open the project's .csproj file
  5. In another text editor, create the PackageReference elements.
    <package id="Newtonsoft.Json" version="10.0.3" targetFramework="net461" />
    
    <ItemGroup>
    	<PackageReference Include="[PackageId]" Version="[PackageVersion]" />
    	<PackageReference Include="Newtonsoft.Json" Version="10.0.3" />
    </ItemGroup>
    
  6. Right-click References > Manage Nuget Packages
  7. Choose the Installed tab.
  8. Uninstall the packages for the project only.
    There could be more cleanup in .csproj, such as deleting extraneous .target references*
  9. Copy the ItemGroup into the project file and save.
  10. Delete packages.config
  11. Open Package Manager Console, select the project, and run (for example)
    Update-Package -ProjectName Sms.Web.Verifications -Reinstall
  12. Build
  13. Run

I reocmmend doing a file/folder diff from the previous version (easy if using version control). This will reveal problems that a build/run may not catch.

Can I Convert With a Script?

I haven't tried a script, yet, but I don't see why not.

References

Image Attributions

  • By NuGet project team (https://github.com/NuGet/Media) [Apache License 2.0 (http://www.apache.org/licenses/LICENSE-2.0)], via Wikimedia Commons
  • By Microsoft Corporation ([1]) [Public domain], via Wikimedia Commons