Matthew Jaquish

Audrey in Functionland: Chapter 1

| Comments

In Which Audrey Searches for Mr. Whiskers

One fine Summer day, Audrey was out and about with her white cat, Mr. Whiskers. They always enjoyed a good wander about the fields, searching for sticks and stones and pleasantly shaded trees to rest beneath(and of course, Mr. Whiskers was also looking for mice, but Audrey didn’t need to know).

1
2
3
4
5
6
var whiskers = {
    name    : 'Mr. Whiskers',
    type    : 'cat',
    color   : 'white',
    isHungry: true
};

After a particularly productive afternoon of collecting enough odds and ends to build a small fairy house against the roots of a rather large Oak tree, Audrey sat down and rested her back against the Oak’s trunk. A moment of quietude descended upon her mind and she drifted into a pleasant state(and of course she didn’t let her eyes close for a bit). Suddenly, she sat upright when it dawned on her that she hadn’t seen Mr. Whiskers in longer than she liked.

She leapt to her feet and began a frantic search amongst the field and along the stream. Just before despairing, she noticed a strange motion out of the corner of her eye. There was a jumble of things moving about. But what kind of things were they?

1
2
3
4
5
6
var whiskersLike = [
    {'name': 'name',     'value': 'Mr. Whiskers'},
    {'name': 'type',     'value': 'cat'         },
    {'name': 'color',    'value': 'white'       },
    {'name': 'isHungry', 'value': true          }
];

“Oh my!” exclaimed Audrey. “You certainly seem like Mr. Whiskers, but you really aren’t the same, are you?”

The jumble of things rustled and shifted, but no answer came to her. Audrey pursed her lips and tapped a cheek with her index finger.

“Well, your name is a name, but your value is a name… it’s all together much too confusing. What can we do about it?”

1
2
3
function nameVal(o) {
    return [o.name, o.value];
}

“This looks like it will rescue the things that are Mr. Whisker’s, but we still need to put them back in a proper way!”

1
2
3
4
5
function object(pairs) {
    var o = {};
    pairs.forEach(function (pair) { o[pair[0]] = pair[1] });
    return o;
}

“I suppose this will let us get things moving in the right direction. However, even if we have the right pieces, we still need to solve the puzzle!”

Audrey set about pulling this and that from the jumble of things and mixing and matching them as fast as she could.

1
var whiskers = object( whiskersLike.map(nameVal) );

When she finished the assembly, she sat down and beheld her handiwork.

1
2
3
4
5
6
{
    name    : 'Mr. Whiskers',
    type    : 'cat',
    color   : 'white',
    isHungry: true
}

Mr. Whiskers let out a little meow and purred while he rubbed against her leg. Audrey scooped him up and gave him a twirling hug.

“Mr. Whiskers, I’m so glad that you are back! You must be hungry, so let’s get back home for tea time!”

Audrey paused for a moment and looked over her shoulder at the giant Oak tree. She wondered what exactly happened in that moment she spent sitting against the trunk. As for Mr. Whiskers, he glanced to and fro for a futile glimpse of a mouse.

A Simple Pattern for JSON Model Serialization

| Comments

Over the years I have used a very simple pattern for serializing and deserializing model objects using JSON.

Summary

Provide an instance toJSON function and a static fromJSON function. The static function will leverage the fact that its context is the constructor function. It calls this to create a new instance with the deserialized config data.

Uses

  • Store the model in Local Storage.
  • Send the model as a parameter in a HTTP request.
  • Override the object’s toString to return JSON instead of [object Object].

Example

Below is a bare-bones example to illustrate the usage of this pattern.

A New Perspective on Software Engineering Culture

Over the past year, I have been thinking about software engineering management and leadership. I’ve come to the conclusion that engineering management is quite different than engineering leadership: different people seem to usually be better at one or the other.

It’s Hard to Find a Good Engineering Group

I’ve been on a wide variety of engineering teams during the last fourteen years. Each manager has their own style and approaches problems in different ways. Having a flexible manager is really important because every engineering team is different and the people in the group may change fairly often, resulting in a totally new dynamic created by the new team members.

This led me to think about major problems with most engineering groups that I have encountered: there seems to be no focus on engineering leadership or crafting a group environment that can withstand upheaval or disruption.

A New Perspective

I figured that I would try to identify the root problems that exist in most engineering groups and conceive of a way to potentially fix (or at least mitigate) them. I came up with a list of topics that I believe are important to creating a strong, healthy engineering group that can develop itself into a significant and positive force:

  1. Create a lasting culture.
  2. Focus on craftsmanship and excellence.
  3. Enable mentoring and continuous education.
  4. Foster engineering leadership and ethics.

I believe that it is possible to create a healthy engineering group that people are excited to join by following the ideas above. I plan on discussing each of these in more detail in future posts.

But for now, I have a story to share.

The Inspiration

I am an avid student of history. Several months ago, I was reading some books about the ancient Phoenician culture. If you are not familiar with the Phoenicians, I highly recommend learning about them. They are one of the most amazing ancient cultures that ever existed. The root of many of the things that we take for granted today can be traced back to the Phoenician people1.

As I wound my way through passages of text and ideas, I learned how the Phoenician culture survived many wars, cultural assimilation, political uprisings, shifts in religion, conquerors, and more. Meanwhile, at the same time they managed to continuously improve the standard of living for their entire society, maintain their own unique culture despite the many chaotic environments, specialize in multiple industries, become the best sailors, merchants and traders in the world, and invent a common business writing system that became the basis for all phonetic alphabets: all without maintaining an army! I decided to read more and try and learn how they could have done it.

The results are my ideas on how to use some of the ideas that the Phoenicians seemed to use in order to inspire the next-generation engineering groups in a constantly changing technology world.

Many of the Carthaginian institutions are excellent. The superiority of their constitution is proved by the fact that, although containing an element of democracy, it has been lasting; the Carthaginians have never had any rebellion worth speaking of, and have never been under the rule of a tyrant.

Aristotle The Politics

Footnotes


  1. Such as: Governments that shaped the idea of democracy, the alphabet you are reading, the popularity of purple as a royal color, exploring and mapping much of the ancient world, the art of ship building, the art of stonemasonry and architecture, the dissemination of ideas across cultures, the refinement of trade and business practices, and more!

Ionian Enchantment

Greetings and Salutations!

Welcome to my blog of various musings. Here you might read about anything from software design to ancient history, or philosophy to tea. May your thoughts journey down mental passageways both obscure and illuminating.

We are obliged by the deepest drives of the human spirit to make ourselves more than animated dust, and we must have a story to tell about where we came from, and why we are here. Could Holy Writ be just the first literate attempt to explain the universe and make ourselves significant within it? Perhaps science is a continuation on new and better-tested ground to attain the same end. If so, then in that sense science is religion liberated and writ large.

Such, I believe, is the source of the Ionian Enchantment: Preferring a search for objective reality over revelation is another way of satisfying religious hunger. It is an endeavor almost as old as civilization and intertwined with traditional religion, but it follows a very different course – a stoic’s creed, an acquired taste, a guidebook to adventure plotted across rough terrain. It aims to save the spirit, not by surrender but by liberation of the human mind. Its central tenant, as Einstein knew, is the unification of knowledge. When we have unified enough certain knowledge, we will understand who we are and why we are here.

Edward O. Wilson Consilience: The Unity of Knowledge

For the Inquisitive: