Natural Design Cues

I’m going to further explore the idea of using nature as inspiration for technology, over the course of several posts. This idea has grown tendrils and will take more than one piece to examine. However, I’ve got to start somewhere, so here we go!

The major quality setting human invention apart from nature’s machinery is that humans use non-living materials and nature uses living materials.

Cities are a prime example of this difference. We build our shelters and living spaces using glass, concrete, metal, wood, brick, and asphalt. But this gives rise to the urban heat island – “a metropolitan area that is significantly warmer than its surrounding rural areas due to human activities”. What’s the cause? “The main cause of the urban heat island effect is from the modification of land surfaces, which use materials that effectively store short-wave radiation.” Think of an asphalt road. It sits and bakes in the sun all day, absorbing the sun’s energy, only to slowly emit it later as wasted heat.

Rural areas have more vegetation and other physical characteristics that make it cool more easily. It’s sensible to expect we engineer our cities to be more organic and cooler. We live in nature and its proven technology – billions of years and generations in the making. So we ought to build like we’re a part of it. Luckily, we mustn’t look far for inspiration. We simply need to take our design cues from the living world.

Forests and jungles are good source material. Around the world, they house trillions of individual animals. The forest canopy absorbs sunlight and, through photosynthesis, produces the fuel which the trees use to live. Imagine our buildings productively using the sunlight that falls upon them. Instead of uselessly warming up and later radiating away the heat, we could harness that energy and turn it into fuel. Does this sound like solar panels? Let’s take it a step further: a sunlight-harvesting system which is an integral part of the building’s structure and exterior. Taking in the sunlight’s energy, converting it to some other form, and then transporting it for use in another area. This is exactly what trees have perfected over eons.

The plants in a forest are later fuel for fungi, animals, and other plants. They’re organic and are recycled by the environment when they die. Most of our buildings are nothing like this now. When they become dilapidated or are demolished, they may take many hundred of years to be reclaimed by nature. Investing in organic building materials would make it easier to extract, process, and refine those substances. Organic materials are abundant on the earth’s surface. Metal ore and oils are buried deep underneath it. Renewable components would help reduce worries about waste and pollution, although not eliminate them completely.

And now, what about that heat which accumulates in our urban areas? Forests, again, have an interesting design to consider. Through evaporation and transpiration, vegetation cools the environment and encourages the formation of clouds and rain. Additionally, the canopy provides shade for anything underneath it. The materials in and the processes going on within a forest are naturally aligned to keeping that area cool. Imagine the amount of money and energy we’d save on climate control if we had an environment which both provided shade and actively worked to stay cool. It’s not necessary that our constructions passively absorb massive amounts of heat!

I shouldn’t forget to mention that vegetation produces the oxygen we breathe by consuming the carbon dioxide we emit and exhale. We should be intensely investigating technology which takes in carbon dioxide and releases oxygen. This would go a long way toward correcting the effect we’re having on the global climate.

An organic city based on vegetation-inspired buildings and roadways which releases oxygen and cools the environment isn’t an impossibility. It’s just different from anything we’ve ever made before. We’ve not yet taken our design cues from nature, and it shows.

There’s an enormous amount of effort and money invested in our current foundation, making it difficult to step back and re-imagine our technology. Fortunately, human spirit, will, and curiosity are powerful motivators. We can study nature’s design now, and build a more sustainable foundation for our civilization and the other creatures we share this planet with.

Nature as Technology

In my last post, I talked about how lawns are odd. But grass is nice. It can take wear of travel, is soft to the touch, and keeps mud and dirt off one’s feet. Dirt and other items fall through the blades of grass, which keeps the walking surface clean. And it helps make a home more comfortable.

But the inside of a dwelling doesn’t get much direct sunlight and water, so we invented something artificial to simulate grass – carpet.

Carpeted homes which are closed to the outside environment miss out on some natural benefits of grass. Sunlight, rain, and the plant’s regular living functions keep it clean. Dirt and other debris can be carried away by the wind, or by other animals. Nature doesn’t need a vacuum cleaner because the system cleans itself. Instead, in our closed, non-living systems, we have to keep the carpets clean.

