December 2008 - Posts
A bit of light reading while you digest your turkey sandwiches…
Fabulous Adventures In Coding : Arrays considered somewhat harmful
Eric Lippert argues that "In almost every case, there is a better tool to use than an array.” He argues that arrays lead to poor programming practice and are the enemy of parallelization. He says that with Moore’s Law failing in terms of clock speeds, processors are beginning to grow sideways (more cores) instead of upwards (faster clock speeds) so parallelization will become ever more important in the coming years. He draws the conclusion that arrays are therefore “somewhat harmful”.
Way back in the late 70’s when I began learning computer programming, most languages were procedural. The C programming language was mostly available only on Unix systems and C++ would not be accessible to most hobbyists for another decade or so. Back then, value types were everything (and mostly global) and arrays were a workhorse.
Things have changed a lot since then. Object oriented languages and integrated development environments are the norm, there are classes and frameworks defined for everything. The .net Framework has strong support for collections and generic types. System design is different than back in the late 70s. I can achieve more now, by simply creating a new Windows Forms Project in Visual Studio 2008, than I could do in a week of programming under GEM back in the 80s. I can create a data-bound web application faster than, oh wait, the web wasn’t even invented back then!
I tend to agree with Eric. Whenever I think of using an array these days, it is generally only because I’m forced into it by some third party code. Plenty of APIs that I deal with – and I’m thinking particularly of ASCOM – return arrays or take arrays as parameters. This needs to change. Instead of an array, define a class that encapsulates the data storage. The classic ASCOM example is the camera interface, that returns arrays of pixel values. Better to define an Image object, even if that object uses a private array internally, because that will at least future-proof the interface. There is almost always a better tool than an array.
Those were the words of Steve Knightley, half of a folk duo called Show of Hands that I went to see in Cardiff a few nights ago. “We have CDs on sale”, said Steve, “but if you’re not sure, just ask your friends to give you a copy”. He continued, “It’s not piracy, it’s called generosity”. Read more of Steve’s comments here. Steve says he is thankful to the people that pirate the band’s music and go out of their way to promote the band. In fact, he says the band utterly depends on them.
What a refreshing attitude. Steve understands that each and every “pirated” copy of one of their albums is also free publicity for the band. He understands that people buy when the conditions are right for them and that a copied album is not a lost sale.
The music industry, and perhaps the software industry, need to wake up to this stuff.
By the way, if you get the chance to see Show of Hands, they come with my highest recommendation. They have everything I look for in a music act. Beautifully orchestrated music played by talented musicians who write their own intelligent, emotive and thought provoking material.
Harry B asked me to mention SMB Nation Europe that is happening this Friday, December 5th in London. Still time to register!
http://www.smbnation.com/events_listpage.asp?Category=London~2008&Cat=Category
Agenda
December 5, 2008 – Microsoft Central London
8:30am-9:30am Delegate Registration
9:30am – 10:00am Microsoft Introduction
10am – Noon How SBS 2008 Saved The Economy (Brelsford)
Noon – 1:30pm Lunch and HP (Essential Business Server, HP Partner Program)
1:30pm – 3:00pm Migration Techniques for 2008 (Middleton)
3:00-3:30 Come see how Autotask can help your IT Business Run Better.
3:30-5:00 Migration Techniques for 2008 Platforms (Middleton)
5:00pm End of Day
This one is absolutely priceless. I wish I had half the comic genius of this self-confessed prankster from Australia…
Man tries to pay bill with spider drawing