Our privacy policy and terms of service have been updated.

LINQ: Clarity, complexity, and understanding

At CareEvolution, we tend to develop using JavaScript on the front end, and C# on the back end (with some Python, PowerShell, CoffeeScript, R, SQL, and other languages thrown in when appropriate or technical debt dictates). We have hackathons every eight weeks where we get to be creative without the constraints of day-to-day work. We have a brown bag lunch talk every Wednesday. We work hard at embracing change, exploring new ways of doing things, and sharing what we have learned with each other. Quite often, leading figures in a particular technology emerge within our organisation: Brian knows JavaScript, Chris knows CSS, Brad knows SQL. While I doubt I know even half of the things about LINQ and its various implementations for database, Web API, or file interaction, I know enough to make it useful in my day to day work and I seem to be the one that employs it most in their code. I know LINQ.

I am certain this is going to sound familiar to many, but while my colleagues and I embrace all things as a collective, quite often a specific technology or its use will be avoided, derided, and hated by some. Whether driven by ignorance, a particular terrible experience, or prejudice1, these deep-seated feelings can create conflict and occasionally hinder progress. For me, my use of LINQ has been a cause for contention during code reviews. I have faced comments like "LINQ is too hard to understand", "loops are clearer", "it's too easy to get burned using LINQ", and "I don't know how to use it so I'd prefer not to see it". And that's all true; LINQ can be confusing, it can be complicated, it can be a debugging nightmare. LINQ can suck. Whether you use the C# language keywords or the dot notation (a debate almost as passionate as tabs versus spaces), LINQ can tie you up in knots and leave you wondering what you did to deserve this fresh hell. Yet any technology could be described the same way when one doesn't know anything about it or when early mistakes have left a bitter aftertaste.

Tabs vs Spaces

In response to these dissenting voices, I usually indicate the years of academic learning and professional experience it takes us to learn how to code at all. None of it is particularly easy and straightforward without some education. Don't believe me? Go stick your mum or dad in front of Visual Studio and, assuming they have never learned anything about C# or programming, see how far they get on writing Hello World without your help. Without educational instruction, we would not know any of it and LINQ is no different. When review comments inevitably request that I change my code to use less LINQ, none at all, or more understood language features like foreach and while loops, it frustrates me. It frustrates me because I usually feel that LINQ was the right choice for the job. I feel like I am being told, "use something I already know so I don't have to learn."

Of course, this interpretation is hyperbole. In actuality, when presented with opposing views to our own, it is easy to commit the black or white fallacy and assume one must be right and the other wrong, when really we should accept that we both may have a point (or neither) and learn more about the opposing view. Since I find, when used appropriately, LINQ can provide the best, most sublime, most elegant solution to problems that require the manipulation of collections in C#, I desperately want others to see that. It is as much on me as anyone else to try and correct for the disparity between what I see and what others see when I write LINQ. So, with my next post we will begin a journey into the basics of LINQ, when to use it2, when to use dot notation over language keywords (or vice versa), and how to avoid some of the more common traps. We will begin with the cause of many confusing experiences; deferred execution.


  1. we all know someone in the "That's new, I hate it" crowd 

  2. even I recognize LINQ is not a golden hammer; it's more of a chainsaw that kicks a little 

Astbury Church

I grew up in England just outside the town of Congleton, Cheshire (the same Cheshire where Lewis Carroll wrote about the Cheshire cat). I attended primary school (elementary school, for my American readers) at a Church of England school in Astbury, a small village dominated by St. Mary's Church.

St. Mary's Church is a giant 13th century edifice and it is old. The earliest known church on the site was Norman though it is possible that before that a Saxon church existed there. Putting aside the rebuilding and refurbishment that has occurred since the 13th century, when you are inside that building, you are inside a building that has been in use for 700 years. It has even survived damage from horses stabled there during the English civil war (though some of its furniture and glass did not). It is old, so old that I find it hard to comprehend how much time that is.

