Friday, September 22, 2006

Foldershare venting

Update: Foldershare is back up and running.  As far as I can tell it was down for a solid eight hours plus...

I started using Foldershare a few weeks ago and really like it.  It allows me to easily share files between my home and work PC's.  [1]

Unfortunately I've started becoming reliant on the system.

Today I intentionally didn't worry about copying files to my iPod (to carry them to work) because I knew that I could use Foldershare to access my home PC from work.  Dagnamit, wouldn't you know it; Foldershare has been down all day.

I still like the service but I hope there's not too many outtages!

As a final thought, I've gotta remember to make software that my users become reliant on.  Not to intentionally lock them in but it indicates that you're providing an invaluable service.  User reliance == success.


[1] It works by running a "satellite" app on both PC's.  You can then access files on the PC (that the app is running on) through a web interface.  So, from work, I can log in to the Foldershare website and view and copy files from my home PC.  Sweet!

Thursday, September 21, 2006

Goto's are evil

OK, so I'm working on some legacy code today when I stumble on a compiler warning: "C4102: unreferenced label". The cogs in my brain started ticking over..."label, label, hmm, what could that be"? Then I took a look at the code. Oh crap. Goto's. In C++. In one function (~100 lines) there were 21 goto calls.

Practically unmaintainable.

Lucky the author wasn't still with the company otherwise I'd have given him an earful.

Mr Duffy you suck.

Registering ASP.NET in IIS

I've tripped over this issue a couple of times so I figure I'd offload it to my blog to free up some space in my head.

The short story:

If you've just installed a new web application to your IIS server and it uses ASP.NET and you're unable to view the web page (specifically you may instead be asked to save a file) then it may be because you need to (re)register ASP.NET with IIS.

You do so like this:

> cd "\WindowsFolder\Microsoft.NET\Framework\VersionNumber"

> aspnet_regiis.exe" -i

The longer story goes something like this:

You install the .NET Framework version x.y.  However you didn't have IIS installed in Windows.  Then you install a web application to your IIS server [1].  Viewing the web app pages [2] confusingly just doesn't work, dammit!  Then you remember the magical register command and voila, birds start singing, sun beams out from behind the clouds and the world is a happy place once more.  :)

MS have also documented the issue.


[1] For me it always seems to be CruiseControl.NET.

[2] Which, for CC.NET, is http://localhost/ccnet/default.aspx.

Wednesday, September 13, 2006

Matt's recommended technical books

A friend of mine in Vancouver asked me to recommend some technical books; Ryan, I may be a little late but better late than never, eh?  ;)  Warning:  This list is quite C++ focussed.

Design Patterns, Gamma et. al.  Let's start with a non-language-specific title (although Smalltalk and C++ are used for examples the languages aren't important).  This puppy is necessary and should be on every developers shelf.  It describes, with methodical detail, the most common design patterns that we encounter - learn them all, and glance at this book regularly as a refresher.  Be aware however that many of the code examples are somewhat dated and can be improved with modern techniques so don't copy them verbatim.  Keep the book close particularly during the design phase of the software lifecycle as it can often simplify your "in the head" design.  If nothing else this book gave the software community a vocabulary to discuss patterns; make sure you can talk the talk.

The C++ Programming Language, Stroustrup.  The father of C++ writes the definitive reference book.  Kinda like K&R's venerable The C Programming Language - but for C++.  This book is great when you can't quite remember certain syntax or you're trying to recall obscure behaviour.  If you have a spare bit of cash opt for the newer hardcover "special" 3rd edition as it'll wear better and has a couple of extra appendices (Appendix E on standard library exception safety is required reading) though both can be (legally!) downloaded.

Accelerated C++: Practical Programming by Example, Koenig and Moo.  For newcomers to C++ (or those coming from a C background), this book is terrific for two reasons:  1) it gives the reader practical examples of how to write quality C++ code and 2) it doesn't shy away from introducing common and useful C++ features (like templates and the standard library) early on.  One of the few C++ books I can recommend to beginners.

Exceptional C++, More Exceptional C++ and Exceptional C++ Style, Sutter.  Herb Sutter is one of the true legends in the C++ landscape and his books are all gold.  Once you're into "intermediate C++" territory, buy his books and read.  Each chapter begins with a question, challenging you to think about a particular C++ topic.  The rest of the chapter thoroughly discusses the answer (Sutter began this format many moons ago with the "Guru of the Week" postings to comp.lang.c++.moderated).  Learn the intricacies of the pimpl idiom, exception safety, memory management and a host of other topics.

Effective C++, More Effective C++, Effective STL, Meyers.  Scott Meyer's 'big three' are a common sight on many programmer's bookshelves.  And rightly so; Meyers has a very appealing, easy-to-read writing style that is well suited to the intermediate C++ devs it's aimed at.  Each chapter begins with a guideline which is clarified over the rest of the chapter.  Don't break the Meyer's guidelines!  Note that Effective C++ has recently been revised (now in the 3rd edition) to better cover more modern techniques - pony up the extra dough if you can though the older revisions are still pretty good.