Grass (and vegetation in general) can make an area cooler. Through a process called transpiration, a plant releases water into the air around it, which cools the plants, and, as a result, its surroundings. Transpiration works similarly to how sweating keeps us cool. Because the materials we use in carpets don’t actively cool themselves, we have to resort to other methods, like fans or air conditioning.

Grass is self-healing. It repairs itself as it gets injured. Carpet just wears and frays. Grass also replenishes and spreads itself through seeds. Carpeting must be replaced occasionally and you can’t grow more carpet from your existing floor.

There can be downsides to grass, however. Bugs and creatures live in grass and we find some of them annoying. Especially if they bite! Carpet can host pests, but it’s less likely since the carpet isn’t much of a food source or habitat. And grass can be worn down quickly, if the same path is followed. This is how trails in forests are established – just walking them a lot.

A popular architectural theme these days is that homes and buildings are more open and allow in more light. We incorporate an increasing number of natural elements within our homes. I see homes of the future using grass instead of carpeting. They’ll’ve been engineered to let in light and breezes, water the ground, provide nutrients in the soil, and reduce the incidence of pests. We’ll take advantage of the benefits of grass, particularly the natural cleaning and local area cooling, and still have a comfy living space.

Humans have a lot of technology, but we can’t emulate the most basic features of living organisms. We need to learn how to take existing, proven technology (living things) and adapt them to fit our specific needs.

How many times have humans spent years working toward ideas like home-cooling-carpet or self-healing-carpet, only to later realize they’ve just reinvented something that already exists in nature? Instead of reinventing the wheel, let’s use the ones we’ve got and build a vehicle on top of them already. We’ll get a lot further, faster.

Odd Lawn

I watched someone spread grass seed on their lawn recently. It made me realize how odd lawns are. A green lawn has been considered a staple of American homeownership. People spend significant amounts of time and money each year on their lawn’s upkeep. Including things like spreading grass seed. But wait, isn’t grass a plant? Won’t it produce its own seeds which could fall on the ground to grow yet more grass? Yes! Except we don’t let grasses grow tall enough to produce seed, so instead we purchase grass seed at a store and spread it by hand.

We take a plant that could grow and reproduce on its own and chop it short to have an aesthetic appeal, even when there are muddy patches nearby. This idea is a strange relic from an age when lawns signified wealth and the ability to use land for nothing productive. Equally perplexing is that, here in Denver, we use a plant type which is not designed for the semi-arid climate of Colorado.

I’m not the first person to think these thoughts. That’s encouraging though, because there are a good number of resources on alternatives for lawns.

If I decide to one day be a home owner, I’ll take these alternatives into consideration. I remember back to the days of being a kid when I would often mow the family lawn. I hated that chore. There’s no way I want to do that myself now or suffer some young kid the same fate I dreaded.


Lately, I’ve had the good fortune to do some traveling.

From March into April, I spent three weeks in Paris. While there, I explored the city, and took in an enormous amount of the new culture, sights, and cuisines. This wonderful city saturated my senses in nearly every way, and I absolutely loved my time there. Each day was full of fresh and invigorating activities. Fortunately, I was able to enjoy things at a slower pace than vacations I’ve been on, and even fit in a fair amount of reading time.

Shortly after I got back to the States, I traveled to Florida for two weeks for work. This trip involved a lot of work hours, but also checking out local restaurants and beaches with my coworkers. Once more, the day’s hours were filled and there was little down time.

These recent weeks of travel have brought about a realization: when I’m busy – be it socially, traveling, or with work – my creativity slows down. I absorb so much new material that my mind is completely devoted to processing this incoming stimulation. There’s less time for the brain to wander and think and drive that creative urge.

In contrast, when I’m in a familiar environment and working in a routine, I’m more on autopilot. My mind has more free capacity and can work on ideas in the background. One of the best manifestations of this is the shower eureka.

My creativity doesn’t happen with the same intensity and regularity when I am learning or socializing or adventuring.

I’ve read an article which mentions that time slows down as the brain takes longer to process the situation. I’ve noticed this to be true for things like vacations. But I’ll go one step further and say that, as the brain takes longer to process new information, it has less time for creative endeavors.

Creativity comes from a routine where my body and brain are on cruise control, where my mind is left to think on other things in the background. Creativity happens on the cusp of boredom.

