Tag Archives: C++

3 Ways To Say I Love You (In Code)

Example 1:

#include <iostream>
#include <cstdlib>

using namespace std;

int main() {
  int two;
  two = 1;
  while(two == 1) {
    cout << "I love you little red haired girl\n";
  }
}

Example 2:

#include <iostream>
#include <cstdlib>

using namespace std;

void myLoveGrowsDeeper(int lvl);

int main() {
  int lvl = 1;
  cout << "My love grows deeper";
  myLoveGrowsDeeper(lvl);
  cout << " every day." << endl;
}

void myLoveGrowsDeeper(int lvl) {
  if(lvl == 99) {
    return;
  }
  myLoveGrowsDeeper(lvl+1);
  cout << " and deeper ";
}

Example 3 (Turtle Commands, Pixels, Degrees):

LEFT 45
FORWARD 100
REPEAT 180
  FORWARD PI/2
  LEFT 1
RIGHT 90
REPEAT 180
  FORWARD PI/2
  LEFT 1
FORWARD 100





2 Comments

Filed under Trube On Tech

Creative Spaces

I can’t write program code in a Panera.

At least I can’t write it with the same efficiency that I can write 1700 words of a novel. It’s not that the environment is distracting, if anything it’s less so with the new headphones I’m using. It just isn’t the right place to think logically about a problem, research and debug code.

How much does environment factor into what we do?

I’ve talked before about my usual haunts, the places where I like to revise and write. My netbook offers the same flexibility for programming, I can write code anywhere I want. And yet, it just doesn’t “feel” right, I’m not having the same insights, making the same associations I would in my home office.

I believe in different places for different activities. I’m not a fan of my commute, but I do like that my work universe is fairly separate from my home universe. I’ve tried to write creatively at work and have found it to be a little stifling, either from distractions or just how it feels to write at this desk instead of my own. Weirdly enough the blog feels natural here, and unnatural at home, but again that might be because I first started writing the blog on my lunch break. There is a conscious or unconscious association in my head that this place and this time are the correct places to write a blog post.

Writing code takes a different kind of mindset. It’s still creative, but within a much more constrained set of rules, kind of like poetry. I’m writing in C++ and there’s an incredible amount of power in relatively few words, as well as unspeakable frustration when searching for type-casting errors, missing semi-colons and parenthesis. It’s different than the programming I do for work, which is mostly web and Javascript, because C++ is more deliberate. Javascript is free-form beatnik poetry or prose, C++ is a sonnet (Perl and LISP are Haiku). I listen to different music when I program too (heavy on electronic and weirdly enough certain Christian albums).

The upside of all this is that while I work more heavily on program code I will be spending more time at home, which is never a bad thing. Maybe I will find other places where programming feels comfortable, but for the time being there’s no place like 127.0.0.1.

Does where you are affect what you are able to create (writing, art, programming)? How about music/white noise/silence?

8 Comments

Filed under Trube On Tech, Writing