Fellow Engineering Managers: This is what your job is

As consumers, I think we can identify with the basic principle that we pay for goods and services. It’s how we interact with companies. As employees of a company ourselves, we have an intuitive sense that this is how our customers interact with our product or service:

+----------+      Pays Money        +----------+
|          +------------------------>          |
| Your     |                        | Your     |
| Customer |                        | Product  |
|          <------------------------+          |
+----------+     Receives Value     +----------+

As an Individual Contributor, that is, someone whose work is evaluated based on their own individual output, you might intuitively understand this same dynamic.

+----------+      Pays Money        +----------+
|          +------------------------>          |
| Your     |                        | Your     |
| Employer |                        | Output   |
|          <------------------------+          |
+----------+     Receives Value     +----------+

Note that here I’m saying “your output” and not “your time” for reasons discussed in a previous post: Fellow Engineers: This is where your money comes from.

But… how should a manager think about their job? We know that if you zoom way out, our customers pay us for our product. And, if you zoom way in, we have a company paying an individual for their individual work product. But, managers in the middle aren’t directly in either of these situations. Managers might view themselves as “glue” between the two. Their jobs might feel amorphous. Many managers, particularly new ones have a very hard time evaluating their own performance and success. Although it may not seem obvious, I think a useful framework for thinking about this is staring us right in the face:

               Allocates Resources
 +----------+    Pays You Money      +----------+
 |          +------------------------> Your     |
 | Your     |                        | Teams'   |
 | Employer |                        | Output   |
 |          <------------------------+          |
 +----------+     Receives Value     +----------+

The big shift here is twofold: (1) You are allocated resources beyond a paycheck and tools for individual work: you’ve got other people working at your direction, and (2) You’re now accountable for their collective output.

There are plenty of ways to get lost in the sea of things you’re now responsible for. You might beat yourself up about the fact that you implemented a new story points system but people aren’t estimating well. You might be upset that one of your team members is unhappy about how another team member, or some process, or the company at large. You might in fact think you’re successful because you see your team working very hard. Or, you might think you’re failing because the team is working too hard. You might be stressed out about defect rates, delivery dates, technical debt, work/life balance, quality and quantity of meetings, technical documentation, and on and on and on. Indeed you need to pay attention to them – but don’t forget these are all means to an end.

The end is the collective output of your team. Ideally you have plenty of autonomy and creativity to bring to bear to improve this. But, all of those tactics are in the name of output. If you ever find yourself getting lost in the weeds, focus on things with the greatest impact on your teams’ output.

But, there’s another dimension at work here as you traverse the IC -> manager -> company continuum: The degree to which you decide what you produce (what problem you’re solving), and the consequences of that decision. At the highest level, if a company does not provide a product or service that anyone pays for – they don’t find Product-Market Fit – it dies. The consequences are existential and the vastness of what they could choose to produce is infinite.

At the IC level, you aren’t typically responsible for deciding what problem you’re solving. Your company/boss/product manager explains what it is they’d like you to build, and you operate within that boundary. You attempt to build something that’s high quality, on time, performant, etc. But, if you were asked to build the wrong thing, you’re not accountable for that. Typically you don’t face any consequences for building the wrong thing, since that decision was not your responsibility.

And here we are again, in the middle, as a manager. Not only are you responsible for the collective output of your team, but as your scope increases, so too does your accountability for what problems your team is solving. The question of “are we working on the right thing?” is increasingly borne by you as you move up the organization. That, in fact, may become the question that eats at you on a daily basis more than any other. You’ve learned how to deliver solutions. You can help and advise members of your team to do the same. But… now you also have to start taking ownership of whether you’re solving the right problems.

Most companies fail. Their founders are usually unsuccessful at creating a viable business. But, here’s the good news, managers: you’re not a founder. The odds are not so long for you. You don’t have to deal with an infinite set of possibilities and mistakes are likely not existential. What you need to do is spend considerable time aligning yourself with the business.

