Tuesday, 18 November 2014

In the absence of interesting content, a filler piece

We don't always get to write good code: sometimes we have the job of thanking someone for their contribution, telling them truthfully and cheerfully: "No, really: it couldn't *possibly* be improved!", and gaffer-taping it together with comprehensible variable declarations and a bit of code-readability work.

Here's a function that will help you with that:
'
Public Function f(Optional Filler As Variant = "") As Double
Application.Volatile False

' Function always returns zero - its only purpose is to 'pad out' expressions for readability
' An option to suppress VBA's habit of excising 'unnecessary' whitespace would be more useful

f = 0

' Coding Notes:
'
' If it is ever necessary for you to use this, leave the following note for your colleagues:
'
'          "There is no hope for us. I am Bricking Up The House From Within."
'
' Code Enhancement: leave an acknowledgement in the code, naming someone you *really* dislike

End Function
Feel free to *not* acknowledge my contribution if you reuse this code.

I do have an acknowledgement for my betters here: the apocalyptic phrase 'We Are Bricking Up The House From Within' originates from Adrian Bott, well known and much-esteemed as @Cavalorn.

He's not a developer: he's a published author of Fantasy and Horror.

Tuesday, 4 November 2014

What's the most useful answer you've ever given?

Last time I looked at Stack Overflow, the most useful answer - or rather, the most read-and-endorsed answer - I've ever given was to a question about copyright notices.

Maybe I'm in the wrong job, and there's better living to be made as an attorney (a Solicitor in England) than being a spreadsheet-basher.

Anyway, the question (and my answer to it) was deleted long ago, so I'll put it here for posterity:

Do you put copyright notices in your (proprietary) code?


The better-organised companies have a copyright notice, pre-generated and added automatically to the header of every code module.

If your employer isn't sufficiently clued-up to ask you, don't bother asking them. It'll be seen as troublemaking, and you'll be blamed for something - anything! - and everything.

Yes, big companies really do think that way.

Meanwhile, put a friendly notice into your code modules and classes to help more junior developers, who might not be aware that (say) code you copied off MSDN or an API published on the web (or some friendly blogger) is almost certainly encumbered with a GPL or CopyLeft License:

' Nigel Heffernan, [xxx dept, xxxyyy company, London] October 2009 ' This code is adapted from material in the Public Domain ' (April 2009 Excellerando.Blogspot.com). ' ' It is unencumbered by copyrights and patents and we can use it freely, ' but we can only assert our own Intellectual Property rights on derived ' works: the original work remains free for public use. ' ' If you contribute distinctive features and original concepts, take care ' to segregate your source code and clearly mark it with our registered ' company name and a link to our copyright license warning.


There is, of course, the old standby:

 If you were thinking of making an unauthorised copy and using it outside the company, don't.     We have a dimly-lit bunker, deep underground, with row upon row of incubation tanks,     each one holding an Intellectual Property Lawyer in a nutrient solution of neurotoxic     venom and the even-numbered isotopes of plutonium that no-one wanted to use in their     nuclear weapons. If you use this software without authorisation, we will decant them     off, one a day, every day, and let them loose with an  unlimited  legal budget until      you are nothing but a radioactive hole in the ground surrounded by safety warnings      and foreclosure notices.   Also, the moment when they open their eyes and stare at you is CREEPY.


I believe there is a older version by Neil Gaiman (a fantasy author, not a coder) with something about bat-winged horrors of the outer darkness.


I worry that mentioning 'Plutonium' has put me on some kind of watchlist, and someday it's going to be difficult to board airliners. But that's all just fine: we're all so much safer because of it, and you're probably on a list too, just for reading this page.

Let me know if you get targeted advertising offering to sell you any, its *really* unfair on the delivery guy.