As much as I enjoyed my recent travels, I’m also looking forward to being back home, settling back into a routine, and finding that creativity again.


Tonight, as I took a walk, I looked up and watched the clouds and the sky. While I watched, the clouds seemed static. Sure, a couple clouds raced across the sky, but they were the exception.

So, the sky at any given moment, even though I watched, appeared static. But I’d look away – for just a minute – and, I could tell, once I looked back, that the clouds weren’t static at all. They had moved and grown and morphed.

The clouds are always there. But they’re also always changing.

It’s hard to watch clouds in the sky and say, “Aha, right there. That’s when they changed.” But it’s easy to say, “Yes, the sky has definitely changed since a minute ago.” The rate of change for clouds is below my threshold for noticing. So I have an inability to see change as it happens, but have the ability to notice change after it has occurred.

Colors are similar in this regard. Look at a gradient of black to white. At any given point in the gradient, it’s hard to say the color on the left is different from the color on the right. But I can compare the left-most edge to the right-most and see they are clearly different. I have a hard time perceiving the change at any given point, but to contrast the two ends is easy. You can see a live demo of a page slowly fading from black to white that illustrates this effect.

This reminds me of the “heap of sand paradox”. Start with a heap of sand. I can take away one grain of sand and it’s still a heap. But if I apply this same step many, many times, I eventually have only one sand grain left. And a single grain isn’t a heap, is it? But when did the heap become a not-a-heap? This is called the sorites paradox. The sorites paradox, though, stems from the ambiguity of natural language. Whereas the “static sky paradox”, as I’ll call it, stems from my inability to perceive a change below a certain threshold.

Wikipedia again has an interesting article about the just-noticeable difference. It’s “the smallest detectable difference between a starting and secondary level of a particular sensory stimulus”. It’s quite interesting to see these clouds as a real-world way to notice this phenomenon, outside of a controlled test environment.

This observation makes me wonder in what other ways, particularly mental or psychological, am I unable to witness a change (for good or ill) while it happens? Even when I look back, can I see only that something has changed, but not the point at which that change occurred?

Most individual days sit below the difference threshold, such that I can’t pick out on which day something changed… only notice later that it has. Can I become more aware of this fact and lower the threshold so that I can be aware of, observe, and potentially act to affect change as it happens? The alternative is to submit to a force that is inevitable, inescapable, and invisible. And that is hard to swallow.

Deep Each in Ruby

I’ve got a project where I’m using a multidimensional array to represent a grid. It’s conceptually simple. The grid would look something like this:

|  1 |  2 |  3 |  4 |  5 |
|  6 |  7 |  8 |  9 | 10 |
| 11 | 12 | 13 | 14 | 15 |

Effectively, the single outer array has three inner arrays.

two_d_grid =
    [ 1,   2,   3,   4,    5 ],
    [ 6,   7,   8,   9,  10 ],
    [ 11, 12, 13, 14, 15]

My goal is to iterate through each cell in this 2D grid and process the cell. And that could be done like so:

two_d_grid.each do |row|
  row.each do |cell|
    puts "Cell: #{cell}"

But what about a 3D grid?

three_d_grid =
      [ 1,  2,  3],
      [ 4,  5,  6]
      [ 7,  8,  9],
      [10, 11, 12]
      [13, 14, 15],
      [16, 17, 18]

You could think of this as stacking three planes, one behind the other.

The first plane is closest toward you.

|  1 |  2 |  3 |
|  4 |  5 |  6 |

With the next plane right behind it.

|  7 |  8 |  9 |
| 10 | 11 | 12 |

and the last plane is the one that’s furthest back.

| 13 | 14 | 15 |
| 16 | 17 | 18 |

To traverse this array and get each cell, you have to do things a bit differently.

three_d_grid.each do |plane|
  plane.each do |row|
    row.each do |cell|
      puts "Cell: #{cell}"

For every dimension you add to the array, you have to add another nested each call. This isn’t very extensible. Not to mention, this approach doesn’t work at all for a data structure that’s unevenly nested.

uneven_dimensional_grid =
    [2, 3, 4],
      [5, 6, 7],
      [8, 9, 10]

What I’d really like in an extensible way to iterate through any array and return each cell, regardless of how deeply nested it is.

