Tag Archives: blaggregator

Making Tea With Javascript: OOP with the Prototype Chain

Javascript is weird.

Prototypical inheritance is really powerful, but it’s quite a bit to wrap your mind around if you’re new to it. My first language was Java, and I’m comfortable with the “traditional” OOP paradigm. In this post, I’ll build a traditional Superclass/Subclass relationship in Javascript in an attempt to untangle the weirdness that is Javascript’s prototypical inheritance model.

All of the source code is available in a repl.it.

Part 1: Superclass Constructor

Let’s brew a cup of tea.

//Superclass constructor
var Tea = function(options) {
    this.color = options.color || "herbal";
    this.caffeine = options.caffeine || 0;
    this.tannins = options.tannins || 0;
    this.minsSteeped = 0;
}

Here, we’ve created a constructor for some tea. This tea can’t really do anything, but it holds some useful information on whatever tea object we create in the future. I can make a cup of herbal tea by calling this with the new keyword.

var myHerbalTea = new Tea({});

 Part 2: Superclass Prototype

Now that we have an idea of how prototypes work, we can go ahead and construct a prototype that will be applied to instances of Tea.

Tea.prototype = {
  steep : function(cup) {
      //caffeine
      this.caffeine = Math.max(0, this.caffeine - 1);
      if (this.caffeine) {
        cup.caffeine ++;
      }

      //tannins
      cup.tannins += this.tannins * this.minsSteeped;

      //color
      cup.color = this.color;

      //minsSteeped
      this.minsSteeped ++;
  }
};

Now we create an object with a single method, steep, and assign that to be the prototype of Tea.  We usually want to put methods on the prototype, so that there’s only one copy of the function shared among all instances (this saves us a lot of memory).

After calling var myHerbalTea = new Tea({}), we’ll have the following inheritance structure:

Prototype Inheritance of myHerbalTea

 

Notice that the Tea function is not part of the prototype chain. It is simply a constructor function used to add the member variables (color, etc) to myHerbalTea. However, because Tea.prototype exists, it is chained to our instance of the Tea class.

Part 3: Subclass

Herbal tea is boring. Let’s make something to wake us up!

//Subclass constructor
var BlackTea = function(){
    //Put instance properties from the superclass constructor on the subclass instance
    Tea.call(this, {
        color : "Black",
        caffeine : 10,
        tannins : 3
    });
    this.hasMilk = false;
}

Here’s where the Javascript magic begins. And by magic I mean less of the Harry Potter and more of the Goat Sacrifice.

Let’s make some black tea:

var firstCup = new BlackTea();

This is another constructor function, composed of two main parts. First, we call the Tea() function, binding to the current instance. The call to Tea will have firstCup bound to this, which will apply all of the instance variables (color, etc), to firstCup. This is kind of like calling super() in a constructor in Java.

Here’s the relevant code. Everything that refers to firstCup when we create it is highlighted red.

var Tea = function(options) {
    this.color = options.color || "herbal";
    this.caffeine = options.caffeine || 0;
    this.tannins = options.tannins || 0;
    this.minsSteeped = 0;
}

// ...

var BlackTea = function(){
    Tea.call(this, {
        color : "Black",
        caffeine : 10,
        tannins : 3
    });
    this.hasMilk = false;
}

var firstCup = new BlackTea();

// ...

Ok, pop quiz. what is currently the prototype of firstCup?

Answer: undefined.

If you thought it was Tea, remember that Tea is just the constructor and is never really a “thing”.

If you thought it was Tea.prototype (I totally did), know that even though we do Tea.call(...), we haven’t bound BlackTea‘s prototype yet, so firstCup.__proto__ is nothing.

Let’s set up the prototype and make a second cup.

Part 4: Subclass Prototype

Remember that the prototype of a class is the object that will be assigned to the __proto__ property of any instances created of that class. So in order to create a second cup of tea, we need to first change BlackTea.prototype.

BlackTea.prototype = Object.create(Tea.prototype);

var secondCup = new BlackTea();

It wasn’t obvious to me at first why we don’t bind BlackTea.prototype directly to Tea.prototype. Instead, we create an object whose prototype is Tea.prototype, and then set BlackTea.prototype to that new, empty object. Our secondCup object can still see the steep(cup) function, but it checks an empty object on its way up the prototype chain. Hmm…

But say we want to be able to add milk to our black tea. (Adding milk to green or herbal tea is icky and we shouldn’t allow our users to do that). If I modify BlackTea.prototype to be able to add milk:

BlackTea.prototype.addMilk = function(cup) {
    //adding milk makes the cup of tea less harsh!
    cup.tannins = Math.floor(cup.tannins / 2);
    this.hasMilk = true;
}

Remember that BlackTea.prototype is not Tea.prototype! It’s an object whose prototype is Tea.prototype. This means that addMilk is only available to instances of BlackTea, not any kind of tea.

Our prototype chain now looks like

withmilk

Yay!

Part 5: Actually Make Tea

//ok, let's make some tea
var myTea = new BlackTea();

var myCup = {
    color : "clear",
    caffeine : 0,
    tannins : 0
};

//steep for three minutes
myTea.steep(myCup);
myTea.steep(myCup);
myTea.steep(myCup);

//add some milk
myTea.addMilk(myCup);

//drink up
console.log(myCup, myTea);

This produces:
myCup is { color: ‘Black’, caffeine: 3, tannins: 4 }
myTea is { color: ‘Black’, caffeine: 7, tannins: 3, minsSteeped: 3, hasMilk: true }

Part 6: Recap

  • Javascript prototypal inheritance is super weird
  • Use the new keyword to treat a function as a constructor
    • The prototype of that function will become the __proto__ of the object, which is where the object looks for methods that aren’t declared locally.
    • Then you can call that constructor (like Java’s super()) using Class.call(object)
  • Explicitly set prototypes to an object with the prototype you want to create
    • e.g. myObject.prototype = Object.create(Constructor.prototype)

I hope this blog post cleared up some of the mystery around prototypes and inheritance!

From Manhattan,

–Erty Seidohl

P.S. Thanks to Ryan McVerry and Julia Evans for proofreading! Also Michael Mulley for helping me understand the WTF-ness of .prototype not actually returning anything on an object.

Notes from PAX East 2015 (Part 3 / 3 – Dungeon Mastering)

I went to PAX East 2015! It was awesome! I took a lot of notes!

(Part 1: Social Stuff)
(Part 2: Making & Selling Games)

Here are the notes from the one talk that I went to on being a good Game Master.

Playing Between The Lines

Luke Crane, Adam Koebel, Sage LaTorra, Thor Olavsrud

  • DMs are authoritative. (this is bullshit)
  • DMs enforce a social contract.
  • DMs organize & wrangle humans
  • THE DM IS JUST ANOTHER PLAYER WITH DIFFERENT RULES.
  • Prep
    • Creating Scenarios
    • Homework
    • Game Design
    • “Lonely Fun”
      • The DM who creates adventures that will never be run. And has a great time doing it.
  • Prep in the most minimal way possible.
  • Find and create things that will drive action.
  • The GM is expected to always be thinking about the game. (this is also bullshit)
  • What does prep look like for…
    • D&D
      • Reading
      • Research
      • Environment Building
      • Narrative Stuff
    • The Great Pendragon Campaign
      • Reading Le Morte D’Arthur
      • Reading about the current period and year
      • Tying in past family events and scandalous rumors
    • Dogs in the Vineyard
      • Towns, Sins, Demons, People, Relationships, Mormons, Guns
      • Play a GM Minigame to create the campaign (Lonely Fun)
      • Use their system for “creating problems”
    • The Burning Wheel
      • Building Characters
      • Developing Relationships, both oppositional and supportive
      • Challenging Beliefs
    • Dungeon World
      • Make shit up
      • Wave hands like muppet
      • Talk in funny voices
      • Buy more copies of Dungeon World [note: the publisher of D.W. was on the panel]
  • 90% of DMing is making shit up (improv)
  • Building a cool world:
    • If you are playing a game with characters, you need to build the map in personal terms instead of locational terms.
    • Your campaign doesn’t exist in a vacuum. Learn to build external media into your campaign. Steal from pop culture. Don’t worry about it as long as it’s fun.
    • Read A Wizard of EarthSea
      • Names are magical. They give things solidity. Going after a +3 broadsword is way less cool than going after Sunbrand, Sword of the Western Hills
      • Use language dictionaries. “What langauge is magic performed in?” (mongolian!)
  • Have a folder.
    • Name List
    • Map
    • Notes
  • DRAW MAPS, LEAVE BLANKS.
    • (JIT DM)
    • Collaborate in worldbuilding with the players
  • Character (NPC) prep:
    • Use the rules. Then fudge the rules.
    • Build opposition to the characters
    • The axiom of antagonists: “They have something appalling that they want, but use methods that the players approve of” or “They have something good that they want, but use appalling methods to achieve it
    • Then take it a step further and make sure the antagonist wants something from the PCs.
  • For any character in the game, you should have 3 things that describe them.
  • Story:
    • Relationship Maps! (example)
    • NPCs should have reactions to player events.
      • “What does your NPC dad think of what your PC is doing?”
      • “What do the rest of the goblins do after you’ve killed their king?”
    • Behind the scenes, or indirect action.
  • rtfm
  • Game Mastering is Learned, Not Borned
    • Skills, not genetics
    • These skills can be taught
    • Anyone can become a GM if they’re not afraid

Notes from PAX East 2015 (Part 2 / 3 – Making & Selling Games)

I went to PAX East 2015! It was awesome! I took a lot of notes!

(Part 1: Social Stuff)
(Part 3: Dungeon Mastering)

Here are the notes from the “how to make and sell games” type talks.

Business Basics for Indies

Dan Adelman

This talk is mostly about video, not board games

  •  Business Strategy
  • Also: What are the barriers to entry?
    • Indie games have a low barrier to entry
    • Marginal Revenue (selling one more copy) > Marginal Cost (making one more copy)
      • Marginal Cost is 0 for video games (i.e. it is free to sell a copy. Thus selling at any price = profit). Except not.
      • Everyone can undercut, leading to a race to the bottom
        • 99 cents is expensive when your competition is free
  • Adelman’s Law of the Games Industry: “Anyone in the games industry to make money is in the wrong place.”
  • Marketing: Helping people who would love your game, find out about your game (not spammy!)
  • Product  Quality of product
    Differentiation from competitors
    Audience Expectations
    Internal Consistency (art, music, gameplay, marketing all aiming for the same audience).
    PlACE/
    PLatform
    Know where your customers are
    What platforms are excited about your game? (They will give you free publicity)
    Where does your game belong?
    PROMOTION  Where does your core audience get their information?
    Establish a relationship with journalists. But! If you are at the point that you need to establish a relationship with a journalist to market your game, you’re too late.
    Price Low low low but don’t undersell yourself. This is tricky.
    Announce in advance when your price will drop so customers don’t feel cheated
    Examine the competition carefully
    Check your audiences’ disposable income
  • The 4 P’s must fit together and be internally consistent; point to the same consumers.
  • Negotiation: Know these words.
    • Specifically, make sure you understand “BATNA”, “Logrolling” vs “Fixed Pie”
  • Never be afraid to ask for a better deal than they offer. Raising your money per game from $2 to $4 doubles your profits and takes a 5 minute discussion if they’re willing.
  • Practice negotiation. Roleplay, rehearse. Make it a conversation. Remove ego.
  • (You have to work with them afterward. If either side gets heated during negotiation, is this really a partnership you want?)
  • Get to know people before you need them (see: Promotion, above). But don’t be disingenuous!
  • Everyone will remember everything you say. Good and bad.
  • Everyone starts at the bottom.

Heads Up: the Art of Interface and Graphic Design in Video Games

Vicki Ebberts, Alexandria Neonakis, Kate Welch, Eric Monacelli

  • Read this article by Anthony Stonehouse
  • Fiction Geometry Notes Example
    Diagetic Yes Yes You and the character can see the same information, in the same way. Pip Boy
    Meta Yes No In-game elements “seen by the character” projected against the 2D HUD Plane Blood Splatter
    Spatial No Yes Elements that you see, that exist in the game world, that are invisible to the character. Floating Money
    Non-Diagetic No No The classic “HUD”, which is removed from the game world and doesn’t exist in the game fiction. WOW HUD
  • New UI problems will present themselves in nontraditional games.
    • Oculus rift is going to be AWESOME AND WEIRD AND INTERESTING
    • Hearthstone is already breaking this model – the entire game is a user interface – there’s almost no “fiction”.
  • What do companies look for in designers?
    • Graphic Design
      • Ability to organize information in a smart way.
      • Ability to organize information in a hierarchy clearly.
    • Being aware of what’s new and fresh, and also what’s out of date
    • Fail a lot and don’t give up
    • Ability to think like a user of any product
  • Process
    • Get clear goals. What problem are we trying to solve? How does this help the player?
    • Sketch out ideas on paper. Don’t discriminate against bad ideas.
    • Whiteboard user flow. Confirmations. Transisions! User Feel. Buttons.
    • Wireframe. Prototype anything new/risky/tricky. Use physical paper to prototype quickly.
  • Pair. Work with a developer until things feel right. User test frequently!
  • If anyone is noticing your UI, then it’s probably in their way.
  • In AAA Shooters, the UI is not the content. In nontraditional games (hearthstone), the UI is the content.
  • Watch playthroughs on youtube to find elements that work well. But make sure it works in your game.
  • Just go on twitter and search #UX and #UI. See what happens.

 Do You Have What it Takes to Publish an Indie Board Game?!

Breeze Grigas, Jeff Gracia, Sarah Como, Eli Kosminsky, Aerjen Tamminga, Luke Peterschmidt

  • Basically the answer to most of your questions is kickstarter but this isn’t a kickstarter panel so we’re going to assume you know that.
  • Why do you want to make games? Is it to quit your job? Make something with your friends? Check “make a board game” off your list?
  • ^^ Answer that question before going further.
  • As a publisher, what is your product line.
  • You don’t need a finished product to approach a publisher. It just needs to play, and show the core idea. You must make it. Test It!
  • If you decide to self publish, you’re going to spend 80% of your time not making games. You’ll spend 80% of your time publishing, and then 100% of your time selling.
  • Remember that the publisher takes the risk.
  • Retail price should be 5x creation cost.
    • 2/5 Retailer
      1/5 Distributor
      1/5 Publisher -> 1/5 of that to you
      1/5 [??? didn’t write this down]
    • Example: $210k kickstarter, had to spend $80k in shipping (incl. international).
  • Find your local game developer cabal and ask them.
  • Go to the Unpub Convention in Florida.
  • “Design toward what you can do”, “Pick something you can execute on”.
  • Get to know Board Game Geek.
  • Read The Characteristics of Games
  • Read The Design of Everyday Things
  • Playing bad games is a great way to make good games.
  • Play games that people love but you don’t like. (“Read 50 Shades, and figure out why it sells. You don’t have to love the actual product to learn something from it”)
  • Give your game to other people, then just sit back and watch! (Blind Playtesting).
  • Three Questions that you should be able to answer for your fictional character in the game / player character in the game:
    • Who are you?
    • What do you do?
    • How do you win?
  • Immersive Gameplay (top down design) > Canvasing (same rules, different art)
  • Listen to Mark Rosewater’s Podcast.
  • Playtest with new people. But also make sure to playtest with the same group for a few times so that they figure out the strategy of your game.
  • You want to hear: “This is fun, and I’d like to play it again.”
  • Play with other designers, and be able to answer their questions about why you didn’t make certain decisions.
  • You can go for an LLC or just a DBA (“Do Business As”). Actually, just get a deleware C Corp. (srsly).
  • YOU WILL PROBABLY SPEND ABOUT $10,000 BEFORE YOU GET TO MARKET. Have this money ready to go when you go to publish.
  • Have a “red button gamer” play your game. (rbg is someone who just wants to blow things up and see what happens – they’ll have different strategies and tactics and might find new ways your game is broken).
  • Go to your local game store with your game
    • Get the best local M:TG players to play your game. They will break it. Retool. Have them play it again. They will break it again. Repeat until it takes them “long enough” to break your game.
  • (Game design tip: Blind Bid events even out the game).
  • Think about weight for shipping!
  • Check out the GameCrafter site.

Birthing Board Games: From Conception to Maturity

Timothy Blank, Donald Mitchell, Lauren Woolsey, Phil Cartagena

  • Find your local game maker’s guild. Join it.
  • Games are made of: Concept, Theme, Components, Mechanics
  • “A good game gives its players interesting choices” — Sid Meier

[this panel wasn’t particularly information dense!]

 

 

Notes from PAX East 2015 (Part 1 / 3 – Social Stuff)

I went to PAX East 2015! It was awesome! I took a lot of notes!

(Part 2: Making & Selling Games)
(Part 3: Dungeon Mastering)

Here are the notes from the “social media / dealing with people” type talks.

Enabling Co-Op Mode

