Keenan Brock

I love my wife, my kids, and ruby.

Sparks

Raw thoughts. Half-baked ideas. The seeds that might grow into stories.

Dropping rails form helpers

It is very common for you to have a form, and then add css classes and a few extra divs and spans to make a form pretty. Rails uses helpers, but other languages seem to do the same. What if you created a custom temple compiler that took user_form.html.pretty and would add the augmentation in a common way? This would convert the form at load time and not run all the helpers at build time. Probably influenced by noting that a jsp just produced a Java Servlet with a bunch of print statements. Think ruby erb is the same.

Columns in the data

In a rails app, it downloads the schema on every app boot, but in production it doesn’t ever change. Seems it would be nice if the developer could just run a command and it would add the attributes to the top of the models. You get the dynamic behavior in development, but don’t have to pay the price in production. The models would work just like regular ruby models. Just with a bunch of attr_accessor at the top.

Yes, there is the 100% up-time examples, where the schema actually does change, but that is a <1% edge case most developers never will use.

Build Time Code

I really like the ideas introduced by Crystal which differentiates between what happens at compile time and what happens at runtime. So if you said attr :special it would add the getter and setter methods for the special attribute when building the file. This makes sense for ruby, too. But often when you load the class into memory, the changes are not quite the same as if it was implemented by bytes on disk. Java has Aspect Oriented Programming, Crystal has macros, and I’m sure others have ways to modify code at load time. Ruby is so dynamic that they don’t seem to have the need to distinguish. I’m wishing they did.

A story by any other name

A story starts with a setting, adds events to get the character to a conclusion. It is hopefully something that the audience can relate with the beginning, how the events change the subject, and how the outcome is released.

Seems an essay, thesis, song, email, presentation, meeting, and others are kinda the same. You want to audience to start at the same spot, and the hear the actions and how they get to a conclusion.

A request for help is a person presenting the starting point and the desired outcome, and asking what changes can be introduced to get there.

Feel like they all have a story arc. Though many people would take offense by me calling an accedemic paper a story, but they are trying to have the reader follow your journey proving your point.

The best html form dsl

We converted a product from jQuery to Angular to React, so we came up with a special json scheme for the forms. Custom form builders like SurveyMonkey also do the same. Lots of them store in a few relational tables: forms, form_fields, form_values, and more.

I really like the idea of storing xhtml in a blob:

<form>
<label>First Name<input type="text" name="first_name" size="20" maxlength="20" value="default"></label>
<label class="right">Secret Handshake<input type="password" name="first_name" pattern="[A-Za-z]{3}"></label>
</form>

In 2008, I used Flash to style and display a custom form from this. The admin could use drag and drop to create this. They’d never know how it was serialized to the database. But the technical debates on features reduces to how much of the spec do we want to implement.

Static Data Models

We use code to iterate over a list of country codes or timezones when generating pages. But we haven’t updated those lists in ages. What would happen if at build time we download the values and populate a file with csv/yml/json or even pre-generated the html? Sure would be a lot less processing than iterating over a list and outputting the values, optionally adding a tag on what is selected.

COUNTRY_HTML=%q{
<select id="country" name="country">
  <option value="can">Canada</option>
  <option value="usa">United States</option>
</select>
}

def display_country_dropdown(value)
  phrase="value=\"#{value}\""
  COUNTRY_HTML.gsub!(phrase, "#{phrase} selected=\"true\"")
end

Preconceptions Shape Stories

When I set the stage for a story, I rely upon other people’s preconceptions and experiences to help me set the stage. Movies do it with the title (Terminator 2), well known actor (Arnold), or trope.

Now if a person hasn’t watched Terminator 1, they their preconceptions coming in are different, and it will change the way they interpret the events of story. They could have grown up in a place that is more violent or more flowers or always rainy.

What they bring into the room changes how they hear the story

Preacher Too Many Examples

Growing up, the preacher had a sermon and it started with a message from the Bible and an anecdote from their life or a popular book. It was nice to get an example. But often he would continued to share anecdote after anecdote, often hitting 5+ examples.

I get that they want to share a store that each person can relate to, but more often than not, it just zoned people out. Wish there was a way to share politely, “You’ve made your point. The horse is dead.”

Front Load Your Point

In a position paper, aka wedge essay, aka Churchill essay, it states a thesis, backup details, and the thesis again. The purpose of the essay is reiterated.

Sure would be nice if emails, meeting requests, presentations, and other communication did the same. Meetings with a proper title and agenda tends to run more smoothly. The goals tend to be accomplished when they are stated, and the attendees can come prepared.

I find it frustrating when 20 recipients of the email have to spend time summarizing because the 1 author didn’t do it properly. Also, it is easier for recipients to act upon the email when the email states the desired action.

Common Sense Isnt Common

Over life we have experiences that shapes the way we view the world and think it works. The experiences help us form rules that we call common sense.

But if not everyone has the same experiences, then not everyone comes up with the same conclusions and developers the same rules.

It is hard to remember that others may not share these experiences and not have a common sense or understanding of the world.

Audience Adaptive Content

Content can adapt to the audience’s declared context.

Audience members can say “I prefer business or tech” and the speaker can focus on ROI vs technology. Or they can say “I prefer javascript or python” to see appropriate code examples. Maybe “I like cats vs dogs” to change graphics and anecdotes. Users could request in realtime a deep dive or a speed up. It would be like interactive fiction, but in realtime. Would probably translate to offline handouts, as well.

Conference WiFi issues may sabotage, as telling the attendee to be distracted.

Inspiration Links

In Stop Drawing Dead Fish, Brett Victor explains that a presentation can be a dynamic tool that assists you much like a guitar does on stage. You use it to create music on the fly, improvising or following a rehearsed story/song.

In Thinking the Unthinkable Thought, he shares that sometimes you need to invent a new language to express new ideas. Much like the Babylonian’s introduction of the number 0 had people thinking differently.