Month: January 2017

On Lateral Thinking

I apply a similar problem solving approach almost everywhere in life, but sometimes that approach fails when I am working on a big challenge or a very hard problem.

I noticed that when I need a new set of tools, I default almost subconsciously to a form of lateral thinking as described by Edward DeBono in 1967.

Uh… Why would I know anything about that in the first place?

In the mid 90’s, my dad, a mechanical engineer, got laid off after working at the same company for 27 years. It seemed very unexpected, and in his true entrepreneurial way, picked himself up, found a partner in crime in a former colleague. They spent months preparing, and eventually began delivering corporate training workshops based on the Six Thinking Hats in the interim while my dad looked for something with benefits.

I’m fairly sure that my dad used lateral thinking himself, because he chose me as his prime experiment subject when testing his curriculum. I was a young teenager then, and I soaked everything in like a sponge.

I encourage everyone to at least read about lateral thinking. While I rarely use the Six Thinking Hats in practice anymore, the critical skill that came from learning about them is that diversity of perspective helps you make better decisions. Knowing what the hats are for and what they represent does come in helpful when brainstorming (or thought showering).

When you’re trying to catch lightning in a bottle, lateral thinking helps you summon the lightning. It’s about the brilliant idea that started off as something others think sounded ridiculous. With lateral thinking, sometimes you really do find a great answer by coming at the problem sideways.

Lateral thinking helps you perform better in some ways. You can:

  • view failures as both disappointing and inspiring
  • arrive at surprisingly creative solutions
  • solve problems faster by considering multiple outcomes for each step
  • see the bright side of every “no” you hear

(it also slices and dices, by the way…)

Naturally, this lends itself well to the software engineer’s mindset and how your work affects the system at large. I remember on the job description for my first role at Microsoft as a technical evangelist, “a keen eye for less obvious opportunities” was a listed skill.

Agile puts perspective at the forefront, with its user stories formulated as “As a <person with a certain perspective> I want to do X so I can Y.”

About half of my work is troubleshooting technical problems with many different types and skill levels of customer engineers, and the ability to actively look for perspectives and inconspicuous solutions is something anyone can agree is a great asset.

Book: Six Thinking Hats by Edward de Bono


Building a simple message popup control for Xamarin.Forms

quizgif.gifA simple solution

I needed a quick way to dynamically display a centered, overlaid message in the quiz app I’m working on for my daughter’s elementary school.

This is just a message for status changes and not meant to be interactable, but it’s usually fired in C# from a ViewModel class or UI click handler because I don’t really care what page I’m on when it’s displayed.

It looks like this (the “Quiz Questions updated” block).

AbsoluteLayout is the secret sauce

I already had most of my layouts built (in XAML), and they had StackLayout roots rather than AbsoluteLayouts. I didn’t want to rebuild them in C# in order to make them inherit an AbsoluteLayout – a great suggestion by Brandon Minnick (@BrandonXamarin), but I’m too late in the process for all that refactoring.

An okay, but not perfect, compromise is this snippet:

public static class Popper
	public async static Task Pop (string message, AbsoluteLayout attachLayout, int showforMilliseconds = 1500)
		var container = new StackLayout
			HorizontalOptions = LayoutOptions.Center,
			VerticalOptions = LayoutOptions.Center,
			BackgroundColor = Color.FromHex ("#DDEFEFEF"),
			Padding = 10

		var label = new Label
			Text = message,
			FontAttributes = FontAttributes.Bold,
			Style = (Style)Application.Current.Resources["PopupText"]

		container.Children.Add (label);

		container.Scale = 0;
		container.Opacity = 0;

		attachLayout.Children.Add (container, attachLayout.Bounds, AbsoluteLayoutFlags.PositionProportional);
		container.ScaleTo (1.0f, 100);
		container.FadeTo (1.0f, 100);

		await Task.Delay (showforMilliseconds);

		container.ScaleTo (0.0f, 250);
		await container.FadeTo (0.0f, 250);
		attachLayout.Children.Remove (container);

What I like about this approach is that I can fire it from anywhere and attach it to any AbsoluteLayout. The message will be added to the absolute layout in the middle, animated, and then removed from the absolute layout.

What I don’t like about it is that I wish this was on my BasePage. The method makes an assumption that there is an AbsoluteLayout root to attach to.

Until I figure out another way of sharing that AbsoluteLayout, this simple solution gets me exactly what I need. Enjoy!