Tracy Hurley, Christine Chung, Georgia Dow

  • Social Identity Theory
    • We need to form groups to survive. We want to protect our group. We like to form an identity with out group. We form “ourselves”, and “belong” to the ingroup. The outgroup is the “other”.
    • We protect our identity as part of our own self-esteem. We think of our ingroup as better than they really are.
    • Now we have globalization which goes against this.
    • Actors in Planet of the Apes took to ingroups that matched their ape costumes.
    • Power and Identity
      • Conflict due to differences in identity
    • It’s the self-esteem connection to identity and connection to in-group (views) that is “the problem”
    • Cognitive Dissonance
    • Social Resources
      • What are they?
    • One of the things to do is contact, actually meet the outgroup to realize that they are more diverse. We see our ingroup as diverse but the outgroup as monolithic stereotypes. (“varied” / “unrealistic” )
    • Just putting people in the same place doesn’t work, but getting them to work together does.
    • Replace the “instance” of the outgroup with an actual human being.
    • Use gaming to reinforce, or, hopefully, break down these stereotypes.
      • Stereotype break down is not about repetition but about diversity of experiences with “The other”
      • Aggressiveness breeds aggressiveness.
    • We want to be seen and accepted. We want our feelings to be seen and accepted.
    • Remember that some [trolls] may be upset about something else.
      • Don’t build up ammo
      • Aim your weaponry, just not at each other
      • Accept that you do not have to agree, to win
      • We don’t have to be right
      • We want peace, space, and reception, if not agreement
    • Look for common ground (what do both people care about?)
    • People who are uncomfortable with uncertainty are more likely to end up in conflict.
    • Use “I” statements, not “You” statements [when dealing with trolls]. Also pay attention to body language (this doesn’t translate well online).
    • Accountability.
    • Don’t feed the trolls?
      • The trolls aren’t ususally actually upset about *this*, but this is the forum in which they express the anger.
      • Games as *escape*, to get away from other *anger*, which follows them into the game.
      • Remember that you’re not just speaking to the troll but also the audience. So make sure you speak in a way that brings people together, not divides them.
      • Pause, wait, breathe, calm down before posting.

Player Select: Identifying with our virtual selves (video)

Alexa Ray Corriea, Neha Tiwari, Mitch Dyer, Elisa Melendez, Mike Laidlaw

  • Background Reading One: Leveling Up for Dummies
  • Background Reading Two: The Proteus Effect
  • More attractive avatars walked closer and divulged more information in game
  • People rarely (3%) create “scary” or “unattractive” avatars
  • Men trended toward average avatars, women toward attractive avatars.
  • Katrina Fong is doing cool research. Also Aria Bendix.
  • People who are comfortable with themselves don’t have such strong tendencies to create heroic or beautiful avatars.
  • Character creation is intentional.
  • Convince the player that the relationship is real and not the result of some systems.
  • Samantha Traynor is a good example of a character who breaks the “sex as reward” system (for male Shep) by turning him down no matter his advances.

Soylent Soylent Soylent Eggs

I’m trying Soylent as an experiment. This is my 7th day eating it. Here’s my blog post for the past 6 days of Soylent if you’re interested.

Woke up today tired, but enjoyed myself a glass of Soylent in the morning, made with some vanilla (for flavor) and salt (for not keeling over). Definitely bodily tired – a kind of dull aching tired that wasn’t exhaustion or sleepiness. It went away after I was up and about though.

Work went slowly today. I worked from home, and I’m either just checked out already for my upcoming wedding (I leave for Michigan next Tuesday and end a year of long-distance relationship for good!) or the Soylent is slowing me down. I’m actually going to say it’s the wedding. Body-wise I felt pretty great today.

Soylent for lunch, dinner. I had two cups of green tea with lunch which was enough caffeine to propel me until the end of the workday. Again, not tired today. I usually get exhausted at 8pm since that’s right after I eat a heavy dinner, but on Soylent I just kind of coast across these previously rugged ups-and-downs. This is pretty similar to what some other people have reported.

Way less gas today either. I didn’t eat as much Soylent as I did yesterday. The Chinese food is out of my system as well, I think. Plus I’m just finally getting used to the fiber and high Glycemic Index.

I was really craving some salt-and-pepper scrambled eggs around 1 a.m., though, so I just made those and ate them. I’m actually writing this blog post with my laptop perched on the stove. They were fluffy and delicious.

I think that means I’m still not getting enough salt, because salt tastes really good to me right now. Soylent only contains 45% of the RDA of salt, so that’s not a surprise. How does one go about monitoring their … blood-salt percentage? Should I keep track of my blood pressure?

I made it two full days on Soylent before eating something else. But midnight super-salty eggs are delicious and I’m glad I made them. I’m thinking that after I get back from my wedding (where I won’t be able to eat Soylent since I won’t have it with me) I might switch to just having Soylent for Breakfast and/or lunch. We’ll see.

From Brooklyn,

–Erty

Six Days of Soylent So Far

I promised Pedro that I would start blogging when I started on my Soylent diet, so here goes. I’m a bit late, considering that I actually started in on Soylent a few days ago, but preparations for my wedding have kept me away from the blagosphere.

I’ll assume the reader is familiar with the purpose and origin of Soylent. Otherwise, I recommend this well-written article on the matter.

I ordered Soylent ten months ago, and it is finally here! The wait is over, and I get to embark on this crazy experiment in food hacking.