In the diagrams above, your responsibility is on the right. The party on the left is the party you need to care about to be successful. For anyone but the top brass, you’ve got a comparatively straightforward answer as to who that is. At a minimum, it’s your boss. But, unlike an IC, your boss is probably not telling you what to do. They’re hopefully telling you what problems they want solved, what metrics they want moved, what products they want shipped. If they’re not telling you that, it’s your job to either extract that information from them, or decide what you think success looks like and ensure they know what problem you’re solving.

Then, execute.

I wanted to stop sleeping next to my phone.

The painting “Mobile Lovers” by Banksy always struck a chord with me. I know I spend a lot of time looking at my phone, and am wary of it being at the expense of experiencing real life. I think it’s a very powerful visual.

Source:Banksy Gives Controversial Mobile Lovers Artwork to Bristol Youth Club

One specific scenario in which I would really like to stop looking at my phone is in bed right before I sleep. There are countless articles about the damage it does to your sleep quality. However, like many people with operational responsibilities at tech companies, there’s the possibility that I could be paged at any time, and those pages come via my phone. Turning it off before bed is not a realistic option. When I wake up in the middle of the night, I will often check my phone to see if I missed anything important. Even with Night Mode on, this is still a fairly big bright light in my face, disrupting my ability to get back to sleep. Worse, I might see some distracting thing that lures me into needless latenight phone engagement.

The reality is I didn’t need all of my phone’s capabilities at night, I just needed to be able to receive critical notifications from specific sources. I knew I still wanted something next to my bed that I could glance at – but Not My Phone.

My idea – what if I had a low-light bedside clock that could show notifications on it? I had a spare Raspberry Pi that wasn’t being put to use. Maybe I could code something up between it and my phone, using Bluetooth or similar. As I started to poke around, I found a solution that was even simpler… a company called Pushbullet had already done 90% of the work for me – they built an app that lets you get your phone’s push notifications via an API. So… I grabbed a domain and notmyphone.com was born.

The case does somewhat resemble a homemade bomb

I picked up this cheap screen & case for the Raspberry Pi since it didn’t look too ugly in the photos. As I later learned, the photos don’t show the power cord, which sticks out the top and looks ridiculous. But, c’est la vie – it worked and can be turned down nice and dim. Since the Pushbullet API supports websockets for notifications, I was able to build an almost completely static site (it’s hosted on GitHub Pages) to serve the UI, and updates are sent directly to the client. The only dynamic part I needed was the OAuth login, which I just built as a Cloudflare Worker.

While I was targeting the 480×320 screen, it’s simple enough that it can really run anywhere, and you can easily test it out in the browser. I wanted it to be able to accumulate a few notifications (it’s coded to store the last 4) in case I woke up and missed more than one thing. They just stack up and the oldest one rolls off the screen as they accumulate.

A neat behavior the Pushbullet API enabled me to add was if you dismiss the notification on your phone, it also gets dismissed from the bedside clock. This way it’s not accumulating things you’ve already seen, assuming you’re away from bed when the notifications arrive. You can also fully customize which apps send messages to Pushbullet via their mobile app, so I’ve tuned it down such that I’m not getting LinkedIn notifications, etc. Only things I deem important enough that I want to see if I wake up at 2am show up on the clock.

Okay, so it’s not a beautiful work of art, but when I go to bed, I put my phone face-down without worry that I’m missing anything. When I wake up in the middle of the night, I can glance at the clock and see that all is well and go back to bed without unleashing a phone-screen’s worth of light into my eyes.

If this is interesting to anyone, feedback & pull requests always welcome. In building this I also developed a Sentry client for Cloudflare Workers to help me debug issues, which you might find useful for your projects. Fair warning: I’m by no means a JavaScript expert.

Fellow Engineers: This is where your money comes from

Recently I saw some rather surprising conversations on Reddit’s /r/cscareerquestions which is generally a great place to talk through different CS Career issues people are having and try to help out.

In a thread about Coinbase mistreating a candidate (a legitimate complaint, it seems) someone made the assertion:

You programmers are crazy with the free work. Someone tells me they want anything over an hour and a half of my time, I will decline.

This was in the context of the interview process, mind you.

Another thread which really got my mind whirring was this one: How can I pursue technical excellence above all else, while still getting paid well? which includes this dilemma:

Ultimately, I want a profitable product to be a byproduct of my excellent engineering, not have my engineering be just a means to an end, of getting to a profitable product.

But, I also want to be paid well.

My worldview is so far misaligned with the framing of these questions that it’s hard for me to engage with them directly. If you’re an engineer building a product or service, and you care about getting paid, I think the most important thing you should be thinking about is where does that money come from?

There are a lot of valid answers to that question, but I think most of the time the calculus reduces to: we get our money from our customers. Sure, you may be early stage and getting paid by investment money for now… but the reason they’re paying you that money is because they’re betting that eventually you’ll have built a real business and customers are going to pay for your product or service.

So, if the money that pays your paycheck can be traced back to your customers… how do you justify getting paid more money? At that point it’s simple… find a ways to impact the value your company is delivering to customers. But, there are a few subtleties here:

  • Your customers are not paying you for your time (slightly different for consultants).
  • Your customers are not paying you for your education.
  • Your customers aren’t even paying you for your individual output.

That last one can be counter-intuitive, but your customers are paying your company for the value your company delivers to them.

If you want to spend your life crafting beautiful code with headphones on, you can absolutely do that. You will get paid just fine for that. But if you’re not influencing others and helping the broader team execute, you’re setting a ceiling on the degree to which you can contribute to the company’s output. All you can contribute is what your own two hands can code.  In basketball, there’s a metric they started tracking in recent years called on-off splits. Simply, it’s meant to capture how much better your team is with a given player on or off the court. I love this metric because it’s an attempt to measure an individual’s impact on a team’s performance with an acknowledgement that individual statistics can’t paint the full picture.

This is why engineering career ladders start to layer in responsibilities for things that a single individual can’t accomplish themselves. This doesn’t mean you need to become a manager, but it does mean you need to look beyond yourself to maximize the value you’re able to bring to the people who are ultimately paying you.

There are other jobs where this is not the case. If you’re a cashier at a store where you have no real control over whether 0 people walk through the door that hour or 100 people, then you’re in a scenario where you’re simply being paid for your time. The value you’re delivering to customers is marginally within your control. In software, this isn’t the case at all. There’s no limit to what you can build, nor a cap on the value you can deliver.

I’m not trying to make a simple capitalist argument here either. Pretend you’re doing open source for free. Do you care if anyone on planet Earth ever uses that library you built? If so, your focus again is going to need to be on the value you’re delivering to your customers. They’re not using it because you put a lot of hours into it. They’re not using it because you went to a good school and read a lot of academic papers. You know this first hand, because you yourself are a user of open source projects and that’s not how you choose them. Subtract the money part of the equation and the premise still holds.

But wait! You may be saying… my job is a lot more like that cashier scenario… I have no control over how many customers walk through our door. And yes, this is the reason why if you care about how much you get paid, you need to evaluate the company too. You know this, and you even do this… but you may not have directly linked these two concepts together. In order for the value you’re creating to be realized by customers, a lot of other components of the business need to be working well. If you go to work on Google search, you’re walking into a situation where they’ve already solved the problem of attracting billions of searches per day. Lucky you – you’re handed an opportunity where you can directly deliver value to users.  However, if you’re joining a stealth startup… there’s a lot more risk there. Is the company solving a meaningful problem for customers? Are we starting with the right featureset? Is our marketing team going to be successful in marketing it, and our sales team to sell it? This stuff has a direct impact on you, because it deals with where your money comes from.

This is why I struggle with scenarios where people discuss pay and work without considering value. If you want to increase your compensation over time, continue to put yourself in a position where you can deliver the most value.

News and Stories

I get a lot of my news from social media. I call it “news” but I’m not sure that’s the right word for it. I get stories. Lots of them.

The thing about feeds of news, like 24-hour TV news, is that they have no beginning or end. I didn’t really notice it before this year, but now I think it’s important.