I’ve lost the original link, and this code is a bit different, but I came across a way to do this using a lamba.

def deep_each(object, &block)
  traverser = lambda do |obj|
    if obj.respond_to?(:each)
    else obj
  end object

This method sets up a lambda. This lambda checks whether the object it’s called with responds to each. If that object does, the lambda calls each, passing in the outer block. If the object doesn’t, the lambda calls the block with that object itself.

Now you can deeply iterate over any any object, if it supports it. And if it doesn’t, nothing blows up.

This will iterate over the 2D grid:

deep_each(two_d_grid) do |cell|
  puts "Cell: #{cell}"

As well as the 3D grid:

deep_each(three_d_grid) do |cell|
  puts "Cell: #{cell}"

And even that uneven multidimensional array:

deep_each(uneven_dimensional_grid) do |cell|
  puts "Cell: #{cell}"

If you wanted to monkey-patch Enumerable(be careful!), you can do that too.

module Enumerable
  def deep_each(&block)
    traverser = lambda do |obj|
      if obj.respond_to?(:each)
      else obj
    end self

Then you could call it like so

uneven_dimensional_grid.deep_each do |cell|
  puts "Cell: #{cell}"

Use this method to iterate over a data structure and process each of the objects contained within it.

Grab the code and give it a test yourself.

Have any feedback about this? Let me know!

Hack on!

The Future Goals Question

Since my last article, a few people have asked a question that’s phrased different ways, but comes back to a central idea.

“What about working toward a goal in the future? I eventually want to do X with my life.”
“Do we need to be unhappy to challenge ourselves for future growth?”
“Are you saying I should be content with where I am and never do anything else?”

The underlying idea is: Can I be happy now, while still wanting something different in the future?

The Future Happiness Myth is a realization that I have much to be happy about and thankful for now. My happiness does not lie in the future. My happiness is always and can only be had now. It’s not meant to make me content to live the rest of my life as I am today.

I’ll jump back to my school experience. Yes, school is a stressful period, but I’d tell myself to better appreciate the experience instead of dreading it, hating it, rushing through it, and only looking forward to being done with it. Of course I had the goal to graduate and become a developer professionally. College is a short amount of time, being meant only to prepare you for the workforce. Of course it would never last indefinitely. It’s necessary to have a goal for once it’s finished. But there’s an infinite difference between hating where you are because you’ll only be happy once it’s passed, and appreciating your phase in life but having a goal once it’s over.

If you’re ever to be happy, you must be happy now. That’s not to say you’ll be happy in this same way forever. The world is changing and we are changing. To ignore that is folly.

Said another way, you must prepare to change and think ahead. Life is a series of indefinite phases. You need an idea of where you’re going. Just remember to appreciate the mile marker you’re currently on.

Unhappiness needn’t be the driving force here. Be happy presently, and take a guess at what will make you happy going forward. Work toward it. Precious little is permanent and unchangeable, so don’t be afraid to take risks.

However, if you are unhappy, figure out why. Unhappiness is a calling to change. It’s not a forever, not if looked at in the right way. Decide what’s literally the next and smallest action you can take to put yourself closer to where you want to be. What will make you happier? It might be part of a larger goal, but a goal is a thousand small actions strung together. Take that first step forward. And that’s immediate. The immediacy is important. It shows you’re already on your way. It shows that your happiness is now and not only at the conclusion of your thousand actions.

Keep on dreaming and work toward your goals. But you won’t appreciate your life later unless you appreciate it now. Take a deep, deep breath and notice your surroundings this moment. Really notice them. That’s one small action toward the goal of appreciating your now.

The Future Happiness Myth

Published on December 26, 2013.

tl;dr: Placing your happiness in the future is dangerous; the future never truly arrives. How can we learn to be happy presently?

Today, I read an article that echoes my thoughts and wanted to finally put them into words.

I’ve had the fortune to read several interesting books this year. Snow Crash, Ishmael , The Selfish Gene, My Ishmael, and The Story of B top the list. They’ve all provided insights into what we are as humans, our nature, and the story of how we came to be. They have jumpstarted my thinking in many areas.

The subtleties of my personality interact in interesting ways. Occasionally, I glimpse behaviors I’ve learned and see how they do not contribute to my happiness. Here, I want to explore one behavior in particular. The tendency to think I’ll be happy, but only at some time in the future.