I have many memories attached to the church, including harvest festivals, May Day celebrations, weddings, funerals, christenings, Sunday school, Easter, and Christmas, to name a few. I was a choir member for several years and an altar boy, I was even a shepherd or wise man in a nativity once. Joy and grief, life and death, faith and belief; my earliest memories of these things centre around that church and its grey stone walls.

Conveniently placed next to a pub as seems to be required of all areas of congregation for the English1, Astbury Church, as it is colloquially referred, is an imposing sight. From the A34, the church is accessed via either of two lanes that form the perimeter of Astbury's triangular village green, with its giant oak tree centerpiece and carpet of daffodils, grass, or snow, depending on the season. The ground falls away on all sides, and when viewed from the bottom of the green (and assuming you're not trying to look directly through the tree), the church stands against the sky, its weather-vane atop the steeple often silhouetted against clouds or an early morning sunrise, if you are lucky enough to see it.

When I went to visit my family earlier this year, I visited the church for the first time in quite a few years. With my parents, sister, nephew, and wife, we explored the church and its grounds, reminiscing about the occasions that had brought us there previously. If you ever get a chance, I highly recommend visiting this Cheshire landmark and touching 700 years of history. For now, you will have to settle for some of the photos I took; it is a beautiful building that has been considered by some to be one of the most beautiful churches in the country, and is just as impressive on the inside as it is on the outside (though my photosphere below is not great, it should give you a sense of what it is like inside).


  1. I presume the pub was there first and they just put the church next door for convenience 

My Maps from Google

Google provides some extremely useful online tools that many of us have come to rely on. From Sheets, Slides, and Docs, to Gmail, Maps, and Keep, the advertising giant tends to cover all the angles. The most recent Google tool that I have started using is an improvement over an old service called My Places that started out as a part of Google Maps. It is called My Maps and provides users with the means to build custom annotated maps. Any maps you create can then be embedded into websites or shared via email and social media1.

When first visiting the site, you are offered an option to either create a new map or open an existing map. Any places you had in My Places are already transferred to My Maps and available to open if you wish.

Initial view after creating a map
Initial view after creating a map

Creating a new map presents you with a familiar Google Maps-style view but with additional overlays for editing the map. These are together at the top-left in two distinct groups. The first is the map structure where you can view and edit the name of the map and its layers, as well as add new layers and adjust the appearance of the base map layer. When I tried this, there were nine different base maps available; from left to right, top to bottom these are Map, Satellite, Terrain, Light Political, Mono City, Simple Atlas, Light Landmass, Dark Landmass, and Whitewater.

Map structure with "Base map" menu opened
Map structure with "Base map" menu opened

To edit the map name, map description, or layer name, just click the text.

Dialog for editing the map title and description
Dialog for editing the map title and description

Below the description are options to add a new layer and to share the map. There is also a drop down that provides options to open or create a map, delete, export, embed, and print the current map. Below that, each layer is shown. The layer drop down can be used to rename or delete the layer as well as view a data table of items on that layer. The data table allows you to add additional information about various things that have been added to the map (two columns for name and description are provided by default, but more can be added).

The My Maps toolbox
The My Maps toolbox

Next to the map structure is the toolbox. The toolbox contains a search bar, allowing you to find the area of the map on which to base your customizations. Below the search bar are buttons to undo, redo, select and manipulate, add places, draw lines, add directions, and measure distances and areas. Using these tools, you can build up map layers. When building the Stonehenge map for my blog post on our trip there, I was able to not only search for add mark existing places, but also add custom places. Each item added goes into the selected map layer, which is indicated by a colored bar on the left edge of the layer in the map structure. Clicking a layer changes the layer being edited.

Adding and editing a layer, showing the layer selection bar on the left edge
Adding and editing a layer, showing the layer selection bar on the left edge