Day 0: Paraphernalia

My Soylent Starter Kit arrived today. I’m excited.

Everything I Need To Make Soylent, Apparently

Everything I Need To Make Soylent, Apparently

That’s a 2L BPA-free container with a great twist-off top, a scoop, and some instructions. The actual soylent arrived the next day.

Day 1: Soylent Begins

A rather large, white box arrived at work. It contained four smaller boxes, each a week’s worth of powder, supplemented with seven tiny bottles of oil.

2014-08-01 19.47.16

The Soylent Arrives

2014-08-01 19.59.59

The large box contained four of these, each a week’s worth of powder and oil. Instructions were laid on top.

Instructions for Soylent

Instructions for Soylent. The full (amended) instructions are available at instructions.soylent.me

I’ve been anticipating this for a while – I was in the first batch of backers when the kickstarter-esque purchasing opened. I can’t eat gluten, dairy, or chocolate. So, while Soylent is *barely* not gluten free, it’s at least better than trying to figure out what will and won’t make me feel awful on a daily basis, and sometimes guessing painfully wrong.

Who knew couscous was pretty much entirely wheat?

Let’s make some Soylent!

Just add water

Just add water

2014-08-01 21.35.22

I added water

I describe the taste as “purposefully nondescript”. As Rob says on his blog:

I assumed I would quickly get tired of the taste but this does not happen. I accidentally stumbled on what the soft drink industry uses to make sure people never get tired of Coca-Cola, “sensory-specific satiety”. If a taste is pleasant, but not very specific, the brain does not tire of it.

I think of it as chalky pancake batter, but a bit thinner. It’s not bad. It’s not particularly delicious either, but I can see myself not getting tired of it.

Day 2: Soylent For Breakfast

With family in town, I didn’t have a chance to go full-on Soylent. I had Soylent for breakfast this morning, but nothing more.

No changes in appetite or anything else so far – it’s as though I ate a full breakfast. No gas, normal mental state.

Day 3: Soylent for Breakfast and Late Night Meal

Again, a light Soylent diet. Don’t worry – things are about to get interesting.

Day 4: Dizziness

This was the first Soylent workday! I poured myself a glass of the stuff, another liter into a Nalgene for later, and hopped on the subway.

At work I could already tell that my brain was off – I was feeling somewhat light-headed and definitely wasn’t all there. I would forget small things and push really strange errors in my code that I definitely would have caught if I had been running at full power.

Around 11 a.m. I was definitely light-headed and nauseous. I excused myself and sat in the bathroom for a while. Was it time to call off the experiment, so soon? Did I just need to push through this – navigate the Columbia River on my way to the Willamette Valley?

I posted on reddit. Responses indicated that I was either low on blood sugar, or there wasn’t enough salt in my Soylent. Not having a quick way to measure my glucose levels, I went with the latter and put some salt in a cup of Soylent and drank it, washing it down with about a liter and a half of water.

By 1 p.m. I had pretty much returned to normal.

Even today (day 6) I am still somewhat “distant” – as though my brain were operating on some sort of low-power mode. My memory is shoddy and I can’t do the kind of high-level abstract reasoning that is required for programming. I’ve heard from some other “Soylent Pioneers” that this goes away after a few days and the brain starts to run at 150%. We’ll see.

One of my friends had a birthday party that night so I decided to get some real food in me. For lunch I had a burger (no bun) and fries. I attended an excellent Hacker School talk by Daniel Espeset that night, and ate the delicious (Indian?) food provided.

I drank just under one “drink” of alcohol at the party, since I wasn’t sure what Soylent would do to my tolerance. Some reports say that it lowers your tolerance quite a bit, and for myself at 130lbs, I’m already unable to deal with much.

That one “drink” got me comfortably warm but not buzzed. So, yes, I think it does lower my tolerance even further, which I didn’t think was possible. Further testing is needed.

Day 5: Sleep In

With the full understanding that actions – not intent – is what matters, I’m pretty proud of myself for this being the first time I’d overslept since starting my new job. I have a pretty solid excuse as well – I woke up, hit the “one hour less” instead of the “one hour more” button on my alarm clock, and dozed peacefully until noon.

But, maybe this was the Soylent’s fault as well? I just (day 6) tried to turn on the lights in the room I’m in and spent a good five seconds swiping at the wrong wall, wondering where the switch was.

Either the Soylent isn’t powering my brain properly or I’m already becoming an old man. Hopefully the former.

Upon arrival at work, however, I was feeling better about the whole thing, and had a pretty productive day.

Chinese food for dinner – still not ready to commit 100% to Soylent.

Day 6: The Gas

A lot of people have reported having pretty bad gas on Soylent. There are some hilarious posts about this. From the second:

It was bad. These weren’t mere ha-ha toot kinds of emissions; this was hair-raising. It was room-clearing, horse-killing, World War I mustard gas-type gas. I migrated from room to room in the house like I was giving up territory to the Kaiser, my face fixed in an expression of horror as green hell-fumes trailed behind me, peeling paint and wilting plants.

Now! The chinese food I ate last night *probably* contained gluten, so it’s entirely possible that my sudden onset of why-don’t-you-work-from-home-tomorrow flatulence is from that. More testing is needed on this as well. This testing won’t be nearly as fun as the former.

I am working from home tomorrow, just in case.

I also tried drinking some caffeine today. Here’s one great thing about Soylent: I haven’t felt like I needed a cup of tea or can of soda since I started. I’m always comfortably awake, which also makes it a lot easier to fall asleep naturally. I have some problems with caffeine, namely that I’m very sensitive to it and drinking a coca-cola after about 3 p.m. makes me wide-eyed until 5 a.m.

I had one can of coca-cola today and It’s provided me with the power to write this post. Hopefully I can get to bed at a reasonable hour.

For the third time, further testing is needed. It would be neat to be able to run my brain at full tilt for an entire day on a cup of green tea.

I’m going to have Soylent for dinner, which will make this my first 100% Soylent day.

From Brooklyn,

–Erty

Perfect Craft, Imperfect Art

I was talking with my good friend Evan, discussing our philosophies of making things. Evan, a classically trained pianist, recalled an aphorism of one of his mentors:

Practice doesn’t make perfect, perfect practice makes perfect.

This makes sense in some fields. In playing a piano, if one practices sloppily, one will perform sloppily – incorrect finger positions practiced over and over again will be nearly impossible to correct. I worry about this when I play StarCraft 2: Without guidance from a professional, are the keystrokes I make a thousand times going to be so ingrained that I won’t be able to adjust myself to the practices that will take my skill to the next level?

Attempting to apply this method to creative works fails miserably! A writer cannot write perfectly every time, nor a painter control to the molecule what their paint will do. Designers cannot always know what the user is going to want.

A programmer attempting to make a thousand perfect programs will leave themselves mired in a death by a thousand cuts – they will have no code reach and no output. Which is why I strongly argued that Facebook’s old motto was better for any artist:

Move fast and break things.

What better way to learn the intricacies of impossibly large and complex systems? Even experienced programmers write bugs all the time, and better to do so at some speed which allows progress to be made.

What I was missing during this conversation with Evan was a distinction between Art and Craft. Art being the ability to create works (move fast and break things) and craft the skill that it takes to create art (practice perfectly).

A writer who does not take the time to practice sentence structure and when to break it will find themselves unable to write coherently. A painter who does not attempt to make each brush stroke perfectly will be left frustrated when their paint seems to disobey their hand. A designer who does not use their knowledge of color and proportion will be unable to guide users effectively. A programmer who does not use the right data structures and algorithms will find their code slow and unusable. All of these are separate from the actual “pieces” that each creates.

I think then my goal is to create lots of imperfect art, but practice my craft with skill each time so that I can avoid ingraining bad habits. Perfectionism in craft is important; perfectionism in art leads to procrastination.

Edit: Hacker School facilitator Allison Kaptur points out an excellent article that puts this very clearly (pun intended) at http://jamesclear.com/repetitions

“Words cannot even describe the multitude of design flaws in your body, and yet it is still the vessel of your mind; it is still your connection to this world. Production code is broken, but so is nature.” —@jordanorelli

The Artist and the Scientist

I posit that there are two distinct ways in which people become fascinated by programming.

One way is via high-level languages, web development tools, and visual languages. This “way” in is for people who are more interested in the act of creating with code than coding itself. I call these people the “artist-programmers”: people who don’t care about pointers and arrays, and would much rather fiddle with knobs and buttons than bits and bytes to create something cool. Artist-programmers can trust what is under the hood, and use this metaphorical car to go very far.

On the other hand, some people start programming with coding as the goal. These people learn about the array and are FASCINATED. These people can spend an afternoon messing with pointer indirection and not call it wasted time. These “scientist-programmers” believe that typing, references, and pointers are important to understand – their metaphorical car sits in the garage, taken apart into its components, and yet they are more fulfilled than if they were out driving it without any idea how it works. These programmers usually arrive via C, Assembly, or even hardware.