Our species has the advantage that we can see the present and use it to infer the past and the future. A simple example is a hunter coming across tracks in a forest’s floor. He can observe these prints, deduce the animal’s species, where it came from, and where it has likely gone. This ability to imagine the story of the past and how it continues into the future is uniquely human. While limited in scope, to glimpse the world in this way is to sample the power of the gods with their vast, unlimited knowledge.

This ability powered the success of our ancestors and lead us to where we are today. It can however also go awry. While growing up, I placed a lot of pressure on my self scholastically. I hated learning in the fashion that schools use, but I feared how I did in school reflected on my character. Not doing well in school, meant something was wrong with me. This self-imposed pressure to do well meant I spent a lot of time studying, doing homework, and attending classes. The fear of failing as a person drove me to succeed as a student. I thought the reverse of the fear was true too. If I succeeded as a student, I’d succeed as a person. This fear and the pressure did not make me happy. To the contrary, it made me quite unhappy and angry. “But”, I thought, “I will be so much happier when I am done with high school. When I’ve graduated high school, I will have made it.”

Enter college. Though college was a voluntary choice (however influenced by societal and familial norms), I felt it a necessary evil to pursue my career in software. College was much like high school in the departments of the fears and the pressures I felt, only amplified. I slept little (thinking it a waste of time) and studied my little heart out. I didn’t do much of the socialization others did, because not studying would stress me further. I had to study to get good grades. Without those perfect grades, I was a failure. Again, I was miserable in the present. The only thing that got me through was thinking, “It’ll all be better in the future. Once you graduate and get a job, you will be happy.”

This mode of thinking is tricky though. I’m coining this the Future Happiness Myth. It allowed me to live in the present, however miserably, because I hoped the future would be better. Except, I only live in the present. I never arrive in the future. There’s always a future relative to my present. Even when I get to a time where, in the past, I thought I’d be happy, my viewpoint has shifted, and happiness lies further ahead yet. The future holding that happiness is a long-distant one with no clear path to it.

Even these days, I struggle with this same mentality. I’ve graduated college and entered industry as a Software Engineer. While in school, that’s what I thought would make me happy. But then, I wasn’t happy at that company. So I learned a new technology stack and got a job that suits me better. Now, it’s easy to think I’d be happy after I’ve started my own company. Or I’ll be happy once I’ve written a book. The difference is that I now see how those things won’t lead to me being happy if I don’t know how to be happy. Or if I don’t allow myself to be happy presently.

The largest obstacle to my happiness is my mind. I have literally nothing to complain about right now. I am on vacation, from a dream job, in my parents’ home, with food abundant, spending time with my loving family, and was just given some cool gifts for Christmas. So why am I not elated? Why am I not supremely relaxed? Because I have difficulty appreciating the present. I don’t know how to be happy now. I only know how I’ll be happy in the future.

To date, I can say that I’ve identified an issue. Seen a part of me that I need to work on (one of many). I’m not exactly sure of the steps I need to take to appreciate the present more, but I have identified my Future Happiness Myth. I won’t ever be happy if I keep this same mindset, because the future never arrives. This post is meant to explore the problem. Solving it is another matter all together, and an ongoing project. I hope to unlearn these habits of thought and replace them with new ones which allow me to appreciate my life more.

I have a lot to be thankful for, I can see that. But actually feeling that thankfulness can be challenging. Of the things I’ve tried so far, talking with counselors, meditation/mindfulness, and yoga have made the largest impact on my life. As I enter into the new year, I’m going to give a resolution a try. I will begin practicing yoga again. It’s an activity to center yourself on the now. To recognize and appreciate how you are mentally and physically. This seems like a perfect habit to cultivate if I want to live more in the now.

I know others who have the same symptoms. Maybe they focus on level of physical fitness, or they put up with unhappiness now because they believe they’ll get their true reward in heaven. Our culture perpetuates the Future Happiness Myth by advertising products and services that purport to make you happier. I’ve noticed those fixes aren’t lasting ones. I’m working to be more presently-focused and happy with where I am. To allow myself happiness now. I’m excited and already feel my mood changing for the better.

Refactoring a Ruby Case Statement to a Hash

