for more information contact firstname.lastname@example.org
Traveling Wilbury’s: The True Story
Sandra Oh’s Career Timeline
All Things Must Pass at 50
A Tale of Two Gravel Races: Kelowna’s Kettle Mettle vs. Northampton’s Reggie Ramble
Salesforce Coding Standards: Variable Names
Subdivions – Neil Peart Only
Feist, The Hip and the Power of Music
You See a Bike – MV Augusta
Moonshiner – Chris Thile
Ah, the Leafs
It’s a poorly kept secret amongst people who really know my taste in music that I am both somewhat dismissive of a lot of the Beatles’ early catalog (say: everything before Sergeant Pepper) and also resolutely convinced that George Harrison was the greatest Beatle. I find the early work naive and uninteresting except as a historical artifact, while pretty much every song George Harrison wrote was a a work of minimalistic genius. I’ll fight for While My Guitar Gently Weeps with my last breath, and while we’re at it let’s talk Here Comes the Sun.
And so, Harrison’s solo opus All Things Must Pass turns 50 this year and November 29th marked the 20th anniversary of his passing. His family has recruited a superstar team as part of a new video for My Sweet Lord. Mark Hamill you say? Yes, we’re watching. Continue to rest in grossly underrated peace, George.
One of the problems with the Salesforce ecosystem is that there are so many self taught developers that there is a lot of messy code out there. It’s not by design that this happens of course-it’s a lack of experience.
A while ago, I was asked by an experienced IT manager if “we had any coding standards for Salesforce” since we were hiring contractors and we didn’t, but it occurred to me that I’d built up a pretty standard naming convention for variables and methods over the years. Why? When I first started writing APEX code, I found it super challenging to read my own code when I looked back over a three month period. So, some guidelines.
List variables contain more than one of something…anything from a simple string to a bunch of Salesforce objects. The rules here are pretty simple: make it descriptive, and make it plural.
Don’t name a list of Accounts acct: go with allAccounts. If the list if filtered to only include partners, allPartnerAccounts is even better. The plural tells you it’s a list rather than a single variable just by looking.
Maps are indexes: they can be an index to anything from single variable to an object to a list or even another map (which always confuses me, incidentally.) For maps choose a variable name that:
A simple example would be a map that converted the ISO 2 Letter Country Code to a 3 Letter Currency Code (Germany’s code DE would point to the Euro’s code of EUR for example, while Japan’s code of JP would map to JPY for the Yen.)
In this example a good name to choose could be currencyCodeByCountryCode
A slightly more complicate Map variable might let you lookup an AccountID based on the Account Name. We’d name this accountsByAccountName
Doing this means when you read your code the word by makes it obvious that it’s a map, and you know what you need to do a get from it. The information is there at a glance, instead of having to dig back through the code to see where it’s declared.
When it comes to single variables, I say do whatever you feel like as long as it’s vaguely descriptive. I’m currently in a the mood so there’s lots of theContact or theAccount floating around. I’m sure I’ll eventually slip into a more traditionally Canadian method of declaration and go with contactEh or accountEh but we’ll see.
I’m a bit of a stickler for a few things in SOQL queries. One is the keywords should be all caps—this helps visually distinguish them field names. The second is to separate fields names on separate field names on separate lines to make queries more readable. It doesn’t do anyone any good to have a query that’s a 2000 character long line of text that can’t be read in the developer console. The third is that for any query with a large volume of fields, sort the fields in alphabetical order (with the exception of Id, which should be the first field.) The fourth is a line break before the From, Where and any other keywords.
So, what that looks like is this:
WHERE Type != null
SELECT Id, CreatedDate, Name, OwnerId, Owner.Name, Type FROM Account WHERE Type != null
Yes this makes code longer, but it also makes code much more readable. The line breaks before keywords let you see the structure of the query at a glance, and the alphabetized fields mean you can find a field name without having to resort to a text search. I’ll choose readable code over short code any day of the week.
So, that’s it in a nutshell. One of the goals while you’re building your Salesforce instance should be to minimize the accumulation of technical debt in advance: following a consistent code standard can go a long way towards making this happen: it helps ensure that when a new developer joins your team, they can get caught up quite quickly.
I was sitting in a bar with a friend when my phone chirped with the news that Neil Peart had died. It was a year to the day that I’d moved back to Toronto, and one of the things I’d noted to friends was the remarkable increase in the amount of Rush I was listening too. Appropriate, really—possibly the greatest band Canada has ever produced (with apologies to The Band, mostly—but not purely Canadian, and the Tragcially Hip, who I would dub the greatest Canadian band and if that doesn’t make sense I can explain.) I was a child of Toronto in the 80s, and Moving Pictures was inescapable. I can remember watching Symphony of Fire fireworks routines set to The Camera Eye.
Subdivisions though…Subdivisions may be Rush’s greatest non-Moving Pictures non-Closer to the Heart non-Spirit of the Radio song (I hate being boxed in, in case you haven’t figured that out.) The video might as well have been filmed in my neighbourhood, and was filmed at the next high school over from mine. Subdivisions resonates—even if, as in this case, you leave out those improbably deep heavy bass notes that open it.
I hope wherever Neil is now he’s drumming alongside the heroes he had—Buddy Rich and Animal chief among them. Neil was the best, and maintained his Canadian niceness until the end.
Smart decisions, if we're honest, not to do one of the big hits. Those belong to Gorg. It's a Good Life If You Don't Weaken is from In Violet Light, which makes it lesser known but that album is a classic.
I still remember when I first heard Feist, paired with Kathleen Edwards on a half hour CBC special while my mother and I were driving all over the praries but for me, this live version of Ron Sexsmith's Secret Heart will always be her greatest moment for complex reasons. It shatters mine and tears me to pieces, but it takes me back to special time. That's what music is.
That I ride motorcycles always seems to surprise some people, though I've done it for years. I'm not a motorcycle person per se--one of those people whose identity is defined by the machine (mine is rather more tied to my bicycles, I think...of which I own three.)
Nonetheless I appreciate the beautiful things the are and the MV Agusta film above shows why many consider the motorcycle the perfect machine. Worth watching.
A long time ago, I was lucky enough to be sitting front row centre at the Punch Brothers' first ever Canadian show at Vancouver's Chan Centre. Chris Thile had just been awarded his MacArthur fellowship, and it was quite a night.
Honestly, I haven't care too much about hockey for a long time. My sports are cycling, tennis and jai alai really--very much non-mainstream in North America. But I am a child of Toronto in the 79s, and so...I am a Leafs fan. It's a burden I bear quietly.
And here we go again: in the playoffs first round, looking promising, despite a horrible injury to star John Tavares. This time--sacre bleu!--against the dreaded Habitants de Montreal, thanks to adjusted divisions caused by the Covid situation. It's like 1979 and I'm 8 years old all over again. The Leafs take an early lead and run the series up to a 3-1 lead...only one win away from taking the series.
And they fall. The Canadiens win two in a row to tie the series and force the leafs into a sudden death winner takes all loser takes nothing series.
It's be shocking, if we hadn't seen it so many times before (hello Boston, and others.) In the end, it's a tale as old as time...a collapse by hockey's richest franchise. A win tonight may come, but it's not deserved. Our confidence is shattered once again gentlemen. Well played.