With published news formats that are constrained to a start and an end, the publisher gives you a huge amount of information just by determining what goes at the beginning. Front Page news on a newspaper, or the Top Story in a nightly news broadcast were very clear signals that you’re getting what the publisher thinks is the most important information. They have a sense for its importance, in part, by reviewing all of the things that happened over some unit of time (last 24 hours, last week).

In a sea of stories on the other hand, it’s extremely difficult to figure out what the “news” is. There’s no step-back and review over a given period of time. It’s on you as the reader to figure out what’s important. As more details unfold and a story is updated, it’s on you discern when to skip a story you’ve already read, or to re-read about a topic that has been revised. In the rush to push stories into feeds, reporters are incentivized to create more stories on less information, and keep publishing new stories as more facts are discovered. Logically, this isn’t a new “topic” but it’s indiscernible unless the reader puts in a ton of work.

Search results, as a reflection of the Internet itself, aren’t much better. If you want to know what the absolute latest understanding is on an event, and you search for it, you’ll just get back a collection of stories again. A few months ago I was trying to understand the details of the Russian election interference controversy. Now, at least, I can link to a Wikipedia page. Enough time has passed that a community of people has been able to piece together something resembling a summary of current information. But, at the time I was lost… all I could find were collections of stories each telling part of the story, and each assuming I already had different bits of context.

I don’t think an unending river of stories is ever going to be a workable way for humans to make sense of the news. I don’t know what the solution looks like, and I don’t think it de-facto requires human curation, but at this moment I think 24-hour news and social media feeds are making it harder to consume information. At present, episodic programs such as weekly TV/podcasts/publications, are the best option I see that’s available.

Facebook… it’s chilly in here.

This morning I read an interesting post from my friend Trevin about the election and wrote a comment in response. His post was thoughtful and not at all combative, in part expressing surprise at the low voter turnout and the makeup of voters, citing:

Clinton won 65% of Latinos and only 54% of women. Even more surprising, Clinton only won 51% of “White women college graduates”.

The comment I wrote in response is pictured below… but you’ll notice the red exclamation point next to it:
post-after

If you read the comment, I think it’s pretty clear that it’s civil… you might even go so far as to say that it’s thoughtful and furthers the discussion! But… you won’t see that comment on Facebook:

post-during

It was “deemed abusive or otherwise disallowed” by Facebook’s algorithms (it was too fast to be done by anything but a machine).

It reminded me of two things:

  1. Mark Zuckerberg calling it a “crazy idea” that the spread of fake news on Facebook influenced the election. Obviously this post isn’t about fake news, but it’s a conversation about how trustworthy polling is. And, Facebook blocked that conversation from occurring.
  2. Having some flashbacks to my time in China where it was well known that WeChat had certain keywords that would get you flagged or banned.

Of course, this could be just a bug. But, it was a good reminder to me that Facebook is not mine. Your Facebook wall is not a blog under your control. Your Facebook messages are not private communications between you and the recipient. Your speech and behavior within their walled garden are subject to their terms and conditions.

I have basically accepted the echo-chamber that comes from seeing things shared from people you already associate with and identify with. But, I’ve been increasingly concerned about digital redlining, and only recently have considered the fact that I’m not even seeing the “real” echo chamber, but some subtly modified version of it.

My China Year

Last year I spent about a third of my time in China. I didn’t post many pictures, I often travelled alone, and I had a difficult time succinctly summarizing what China is like. As a result, I don’t think many people know much about my time in China.

Roughly every 6 weeks I went to China for 2 weeks, throughout most of 2014. I flew Hainan Airlines a few times (which was nice because those flights are on Dreamliners) but ultimately settled in on a regular Delta route, and switched loyalty programs from United to Delta as a result of all of those 11-hour trips. Each time I visited, things got easier to the point where it became a routine.

Before leaving I’d swap out my regular wallet for my “China Wallet”. The flight to Beijing is about 11 hours from Seattle, enough to easily watch several movies. And, in my case, eventually get through most of the Delta movies worth watching and start bringing my own.

China Wallet & US WalletIn flight entertainment