Code Complete, McConnell.  The "how-to" guide for software engineers.  Language neutral (almost - there are some Java and C++ examples) this book covers a diverse range of topics such as defensive programming, variable naming, software quality, testing, refactoring, and programming tools - just to name a few.  What I like about this book is the depth of research (there are many sidebars with "hard facts" giving convincing weight to claims made by the author) and the logical way that McConnell explains why he gives the guidance he does.  I consider this the Book of Common Sense for Software Engineers.  Many experienced dev's will consider some of what is covered a little too simple but there are so many nuggets in here that everyone should go back and flick through this a couple of times a year.  I do. 

Software Estimation: Demystifying the Black Art, McConnell.  I know of not a single software engineer that can give accurate estimates for projects.  Not one.  Nor do I know of any project managers that have really had a project schedule under control.  This book should be read by everyone in those roles.  It provides techniques to estimate (nay, measure) software effort and lists techniques to help both devs and managers get a handle on how to run a project.  Fantastic stuff!

The C++ Standard Library: A Tutorial & Reference, Josuttis.  A simple recommendation.  If you use the C++ standard library you need this book.  It's the best reference material on the subject there is.  Period.  Buy it.  It covers everything in the library from streams to containers, algorithms and iterators and is suitable for everyone from beginners to advanced users.  Many C++ devs I know use only a fraction of the power of the standard library: don't be one of them.

C++ Templates, Vandevoorde and Josuttis.  A book for any developer really itching to understand the nitty-gritty of how templates work.  High intermediate to advanced users will get the most out of this one.  If you've been confused by template template parameters, partial specialization or Koening lookup this book can help out.  Traits, metaprogramming, template instantiation and expression templates are also covered.  Very complete, very clearly written, very good.

C++ Coding Standards, Sutter and Alexandrescu.  The best description is in the subtitle: 101 Rules, Guidelines, and best Best Practices.  If you're team is using C++ make sure your architect(s) have a copy of this book.  Written by two of the most knowledgeable folks in the industry, every one of these guidelines is gold.  The writing style makes for easy reading; the topics are accessible even while some are inherently complex.  Best suited to low intermediate to advanced users.

Modern C++ Design, Alexandrescu.  The most mind-blowing coding book I've ever read.  Chapter three (Typelists) was a revelation, though I had to read it half a dozen times to begin to understand!  Aimed at advanced users, this will challenge your design skills.  Not only does this book cover many advanced techniques (policy-based design, compile-time programming, traits etc) but it does so with the real-world in mind: at the end you'll have a library (Alexandrescu's Loki library is described and freely available) with many amazing components and implemented design patterns such as smart pointers, generalized functors, object factories, abstract factory and visitor.  Although boost now has some better production versions of these libraries, you'll now know to write your own.  Awesome stuff but be prepared for some challenging topics (although the author does a decent job explaining this stuff it's just hard).

C++ Template Metaprogramming, Abrahams and Gurtovoy.  Another one for the advanced users out there, this book covers the relatively newish world of metaprogramming; developing code in the compile-time space.  Abrahams and Gurtovoy both work on the boost libraries and this book covers many of the techniques developed for the boost::mpl library.  As well as trying to explain the concepts, the book also looks at why you'd want to use them - chapter 10 (Domain-Specific Embedded Languages) really sold it for me; all the tough metaprogramming stuff suddenly became more important when I could see what could be done with the techniques. 

Beyond the C++ Standard Library, Karlsson.  Finally a book that covers many of the wonderful boost libraries.  Although the online documentation will always be the definitive guide, this book is great to pass around to colleagues to introduce them to any of the boost libraries.  Although I would have liked to have seen more examples of when to use the libraries and descriptions of how the libraries are implemented, if you use the boost libraries (You don't?  Why the hell not?) you'll want a copy of this book.  Not a necessary book but good to have nonetheless.

Framework Design Guidelines, Cwalina and Abrams.  The bible for Microsoft .NET devs, this book describes rules on how .NET libraries should be constructed.  Naming conventions, exception usage, common design patterns and many other topics are dissected and rules are clearly stated (with some excellent commentary in the form of inline annotations by many MS gurus).  You can use FxCop to help find the flaws in your designs but then use this book to understand why.  Microsoft use this internally and the .NET Framework is all the better for it.

The Design and Evolution of C++, Stroustrup.  This book is a little out of place.  It doesn't describe any software techniques or languages, nor is it really required reading.  But I couldn't leave it off this list.  D&E describes the history of C++, the design decisions, how it was developed, how it went through standardization.  There are many lessons to be learnt here but, for me, I just couldn't believe that a topic so dry as computer language history could be so damn interesting!  Maybe I'm strange though. ;)


So there you have it, that's my list.  I'm sure I've left a few off there as I've got books scattered all over the place at the moment but that should get you started. 

One book I know I've left out is Fred Brook's Mythical Man Month which is fantastic but I've lost it (just buy it anyway!).  When I find it (or buy a new copy) I'll add it to this list.

Disclaimer:  My only affilliation with these books is that I own them.  I don't personally know any of the authors (though I have had some correspondence with some of them) and I don't get any monentary gain by talking about them.  I just think they're great books.  :)