I think both ways to learn programming are correct, and appeal to different people. One of the reasons I enjoy python as a first language is that it is broad enough to appeal to both types as people. Lisp is great for this as well. Teaching an artist-programmer C++ is going to be a painful process for everyone involved. And teaching a scientist-programmer Mathematica will leave them wanting to know what’s going on inside.

The “programmer-in-fullness”, however, is both an artist-programmer and a scientist-programmer. These programmers are driving the metaphorical car AND have a full understanding of what’s going on inside the hood. They can speed along in a high-level language, but know what is happening on the inside enough to optimize as they write, fix things when they break, and use the right data structures and algorithms without sacrificing time worrying about the details.

Edit: My friend and fellow Hacker School alumnus @jordanorelli provides a great distillation of this idea: “I think the distinction is that I’m driven to learn things because they allow me to create things, whereas many others are driven to create things because in doing so, they learn things. Do you learn to create, or do you create to learn?”

Some thoughts on the types:

Artist-Programmers:

  • Teaching Them:
    • Focus on high level languages and visual languages
    • Focus on process and outcome, not design or implementation
    • Focus on immediate feedback and not worrying about speed
  • As one:
    • Don’t feel bad about using tools and helpers (e.g. Dreamweaver)
    • Aim for large projects that you can use these big tools to complete
  • To become a programmer-in-fullness:
    • Take a course like NAND-to-Tetris, which will allow you to see how the parts all fit together in a project
    • Take an interest in optimization, as far as you’ll still be able to finish your projects
    • Take apart your favorite tool and see how it works

Scientist-Programmers:

  • Teaching Them:
    • Focus on the little things. Pointers. Arrays. Bytecode.
    • Give them an extremely restricted toolset and a slow processor.
    • Start them in on data structures and algorithms fast – they’ll eat it up.
  • As one:
    • Buy books on programming. Implement their examples. Explore hardware organization.
    • Don’t be frustrated by projects that you can’t finish, as long as you learned something in the process.
    • Contribute to larger artist-programmer projects which can use your optimization skills.
    • Don’t mock artist-programmers for using tools. They don’t mock you for not using tools!
  • To become a programmer-in-fullness:
    • Start to use libraries and packages which will allow you to complete projects faster, even if you don’t know what they do at the low level.
    • Focus on optimization less, as long as you still understand what’s going on inside.
    • Work hard to finish projects, as painful as the final sprint is.

And above all, understand that people might come to programming from a different perspective than you. The scale is most likely not binary, either – think of it as a float instead of a bool. And be able to use this knowledge to give people projects that they’ll be interested in and will do well with.

From Manhattan,

–Erty

SSD vs RAID0 for Gaming: SCIENCE!

A while ago, I bought an SSD (128GB Crucial M4) off Amazon, with the idea of putting it in my gaming rig as a “game cache”. My plan was to install my most played games on it, while the rest of my games sat on my current setup – Two 1TB Seagate Barracudas in RAID0. Here’s a cell phone pic of my setup:rigIgnore the awful position of the cable/drive on the new SSD – it’s for testing purposes.

At my current job, there’s a heavy reliance on data to drive decisions, and I decided to do some science here before actually moving my games over. And I’m glad I did. Here’s the data:

sequential random

E: RAID are the same raid drive – no difference, but two data collection runs, since the numbers were much more inconsistent. I had programs running on that drive while testing, meaning there’s a lot more noise. To do actual science I would run a lot more tests, but I feel that my results were good enough to make decisions on.

G: SSD is the SSD with two different stripe sizes: 4kb and 32kb. I believe the 4KB performed better because some cursory research showed that the drives are manufactured to be used with a 4kb block size, which makes sense.

Data was collected using Roadkil’s Disk Speed under light system load.

The interesting result is in the sequential/random difference on the RAID. In sequential reads, the RAID actually comes out faster than the SSD except at the 64kb read size. I believe this is because I have the RAIDs striped at 64KB, with 64KB blocks, and I must be hitting some sort of strange misalignment at exactly that size.

However, the RAID drops to basically zero (<1MB/s) when performing random read, while the SSD loses no speed at all. This is, of course, the main reason for getting an SSD.

Now, as far as I’m aware, games actually optimize for sequential read, since that’s how most hard drives are going to load them. What this means, as far as I can tell, is that I would actually be hurting my game performance by moving my games over to an SSD.

I’ll edit this post, after I play some Skyrim+HD Textures on the SSD and check if the load speeds feel any better.

Also: if anyone more experienced with hardware has any suggestions, I’m all ears!

From Brooklyn,

–Erty