China Standard Time is GMT+8, so it’s either 15 or 16 hours ahead of the West coast depending on our daylight savings. When you fly West to China you cross the International Date Line and lose a day. And, the flight itself takes 11 hours. So… what that boils down to is that when you fly there, you land the next day, a few hours later than when you took off. I always prefer to fly out in the evening so that as soon as I landed in Beijing, I could go to bed. When you fly back, you land the same day, a few hours before you took off. I liked leaving in the morning from China, and would land and go straight to work from the airport. Seeing two sunrises on the same day was strange at first.

Landing in BeijingThe Holiday Inn
My normal beijing breakfastMeat Cake!

My home was always the Holiday Inn Express Beijing Huacai. Truth be told, I really liked it. I got to know many of the people there, I loved the breakfast buffet even if it got tired after 10 consecutive days, and it really did eventually feel like home. On Christmas, I brought everyone candy canes.

It’s big

Having travelled mostly to Europe and South America, I really never appreciated this fact:
CK6aONG

That is to say, when I used to think of “the rest of the world” the places that came to mind are not actually the places that most of the world lives. There are countless mind-boggling facts about the scale of China (and India). There are 15 cities with more than 10 million people (more populous than New York City). There are 170 cities with more than a million people. The US has 10.

Beijing itself is built as a set of concentric circles (“rings”) around the center of the city. The center of the city is The Forbidden City and people don’t live there. I lived up near the green checkmark. To get from there to the forbidden city by taxi would take about an hour. I never felt like I saw “a condo building” – a building by itself didn’t even seem to count as meaningful residential construction. At a minimum, I’d see 4 identical condo towers, sometimes 8. It’s a big city.
Google_Maps

Information

This is CNN when doing a story about Hong Kong Protests

Yes, Facebook, Twitter, and Google are all blocked. The Great Firewall of China exists, and your only way around it is with either a VPN or a foreign SIM card. In fact, a regular VPN won’t even do the trick, you need one that supports additional encryption/scrambling because the GFW can block things based purely on encrypted traffic patterns. I used Astrill and it was great.

The TV in the hotel has a few English channels, including the CNN International channel. However, whenever they would do a story about China, the TV would go black.

In China, you’d use Baidu instead of Google, Weibo instead of Twitter, and WeChat instead of Facebook. You’d shop at Taobao (by Alibaba) or JD instead of Amazon. These aren’t perfect analogs, as the different services have different featuresets, but between them they cover the same sorts of things the US sites do for the western world. These services all operate within the rules of the Chinese government, and implement the required censorship and monitoring. In China you have a vastly different view of the Internet than the rest of the world.

The pollution

Quite bad. People asked me about the pollution… at times, it was quite bad. This is a photo taken from the window of my hotel one morning. I didn’t wear a mask, but many people did. Fortunately, being a 2-block walk from work meant I could stay indoors when the air got this bad.

There are some exceptionally clear days, but overall I think Beijing has a smell to it, that I eventually got used to. The people who live in Beijing and other big cities are aware of the problem and don’t like it. Children get sick and some people choose to move their families to less polluted towns.

The language

Mandarin is by far the most-popular natively spoken language on Earth.

Unfortunately, it is hard to learn. Since it doesn’t have a phonetic alphabet, you basically have to learn how to speak and how to read as two independent activities. Foolishly, I focused on learning how to read, so I had a decent shot at parsing menus. This came in handy when I could point at things, and was useless when I needed to say them out loud. I used Memrise for this, and it was pretty fun. The Chinese characters have interesting origins and it’s fun to try to come up with mnemonics for some of them. For example: 牛肉. 牛 looks a bit like a cow with it’s head over a fence, and means cow. 肉 looks like 2 steaks on a pan, and means meat. Together, it’s the word for beef.

I did not to a good job of focusing on learning the language. I know many people who have done it, but for me it was difficult to prioritize particularly given how often I was coming back to the US.

The food

I tried to eat adventurously. The only thing I really wouldn’t go near were the spiders. Here are some of the more unusual things I ate:

