Mr. Neal Ford gets Productive. Part 1: Accelerators

I spotted a Mr. Neal Ford doing a full day on the Microsoft DevWeek 2009 about ways to improve your productivity as a programmer. This appealed to me as it’s one of my new years semi-resolutions to get more done (too many ideas, not enough output).

Now it’s several hundred pounds to even attend a single DevDay – let alone a DevWeek – so I thought, bet this guy has some book that he is plugging, and bingo – on Safari (the excellent and searchable online IT library)  I found “The Productive Programmer – 1st Edition” by Mr. Neal Ford. Published July 08 (there’s the Amazon link for you as well). 

 Mr. Neal Ford it turns out does not come from a strict Microsoft background – and the book includes a lot of references to Java and Java IDE’s – also there are several references to Linux and the MAC OS – however, having said that there are plenty of good tips and tricks in this book for the Microsoft brainwashed, and it’s worth a read.

So without any further wibbling, some notes on Mr. Ford’s Amazing accelerators:

  • The general  thrust of this chapter is to improve the brain -> keyboard -> code flow. Main obstacles being clunky UI, the mouse (Mr. Ford does not like mice) and anything else that means your brain is preoccupied with the tool rather than the task.
  • A second important general principle is an emphasis on making an active effort to actually integrate these tools into your daily work, and doing this in a way that does not unnecessarily hamper your current productivity – but of course, no pain no gain.
  • So some of the more interesting  and .NET-centric tools mentioned – and let’s throw in a geek quiz, how many of these did you know:
    • Launching programmes rather than navigating – I personally use Launchy and can’t recommend it enough. Used to have about 18 quick launch icons, now I auto-hide the task bar (you will need the alt-tab extender mentioned below to really have fun with this).
    • Interestingly (and correctly I think) Mr. Ford does not recommend keyboard shortcuts for programmes – because these inevitably starts clashing with various programme short-cuts (especially in VS where the list of shortcuts is longer than your legs).
    • Tab completion in DOS and the Win explorer address bar – and ALT+D to access the win explorer address bar (and IExplore as well)
    • Clipboard history, copy a load, switch then paste a load. I installed and am now using the recommended CLCL – and it’s good, recommend it! One thing to note is that CLCL allows you to use keyboard shortcuts to paste from the clipboard list – but the num-pad keys do not work with this.
    • Mr. Ford like his command prompt, and sees this as more direct form of interaction with the OS. Couple of interesting gimmicks mentioned:  DOS up/down key for command history, I was not aware thatF7 allows you to actually navigate this (however shortcut keys do not work with F7, bit pants). Also I did not know that you can drag-and-drop files/folder from explorer into CMD to get the path.
    • The Windows Power Toys Alt+Tab Extender is recommended – allows you to navigate those +21 items that you always hit late in the afternoon after the 5th Project Manager (PM) has been over asking you for a quick favour. Also i found that setting the “Show full path in title” in the win explorer folder options works well with this as you can see the path wen tabbing through several Explorers.
    • Windows Power Toys Virtual Desktop is recommended. I am still making my mind up on this one. I can see it’s uses for the late afternoon scenario mentioned above – but it’s a bit of a smoke-and-mirrors tools as you are not really working on separate desktops (obviously, hence the virtual) but simple dividing the taskbar into separate sections. However, I can see it’s use in having a desktop for each task that you are juggling, so I guess I would have a desktop for each PM that I am working with, and then shoot number 5. It installs as a toolbar in your task pane, so enable it from here. I disabled the “Shared Desktops” option – the one limitation then is programs that do not allow multiple instances, these can of course only open in one of your VDs. But try it, it’s interesting.
    • The “Command Prompt Here” Win Power Toy is great – right click a folder and you have a CMD at that location.
    • An open source project “Command Prompt Explorer Bar” available from the excellent CodeProject site integrates the CMD into the bottom of your explorer window and follows your navigation.
    • Funny one – Mr. Ford claims using your programmes (and mainly IDEs I guess) in full screen mode saves mouse time, as you can simply ram your mouse to the top of the screen for the menu, rather than trying to click a specific menu. Bit like being back in the needle factory with Adam Smith really. One wonders how much Mr. Ford actually uses the mouse at all – but he has got a point, those milliseconds all add up, and at the end of the year you could have enough time saved to go and make yourself a cup of coffee.
    • Then we are into IDE shortcuts, learning and then actually making a conscious effort to use these. This is an old todo of mine – I used to have the VS2008 key map as my wallpaper. Funnily enough Mr. Ford actually recommends saying the short-cuts out loud as you use them to reinforce the memory – it does apparently work. 
    • Code Snippets is another one I need to pick up again myself.
    • Then we have recommendation to search rather than navigate when working in projects. Visual Studio gets neglected here so some of my recommendations: make sure you use the “go to definition” and “find all references” right clicks. Ctrl+shift+F is your next bet, but to speed up things you can actually use Google Desktop and the “open folder” feature quite easily (or live search if you’re that brainwashed). Also get used to the bookmarks for bits of code that you might return to.
    • Re-Sharper is mentioned. I liked this a lot, until I had to pay for it, then I stopped liking it. If anyone knows an open source alternative let us know!
    • Then we finish of with Macros, the main aim here is to create re-usable assets. You will of course find support in VS for these as well, thou I can’t say I’ve ever used one. Maybe I will add that as one of my goals for 2009. The excitement. For Windows the AutoHotKey is recommended.

With all these tools there is of course learning involved, and the recommendation is to do this in context, and one tool at a time.

Next in this series Mr. Neal Ford invites us to focus on what we are doing – so this is where we get the PM repellent out I hope.

Some notes on: ASP.NET Web Applications (APress 2008)

In no particular order:

  • Application domains are delimited by Virtual Directories.
    • Changing the web.config or replacing a .aspx or .dll recycles the application domain.
    • Machine config settings can determine application domain recycling based on performance parameters (queued requests/memory usage etc)
    • Shadow copy means that the CLR dll lock is placed on a copy of the dll under the win folder – means requests are fulfilled before recycling, and a new application domain is seamlessly created for new requests (thou session is lost).
  • Global.asax is an example of code using the global Application object – ASP.NET creates a pool of Application objects when a app domain is created. Each request is allocated one of these objects. For this reason any member variables should always be static (i.e shared).
  • Application events can be accesses in the global.asax – Authenticate and Authorize are useful for bespoke user auth logic.
  • ASP.NET Configuration is based on “cascading” xml config files – startng with the machine.config and root web.config in the win .NET folder. 
  • machine.config also holds the machineKey setting for data encryption (viewstate and forms auth cookie webfarm encryption issues, p.177) – example code to create a machine key on p.178.
  • Configuration is inherited, <location> elements can be used to lock a setting which then cannot be overwritten (allowOverride=”false” location attribute)
  • 3.5 web apps have extra bits in the web.config (extension modules for ajax etc).
  • It’s possible to parse and even write config files programattically, for web apps use the WebConfigurationManager as the starting point.
  • WebSite Admin Tool (WAT) uses this approach.
  • Possible to extend configuration structure by adding to configSections and then define classes that inherit from ConfigurationSettings (e.g. WinWin)
  • Extend the HTTP Pipeline using HTTP handlers and modules – handlers were previously (ASP) done as ISAPI extentions, and Modules and ISAPI filters.
  • All ASP.NET requests are handled by httpHandlers which are defined in the root web.config.
  • httpModules are classes that can react to every request the web application gets. ASP.NET’s session state and authentication logic works through httpModules.
  • … 




Random Bits:

  • ASP.NET 3.5 is really just 2.0 with some bug fixes and a few bells and whistles.