What follows is a refactoring I discovered recently and have found useful. Recording it here so that I can refer to it in the future and perhaps others will find it helpful. The example is simplified, but I hope it serves the purpose of illustration.

The Setup

I have processing I need to do based on some input. The value of the input determines which class I’m going to use to process it. In this example, I need to chew some fruit based on a code given to me.

The Case Statement Way

The way I’ve done it before was to use a case statement to determine the type of the fruit I need. After that, I can chew that particular kind of fruit. If I didn’t get a code, I don’t chew anything.

def eat(fruit_code)
  fruit_type = 
    case fruit_code
     when 'a'
     when 'b'
     when 'c'
     when 'o'
    end if fruit_type

The Hash Way

But I’ve discovered there’s a more succinct way to do this using a hash instead.

  { 'a' => Apple, 'b' => Banana, 'c' => Coconut, 'o' => Orange }.

def eat(fruit_code)
  fruit_type = FRUIT_TYPES[fruit_code] if fruit_type

I like this refactoring because it allows me to condense several lines of code into one or a few. And it’s apparent, we’re looking up the fruit’s class.


This works when the interface on the classes is the same. The case statement only determines the class type and the processing is the same after that.

I’ve continued to use the case statement way when the number of arguments for initializing each class varies, since it didn’t seem apparent how I could do that in the hash.


Does this seem like something you’d find helpful? Are there other means of accomplishing this goal that I haven’t considered? I’ve love to hear to hear any feedback.

Working with Prose in Vim

Vim for Code

I use vim to write code every day. There’s an established and sensible convention that lines of code should be no more than 80 characters wide. Many people adhere to this convention, and I particularly like it because I can have vim vertically-split on my monitor and see two full-width files right next to one another. This is particularly helpful when working on a spec and its implementation.

Vim for Prose

But what about using vim to write prose? Lately, I’ve been writing some documentation for a feature I’m developing. The documentation is written in Markdown, processed by Jekyll, and in a git repository. With vim’s support of Markdown syntax highlighting, it makes sense to use it as an editor for this documentation.

(You can try vim’s Markdown syntax highlighting with :set filetype=markdown. I’m using MacVim and tried this on a hunch. I was surprised to find it actually worked!)

Code vs Documentation

One main difference between code and documentation though, is that documentation is written sentence by sentence, paragraph by paragraph, where code is generally written line by line, block by block. Normally, I navigate source code with hjkl. In fact, I have my arrow keys disabled. Vim also wraps long lines by inserting soft breaks so I can see all the text on the screen, even if it’s wider than the window.


j and k

But these soft breaks don’t work when navigating with j and k. j and k both work on the hard line, which may be several soft lines. Particularly if you’re writing a paragraph that is all one hard line. Today, I’ve come across two options for solving this issue.

gj and gk

The first option: using gj and gk will move you up and down a line, respectively, while completely respecting soft lines. That’s awesome!

It’s nice because it just works, nothing to add to the .vimrc. The disadvantage here is that it’s now double the number of keys to simply navigate. But at least it’s possible!


The second option: setting textwidth in the .vimrc.

I already had this chunk of code in my .vimrc, but I tweaked it to add markdown.

if has("autocmd")
" For all text files set 'textwidth' to 78 characters.
autocmd FileType text,markdown setlocal textwidth=78
endif " has("autocmd")

This forces all lines to break on whitespace so they are no more than 78 characters wide. This actually works as you’re typing, so you don’t have to manually do it. This is nice because it allows you to use j and k normally because the paragraph you end up typing is made up of hard lines. The downside is that going back and editing a paragraph can be annoying, since it doesn’t always seem to reformat things as one might expect. The hard lines become apparent. Update: Once you go back and edit the paragraph, the formatting might get out of wack. You can use gq{motion} to do format the text to match textwidth again. gq} will format the entire paragraph forward. gggqG will take you to the top and format the entire document. (Thanks @jasonkarns for the tip!)


I came across these two options earlier when looking into how to use vim for writing markdown. Hopefully they help you get a bit more out of vim. I’m hoping I’ll discover some better ways to use vim for prose as I go along. When I do, I’ll be sure to share. Let me know if you’ve got some tricks that would help here. Thanks for taking the time to read!