Rabbit Heads

Rabbit Heads

Snails

Snails

Yes, you can order a skewer of spiders. Or centipedes. Or silkworms. At other booths they had scorpions. And starfish.

Tried scorpion (but didn’t touch spiders)

Jellyfish

Jellyfish

Chicken feet.

Chicken feet

Pigeon

Pigeon

Some food seemed adventurous initially, like the fact that virtually all fish is served whole, but it just became normal. I loved the Chinese food. It bears almost no resemblance to American Chinese food.

Spicy Fish

Spicy Fish

Zongzi

Zongzi – traditional food of the Dragon Boat Festival


Baozi

Steamed Buns (Baozi. My favorite.)


They're like pork sliders but on flaky English muffins. Awesome.

Chinese Hamburgers


Hotpot

Hotpot


IMG_20141022_135423

Spicy beef (or pork)

The people

I met a lot of fantastic people in China – both expats and native. On only one occasion did someone come up and ask to take a picture with me, and that was when we were in the Forbidden City on the weekend. People in big cities like Beijing see plenty of foreigners these days, but The Forbidden City is a tourist destination that attracts people from all around China (you can compare it to people from around the US going to Washington, DC).

The most challenging parts of interactions were (obviously) the language, and the customs. People are generally forgiving that I don’t know their customs, ex. sometimes I’d forget and offer/accept something with one hand instead of two. Similarly, I’d find myself forgetting that they don’t share western customs – holding a door open, saying “bless you” when you sneeze, etc. It’s different enough that I never really felt like I was fitting in. Unlike Shanghai which is uniquely international and pretty easy for Westerners, Beijing is a very Chinese city. Most people don’t speak English. Of the people who do speak English, most don’t speak it much better than I speak French (ie. they learned it in school but don’t have much excuse to use it). So, that makes a lot of interactions hard.

I eventually did a fine job at navigating the “happy path” of interactions, but I would get in trouble if things went off course. For example, I can pay a bill at a restaurant, but trouble strikes if they have an issue with the credit card. Or, if I’m checking out at the grocery store and they ask me anything other than “do you want a bag?” by pointing at it.

The sights

Unfortunately I didn’t see much of the country overall. Virtually all of my time was in Beijing, with the exception of one weekend in Shanghai, and one trip to the Great Wall. The urban and rural parts of China are drastically different, and I wish I’d had more exposure to the rural parts.

ShanghaiInteresting BuildingSunrise in Wangjing
The Great WallBeast
Summer Palace

Protip: Discover Cards are compatible with China Unionpay. It’s the most compelling reason to get a Discover Card.

It’s different here

It’s always hard for me to summarize what it’s like in China. One thing that really struck me is that people didn’t look at me as “American” – I was just “Western.” In other words, the differences are so vast that knowing I’m from the West is enough to have a feel for my general worldview, my common customs, the food I typically eat, the fact that I probably don’t speak Chinese, and probably do speak English. Relative to China, Westerners are alike and the differences between Western countries are minor.

I was fortunate enough to get one of the newer 10-year visas before I stopped traveling for business. I hope I’ll have the opportunity to make further use of it.

Posted in me |

On Traveling Cross Country by Train

A few weeks ago I spent a week and a half traveling across the country by train. I enjoy traveling. By that I don’t just mean “going somewhere” – but the whole act of traveling, including long plane rides, airports… the stuff that many people dislike. Though there’s some burden to having to be somewhere at a given time, for the most part the whole act is decision-free. You get on a (plane/train) at X o’clock. You sit in your seat. You can read a book, watch a movie, or use the computer. It’s hard to explain why having a tightly constrained list of options feels so freeing. But, anyone who feels burdened by endless decisions can probably understand what I mean.

California Zephyr Route

California Zephyr Route

I decided to take Amtrak’s California Zephyr train, which starts in Emeryville, California and ends in Chicago, followed by the Capitol Limited which starts in Chicago and ends in DC. I started the trip by spending a night in Sacramento, boarded the train, and made a 1 night visit to Denver, 1 night in Omaha, 2 nights in Chicago, and 2 nights in DC. In each city, I booked hotels but otherwise made no plans.