The appearance of each item in a layer can be modified, either as a group or individually, by manipulating the styles option at the top of the layer and clicking the paint can icon on an individual item. By editing the layer style, you can also choose which column in the data table for that layer provides text for the items in that layer, and style items based on data in the data table (useful for representing data on the map). There is a lot of scope in this area, so I recommend playing around with it and seeing what works for your specific use case.

Editing the appearance of items on a layer is easy
Editing the appearance of items on a layer is easy

Once you are happy with the map you have created, you can share it, export it to KML (for use in Google Earth and other apps that support KML), and embed into websites. The main share options are familiar to anyone who has shared a document from Sheets, Slides, or Docs, allowing you to share a link to the map as well as control who can edit and view it. If you want to embed the map in a website, an embed code is provided via the map menu, however, as the site will tell you, you need to make the map public before you can embed.

Assigning permissions is consistent with other Google apps
Assigning permissions is consistent with other Google apps

All in all, I found My Maps a pleasant discovery and really nice to use. The styling options and ability to add additional data allow for some impressive customization. I am certainly going to use this application more in the future. How about you? Leave a comment and let me know your experiences with this new addition to Google's collection of online applications, or perhaps add details of alternatives that are out there.


  1. Those planning to use Google My Maps for commercial use should review Google permissions and license terms before proceeding 

Five Things I Did In England That Might Surprise Americans

We all employ stereotypes to generalise groups of people. Often, a stereotype fills a gap between one cultural experience and another, making assumptions about others to provide an easy answer as to why others are different. It is not a particularly constructive approach to cultural differences, often being divisive to the point of pissing people off. Sometimes that is the intent, to troll people, other times it is a side-effect of ignorance.

That's about as deep as I want to get in this blog entry. However, it sets a basis for the following things I did in England that, due to assumptions (stereotypical or otherwise), may be surprising to my North American friends and neighbours.

1. Sound American

To the community I live in, my friends, my colleagues, and my neighbours, I sound British. It does not matter that there's no such thing as a British accent, the distinctions of Scottish, Welsh, Irish, and English (sometimes even Australian) and any variations thereof are irrelevant; we all sound British. Even now, after 10 years living predominantly in the USA, I sound British. Many are surprised that I have retained my British accent after spending so long here. It does not matter how often I might say to-MAY-toe, zee, or gas, to anyone overhearing me talk, I sound British. I believed them too, until I landed in the UK.

Selected languages and accents of the British Isles (CC BY-SA 3.0)
Selected languages and accents of the British Isles (CC BY-SA 3.0)

Everywhere I went, someone was ready to tell me I sounded American, that I had a twang, that I was losing my accent. Now, at first, I put this down to my saying the odd American word or using an American pronunciation, yet after a day or two, after settling back into my native dialect, the comments kept coming. It seems that immersion in US culture for 10 years does make a difference. Worse still, I could not hear it myself. I was so used to the way I talked, I had not even noticed a change, and I still can't. To one side of the Pond, I sound British, and to the other, American. It has left me a little culturally orphaned, a perennial outsider, a citizen of the mid-Atlantic, land of 80's radio DJ's, bad documentary narrators, and people in old movies1.

2. Eat Well

Possibly the most misleading stereotype I hear about the UK is that all our food is bad, awful, bland, terrible, sludge that no one in their right mind would ever let pass their lips. Though we certainly have some unusual dishes that I find pretty horrible (haggis, jellied eels, black pudding, and tripe), I know many who think otherwise, and it is not indicative of all British food. Every culture has its "acquired tastes" that others think are disgusting (Velveeta, Easy Cheese and corndogs, anyone?), but that is no reason to disparage every food that culture has to offer.

While I was back home, I enjoyed some amazing food: a steak and kidney pie at my old local pub, a home-cooked roast chicken dinner from my mum, and delicious chicken curry. "But wait, curry isn't British!" you may cry, but the curries served throughout the UK have diverged from their Indian or Bangladeshi origins to meet the palates of Britons. As American as apple pie? As British as a good curry.

Now, you may cry that I am biased and of course, I am. However, I am also a very fussy eater (ask my wife) and I do not take my food lightly, not to mention that we are all biased when it comes to our food; biased toward what we like. If you want to know if what I am saying about British food is right, you can ask my wife, Chrissy (though perhaps she may not agree on which dishes are best). Whether you believe me or not, be a little more open-minded and a lot more selective. Don't base opinions about British food on what you are told or on a single, awful or obscure meal; instead, get some recommendations, you might be pleasantly surprised.

3. Farm Programming

Contrary to the belief of the Comcast representative that sold me my first cable service, modern technology exists in the UK2. I realise that many people reading this, if not all, are already aware of this.

Shakespeare was not amused at the quality of the earring he bought on Etsy
Shakespeare was not amused by the quality of the earring he bought on Etsy

As our trip to the UK was to be a working vacation, I spent some of my time sat in the lounge of my parents' centuries old farmhouse, coding, emailing, and taking part in meetings. Even in the "quaint"3 English countryside, the modern engineer can push commits to GitHub, attend a conference call on GoToMeeting, and surf the Internet for cat photos. WiFi and broadband are everywhere in the UK; in fact, in some places, the speeds should embarrass Americans, who have some of the most expensive and slowest broadband Internet services in the world.

4. Not Meet The Queen

"And I said, Jeff? Of course I know Jeff!"
"And I said, Jeff? Of course I know Jeff!"

No, I don't know the Queen. I also did not meet your friend that lives in Lower Bumblecrap or your great Uncle Charlie from Arserottingham. What I am trying to say, though perhaps a little harshly, is that the UK is a big place. There are over 63 million people in the UK, over 53 million of them in England alone, one of which is the Queen4. She does not tend to hang around and have personal relationships with her millions of royal subjects. I understand the idea that there is some chance I may have met someone's friend or family member, no matter how unlikely, but when I get asked if I know the Queen (even in jest), I want to escape and go have a real conversation with someone else. Why is a country that fought so hard to get rid of the British Monarchy so apparently obsessed with it?

5. Not Stay

The idea of leaving the gorgeous countryside and history of England to live in the US seems unimaginable to some. Like Madonna, Kevin Spacey, and Tim Burton, many Americans would jump at the opportunity to live in the UK. I can see why, it is filled with amazing people, history, and free healthcare, not to mention everyone talks like Dick van Dyke got elocution lessons, but I lived there for nearly three decades, I've done that. Although my family and many amazing friends are there, I don't fit. I never really fit. The culture of cynicism, the Tall Poppy Syndrome, the overcast weather; it just does not suit me, and in the long term, it doesn't make me happy. Although the US is far from perfect and there are many things I miss from my native land5, since moving here I have been happier, more satisfied, more successful, and more accepted. When we returned to the US, the immigration officer said, "Welcome home," and he was right.

Today's featured image is by Lunar Dragoon and is licensed under CC BY-SA 3.0.


  1. Okay, not quite, but I wanted to include the video 

  2. "Do you have computers in England, yet?" he had asked, earnestly 

  3. This over-used description of the UK, or parts thereof, always feels dismissive, like it's just a theme park 

  4. http://en.wikipedia.org/wiki/Demography_of_the_United_Kingdom#Population 

  5. Worry-free (or at least worry-less) healthcare, pubs (no, they don't exist in the US), proper fish and chips, cask-conditioned ale, and the steak and kidney pies from my old local, to name a few 

A Lush Pilgrimage

Before Chrissy and I went on vacation to England, we were discussing the trip and what we might do while over there (besides spending time with my family). Mid-conversation, Chrissy tilted her head and said, "How far is Dorset from your parents' house?"

"About four hours, why?"

"Have you ever been to Poole?"

"When I was a kid. There's that photo of me with a python round my neck. Why?"

"What photo?"

"I have that yellow sweater on. Why do you want to go to Poole?"

"I don't remember that photo. You've never shown me."

"I swear I have, but whatever. Why do you want to go to Poole?"

"Oh, no reason. Just asking."

"Bollocks. Why do you want to go?"

And it was then that I discovered Poole in Dorset, England is the home of the very first Lush Cosmetics shop and spa.

Chrissy is a lushie1, she has ordered items from Lush Kitchens around the world, exchanged products with other lushies and generally had a jolly good time discussing Lush products over the Internet. For a while, it felt like a new package arrived every day. There were even three packages waiting for us at my parents' house in England. Chrissy loves Lush and the opportunity to visit the spot where it all began was irresistible. So, I planned a trip to Dorset.

Bournemouth

Our hotel. That'll do for a night or two.

A photo posted by Jeff Yates (@jeff.yates) on

I found a hotel in Bournemouth (about 15 minutes drive from Poole), a seaside resort on the south coast of England where my family had holidayed when I was 8 or 9 years old (the same trip I met the python), and made a reservation for a couple of nights. Since we were going to be passing nearby, I also booked tickets to visit Stonehenge on the way back (it's about an hour and a half from Bournemouth)2. It would be a lovely little break, Chrissy could get her Lush fix and I could reminisce about childhood vacations while enjoying the English seaside.

The drive down was mostly uneventful until the very end. After checking in to the hotel, we had to navigate a road closure to find our hotel car park; this turned out to be gated with a key-coded entry and incredibly narrow. So narrow that the only reason I even attempted to drive in was the knowledge that someone must have done so already. So unbelievably narrow, a motorbike might have paused to consider the best strategy for passing through3. After squeezing our way into the car park, we rested up in our room before strolling down to and around the beach and pier.

Across the street from our hotel. The architecture around here reminds me of #Poirot.

A photo posted by Jeff Yates (@jeff.yates) on

The architecture in Bournemouth is indicative of its popularity and growth during the early twentieth century. As we walked around, I was reminded often of the ITV television interpretation of Poirot.

A photo posted by Jeff Yates (@jeff.yates) on

After a windy wander along the pier, we grabbed some fish and chips for dinner, then went back to the hotel for a good night's rest. The next day was a big one; Chrissy would get to visit Lush prime.

Poole

Chrissy stood outside Lush, Poole
Chrissy stood outside Lush

I think Poole is probably most famous for the dolphin-marked Poole Pottery, but it is also the home of Sunseeker Yachts, a log boat preserved with sugar syrup4, a lot of pubs (and I mean a lot), and the very first Lush store. We parked up near the Quay and, checking directions on the map, walked to Lush.

Chrissy's excitement was palpable and photos were mandatory. Within moments of arriving, it was clear Chrissy had found kindred lushie spirits in the staff. When they realised how far Chrissy had traveled to be there, they offered her a tour of the spa and a free postcard as a souvenir of our visit. I do not recall ever being made as welcome in a shop as I was there, and I was only there because I'm married to a lushie.

At the end of the spa tour5, they asked Chrissy if she would like a treatment. She looked at me for encouragement, which, after a very brief moment of hesitation, I gave —how could I deny her this after travelling so far to be here? Within minutes, we were both6 ready to be booked in for their 80 minute treatment known as "The Good Hour", but there was a snag; they could only fit us in the next morning7. This unfortunate delay, we were to learn, was serendipity handing us an opportunity.

With the treatments booked, we headed out to explore Poole. We wandered the quay, saw Sunseeker yachts in varying states of manufacture and repair, admired some exceedingly old buildings, lost count of how many pubs we did not have time (nor the constitution) to visit, bought some gifts from Poole Pottery, and visited the museum. It turned out that Poole was really worth a visit, regardless of the initial reason we were there.

Gorilla perfumes display
Gorilla perfumes display

The next day, we returned to Lush. I do not want to go into details about the "The Good Hour" treatment, if you want spoilers I am certain the Internet will oblige, all I would like to say is that it was fantastic. The massage was excellent, the pirate-theme was whimsical and strangely relaxing, and the conversation with my masseuse, Emma, was thoroughly enjoyable if not a little…different8. After our treatment was over, we were given a nice cup of tea (with the option of a drop of rum) while we relaxed and enjoyed some more conversation with the friendly and lovely Lush staff. Everyone who we met was professional, friendly and chatty.

As we sipped our tea someone said in a low voice, "Mark is in if you'd like to meet him."

Mark was Mark Constantine, the co-founder and owner of Lush. Chrissy did not know what to say at first. Her eyes were wide like a child who just heard the distant chimes of an ice cream truck9. We walked out of the spa into the shop and glanced nervously round the corner at Mark. Megan, one of the amazing staff, stiffened up with nerves. No one was sure who should interrupt the boss and ask him to meet two people from Michigan. They were not intimidated by Mark, they were in awe of him.

"Mark is kind of a big deal," we were told.

Eventually someone got his attention and he came over to where we were stood. We shook hands. Chrissy was grinning so wide that her face sank beneath teeth and eyes. Even I was excited; not only was I getting to meet the owner of the company, but it was possibly the best thing that could have happened on Chrissy's pilgrimage to the Motherlush. The three of us posed for a photo, then Mark went back to his task and we finished up our purchases, ready to head off to Stonehenge. What a great day, it could not get any better.

Then just as we were about to leave, Mark's hand fell on Chrissy's shoulder.

"Wait here, let me get something for you."

Lush Spa and store, High Street, Poole, Dorset
Lush Spa and store, High Street, Poole, Dorset

Mark disappeared upstairs where the Lush labs, responsible for inventing new Lush products, reside. We were informed that much of the work in the labs had been focused on products for the new Oxford Street store10. A few minutes later, Mark returned with a small plastic box containing two sparkly cosmetic items.

"These aren't exactly new. They're existing products packaged in a new way."

As Chrissy nearly passed out from excitement, Megan took the shiny products and, after taking a picture of them for herself (these were new to everyone, it seemed), packaged them up for Chrissy. It was a generous finish to an already fantastic trip, something that I am sure we will talk of often. As we set off on our way to Stonehenge, I reflected on the day and how it would not have been possible on our last trip, when I had not brought my anxiety under some level of control. I could imagine us not getting the spa treatments because I worried about the cost, or because I worried about not making Stonehenge on time11. I could imagine us leaving the shop sooner, to be sure we would make our Stonehenge time-slot, missing our meeting with Mark Constantine and his generosity. Worse still, I could imagine me spilling all these anxieties out all over the place like an untamed fire-hose, drowning them in negativity so that we could never look back on them as the wonderful moments they were.

As it is, our trip to Poole was one of the best parts of our three weeks in England. Assuming Chrissy doesn't drag me off to the newly opened Lush on Oxford Street in London, I look forward to stopping by Poole to pop into Lush and say hello to the friendly staff, and perhaps to take a stab at those pubs.

There are lots of pubs in Poole. We had lunch in one, but there are about 10 almost back to back.

A photo posted by Jeff Yates (@jeff.yates) on


  1. The word used to describe fans of Lush cosmetics 

  2. That's right, the reason we went to Stonehenge was Lush 

  3. OK, that's an exaggeration, but it was bloody narrow 

  4. Sweet! 

  5. I was allowed to tag along too 

  6. Originally, I planned to try one of the many pubs while Chrissy had her treatment, but then I realised it's my vacation too and I deserved a massage 

  7. Each treatment is unique, so the staff need time to setup the room according to the treatment chosen. Ours was pirate-themed…yes, that's right, pirates! 

  8. Look out for the short story or perhaps even seven novel series (with derived movie franchise) I hope to write soon entitled, "The Radiator People" 

  9. actually, they were wide like Chrissy had just heard the distant chimes of an ice cream truck 

  10. Lush Oxford Street was not yet open at the time of our visit to Poole 

  11. It turns out we didn't, but that's not the point