ThoughtFactory.CreateThought() A random collection of thoughts from an easily bored developer

15Apr/082

Won’t Someone Please Think of the Graduates?

Has anyone else noticed that the example source code given on MSDN and in most books is really, really bad?

Even Fowler's seminal Patterns of Enterprise Architecture shows direct use of ADO.Net Command objects and string based SQL in the code behind file of an ASP.Net page. Check out the Page Controller Pattern on page 333 of Patterns of Enterprise Architecture for an example of what I'm talking about.

How can the industry expect to produce quality work when the information being used as guidance contains absolute worst practice? Should we have disclaimers on all sample sites stating that the code contained within is not best practice, or even something remotely approaching it? Perhaps even graphic slogans and images like those found on cigarette packets. "Writing software like this could cause mass headaches and a loss of budget related continence."

We could even go one step further. Microsoft have a Northwind database, why not a Northwind data access object and Northwind business services layer? Then the examples could stick to what they actually want to talk about (e.g. data binding) instead of having to show horrible code.

Is there really a need to explain how a table adapter works just to illustrate binding collections to a DataGrid? Wouldn't it be better to see something like:

List<Customer> customerList = NorthwindBusinessService.GetCustomerList();

in a data binding example instead of another direct call to the database using a SqlCommand object? They could have a series of MSDN articles explaining how the DLLs were built, and maybe even install them in an examples directory when the Northwind DB gets installed.

It doesn't even have to be deeply layered or highly testable. I'm not asking for something that has appropriate hook points for Unity or that I can use with NMock. Just something nice and simple that everyone recognises as being an example business layer or data layer call.

This issue is especially important given how reliant people are becoming on "the Googles" to provide exact solutions to their problems. How many of you know someone who has cut and paste from CodeProject or MSDN directly into a bound-for-production project? How many have done it yourself?

Don't laugh, it's more common place than you think. Just wait till you see a web application that consists of one form and 15 thousand lines of code in the code behind file. After staring into that particular pit of darkness you begin to realise just how dangerous these examples really are.

9Apr/080

Free as in Books

As I've previously mentioned, my recent purchase of an Eee PC has resulted in an increase to the number of eBooks that I've been reading. This horrible new addiction has lead to a general shortage of reading material that comes in the format I need.

Here in Australia we're a tad behind the times, so I doubt we'll be getting the Kindle or any similar "buy books on the go" service any time soon. Besides, I still can't bring myself to pay full price for an eBook. Can you imagine paying US160 for Don Knuth's Art of Computer Programming series and getting 3 PDFs? I don't think so. How can I let guests know that Knuth is my homeboy if I don't have a huge boxset sitting on the shelf for all to see?

So where does that leave my insatiable thirst for PDF files? Well, it turns out that there are a number of decent eBooks available for free online, the only trouble is finding them.

Googling for "Free eBook" will bring up a number of bogus resources, mainly proxy sites set up to collect Amazon referrer fees or sites that are offering up copyright infringing material. Unless you have a specific subject or prior knowledge it is very hard to sift through the junk.

There are a few legitimate free collections of eBooks, some specialising in technical books, others in classical literature that has fallen into the public domain, but in general these sites are very hit and miss.

The real gems are found scattered over the web, sitting as a reference on someone's blog or a random website. In the technical space there are a few well known books that are well worth a read, such as Mark Pilgrim's Dive Into Python, and Domain Driven Design Quickly. These books are popular for a reason. Then you have books that are not so popular but are written by a well known author, such as Charles Petzold's .Net Book Zero: What the C or C++ Programmer Needs to Know about C# and the .NET Framework.

Sometimes decent reading material just falls into your lap while you're busy trying to do something else. Take Dr Paul Carter's PC Assembly Tutorial, for example. It's a fascinating refresher on x86 Assembly and broader topics such as name mangling and compiler linking, and it was a totally unexpected find on my part. I'm sure I was searching for Pokemon at the time.

At other times you can find something worth reading in an unusual place. Things that are not necessarily "books" can make for good bus fodder. The Sun ONE Architecture Guide is a good example. It is remarkably well written, and also available in PDF format. In fact, manuals and guidance can be a great source of reading material. The SVN book, OpenGL Redbook,
TFS Branching Guidance and TFS Team Development Guide are all available online for free, and are all worth a look (especially the OpenGL Redbook).

With a little effort and a lot of luck you're bound to find something that's work reading. Just be sure to avoid sites advertising "Fr33 3B00kz 4 J00". They may infact try to hack your gibson or something equally scary.

Tagged as: No Comments
8Apr/080

Historical Tomes

It recently occurred to me that I have a rather large collection of technical books. A few years back I acquired the cast-offs of numerous university lecturers who had moved on to bigger and better things (apparently functional programming and early OO research were no longer impressive points of discussion for dinner parties and barbeques), and from there my collection has grown.

Of all the books on my various book shelves there is one particular tome that immediately stands out. That book is the "American National Standard for Information Systems - Programming Language - COBOL". Yes, somehow I've managed to acquire a copy of the specification for ANS COBOL that was approved in 1985. It is the size of a phone book, handily bound and a surely a riveting read. It is a serious crime that its stunning narrative and dry wit have not ensured its place at the top of Oprah's recommended reading list.

Ok, so perhaps I am "enhancing the truth" (or flat out lying) somewhat. Yet, like a car crash, I can't look away. I am eager to begin leafing through its pages, trying to find some nugget of wisdom that will enlighten the masses and lead us all to the promised land. At the very least I'd hope for a few pages of semi-interesting text on a subject I know nothing about.

Or perhaps not.

Tagged as: No Comments
   
Sharing Buttons by Linksku