When you ride a long-distance train (versus a commuter) you have two options: a Coach Seat, or a Roomette. I tried both: got a roomette for my longest leg (30 hours from Sacramento to Denver) and coach seats for the shorter legs.

RoometteWatching Dajarleeing Limited on a train
Ready to depart

The Roomette is designed for two people, so it’s quite roomy. As seats, you’d be sitting facing one another. As beds, he two seats slide down and fold together, and the second bed is the “top bunk” which folds down from the ceiling. It’s comfortable, private, and comes all-inclusive with meals in the dining car. Each sleeper car probably has a dozen rooms, there are multiple bathrooms and showers per car, as well as an in-car attendant (similar to a flight attendant) who sleeps in the car as well.

Steaks on a Train Train meals are considerably better than most domestic flights’. They have a dining car with a kitchen, so the food is cooked to order. The menu is small, though. In 2-3 days you can easily go through all of the breakfast, lunch, and dinner options. The dining car also requires all tables are seated with 4 people, so if you’re traveling alone or as a couple, you’re guaranteed to be seated with other passengers.

Coach Seats The coach seats are not remarkable, again unless you compare them to airplanes. They have considerably more legroom than even a domestic first-class plane seat, recline much further, and there’s an outlet for every pair of seats. The best part though, is that if you’re on an overnight trip, they somehow seemed to find a way for every passenger to get 2 seats. I never had a neighbor for a “redeye” trip. So, you can kick up the legrests on both chairs and make a pretty decent bed.

Surely the sights on the train vary based on the route you take, but here are a few examples of mine… riding though Colorado, and then a sunrise trip leaving Omaha:

While you’re reading, or watching movies, or writing code, you can always look out the window and watch the scenery change.

In each city, I tried to see the kind of sights, and eat the kind of food, that the city is known for. Sportswise, I saw a Rockies game in Denver, a Bulls playoff game in Chicago, and a Cubs game at Wrigley. I had a “Helton Burger” at Coors field, Nebraskan steak in Omaha, a few deep dish pizzas in Chicago, and a Half Smoke at Ben’s Chili Bowl in DC.

Most of the people on these long-haul trains are retirees who enjoy the rumble of the train and aren’t in a rush to get anywhere. Everyone’s quite talkative during dinner, curious where everyone else is from, going to, etc. If you spend time in the “view car” – which is a car with bigger windows, designed just for watching the scenery, you’ll likely find the same type of travelers looking to chat. On the lower-level of the view car is the “snack car”, also known as the “bar car.” I didn’t spend much time there, but I did meet an aspiring hip-hop producer who spent the better part of his journey there.

Some people asked me if it felt lonely. I was somewhat surprised that it did not. I don’t credit my fellow passengers for this, either. I think it’s because -though many stretches of the country don’t have cellular service- you’re still mostly connected. It’s not at all like a long plane ride in that way. If you have a funny experience, you can call or text back home, and get a response. Though you may be away from your friends and family, you’re not disconnected. The balance between “getting away” while still “being in touch” was something I really enjoyed. During the times you are offline, you can take that as your cue to read a book, or watch a movie, or look out the window and doze off. The brevity of your list of options is as calming as the options themselves.

Covariance and Contravariance

The concept of covariance and contravariance is fairly straightforward for basic datatypes, but it gets a lot less intuitive when you start dealing with generic collections. I recently, finally, got my head around it.

Here are some simple cases with simple classes in C# (for brevity, I’m leaving out the rules for basic datatypes). A covariant conversion is when you convert from a derived class to a class that it inherits from. It requires no casting and makes logical sense:
string foo = "foo";
object o = foo; //you can assign an string to an object

A contravariant conversion is the opposite, and assignment requires a cast (which could throw an exception if it can’t be converted):
object foo = "foo";
string s = (string)foo;

Enter Collections

Though it’s obvious that you can convert a string into an object, shouldn’t you also be able to do this?
var strings = new List<string>();
List<object> objects = strings;

The short answer is no. Though converting from string to object is covariant, converting from a List of strings to a List of objects is not. A cast won’t compile either.

Want to see why? You can actually try it for yourself with an array, because an array is covariant (considered by some to be a mistake):
string[] strings = new string[2];
strings[0] = "foo";

object[] objects = strings;
objects[1] = new Object(); //things go BOOM.

This throws an OverflowException because you just tried to put an object into an array of strings. So, when Microsoft implemented generic lists, they didn’t allow you to expose yourself to this mistake, and they catch it in the compiler. That’s where covariance gets tricky.

In fact, contravariance gets tricky as well. To steal part of Eric Lippert’s example here, shouldn’t this compile? (Assuming Giraffe inherits from Animal)
void Foo(Giraffe g) {...}
Func<Animal> action1 = Foo;

This code is trying to make the assertion that the Foo method, which accepts a Giraffe as a parameter implements a delegate which accepts an Animal as a parameter. The problem is, if you actually called action1 with an Animal aside from a Giraffe, Foo wouldn’t be able to handle it and would produce an exception.

But, aren’t there other cases that don’t cause problems?

There are, which is why a number of changes were made to C# 4.0.

In our list/array example… what if you never added elements to the list? Wouldn’t the covariant conversion be safe? You’d never be able to add an object to an array of strings. The answer is yes, which is why the IEnumerable interface is marked covariant. This is perfectly valid (same example as above, swapping out List for IEnumerable):
var strings = new IEnumerable<string>();
IEnumerable<object> objects = strings;

IEnumerable is now considered covariant since it’s interface only exposes methods related to reading.

Similarly useful capabilities were added with regard to contravariance (example taken from here):
static string GetString() { return ""; }
Func strFun = GetString;
FuncobjFun = strFun;

The last line used to throw an exception, however this is actually a safe operation – any caller expecting an object to be returned will also be able to handle a string.

Symptom Solving

There are many things to dislike about American politics, but possibly my least favorite is the degree to which we’ve completely given up on solving problems, and spend time debating solutions to the symptoms. Even during an election year, when there’s no scarcity of big talk, our politicians are largely still unwilling to talk about problems – only symptoms.

Some recent examples:

Health Insurance

There is no shortage of debate about paying for healthcare. There is a very serious shortage of debate around why healthcare is so expensive. There is considerable work that could be done to lower the cost of providing health care and all we’re doing in this election year is assuming the cost is fixed, and fighting about how to pay for it.

Paying for Higher Education

Similar to heath care, this is another case where we assume costs are fixed. However what upsets me the most about this discussion, which also made it’s way into the State of the Union Address, is that we continue to frame it as a conversation about Federal Student Loans. It is absolutely mind-boggling, in the wake of the housing crisis, that someone can make the logical argument that inexpensive, low-interest rate loans keeps costs down. Some (non-politicians) are calling it a Higher Education Bubble. Even if you disagree that the ROI on a college degree is decreasing (that is, what students get out of it is not increasing proportionate to the cost) it is undeniable that making money cheaper drives prices up. Giving students access to cheap money makes it easier for institutions to raise prices. This fact also got a nod in the State of the Union, but it’s been happening for decades and it would be blasphemous for a politician to suggest that the government should subsidize less. No one is talking about the cause of high tuition. They’re only trying to solve the symptom.

Income Inequality

The president called this “the defining issue of our time” and history will regard it as the central argument of the Occupy Wall Street movement. On this issue I’ve heard some discussion on the causes, but by and large even this argument degrades into one about taxation. That is, after the income is already unequal, how do we re-equalize it? Unfortunately this problem is actually really hard, and an across-the-board AMT-style tax like was mentioned in the speech is completely unrelated to the root cause. I don’t believe most Americans #1 issue is income inequality, it’s mobility – their ability to advance (we’re all “temporarily embarrassed millionaires“) which would mean that the conversation has almost no connection to the problem.

These are just a few of the most recent hot topics for which there’s no solution in sight… because the problem is not part of the conversation.