Skip to content

Commit

Permalink
Add corresponding new musings html files.
Browse files Browse the repository at this point in the history
Bah, I should really just use markdown... was silly of me not to.
  • Loading branch information
Grant Mathews committed Oct 9, 2011
1 parent 7ceacd1 commit 49ac6a2
Show file tree
Hide file tree
Showing 4 changed files with 271 additions and 0 deletions.
80 changes: 80 additions & 0 deletions musings3.html
@@ -0,0 +1,80 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>

<title>johnfn's blog @ GitHub</title>

<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<h1><a href="index.html" style="text-decoration:none">blog|<span class="flat">musings</span></a>
<span class="small" style="float:right">by johnfn. This is <a href="http://github.com/johnfn/johnfn">a github repository</a>, generated from flat text files. It's pretty neat. And open source. Check it out! </span></h1>
<div class="post">
<div class="title">
You can't tell people what to do.

</div>
<div class="date">
Written October 8, 2011.

</div>
<div class="body">

<p>
</p> <p>Preface: Blah, this is crap. Maybe I will rewrite it somday...maybe.

</p> <p>In John's Introduction to Psychology class, the class gets assigned a chapter of reading every two days. The number of students who did all of the reading in John's class is vanishingly small, even though almost all of the students have tried to do some it. The professor caught wind of this, and to fix the problem he reminded the class at the beginning of lecture that the readings were mandatory and that the material would be on the test.

</p> <p>At Fred's current job, there is a problem: their old code is really sloppy. His work had a meeting, and one of the topics Fred's co-workers touched on was code quality. Their boss said that people should not be afraid of taking extra time to write code that was higher quality, and moved on.

</p> <p>These vignettes share a common theme. There is a group of people who need to improve their habits, and there's an authority figure that tries to help them fix their problem.

</p> <p>The problem is that in each example, the authority figure solves the problem in the wrong way. You can't tell people what to do. Most people believe that they are writing good code. Similarly, most college students really do want to do reading - they reason that they don't comes from somewhere else. Let's see how the authority should actually solve the problem, and then see what conclusions we can draw.

</p> <p>In the first case, students really want to do the reading, but they become disillusioned somewhere through reading the massive tome. The problem isn't that students don't care, it's that the material isn't being presented in the right way. The book is long, dry, and unengaging. (This is a question of willpower, but I'll get into that in another post.)

</p> <p>The crux of the issue though is that in an introductory Psychology class really doesn't need to bog down it's members with massive amounts of reading, because that's not really what Psychology is about. Psychology is about using experiments to better understand human behavior, and it's not true that students need to read a thousand pages and memorize hundreds of vocabulary words to gain a proper introduction. A better way would be to run actual practical experiments, get feedback, and see how Psychology is run in the world.

</p> <p>In the second case, none of Fred's co-workers really believe that they're writing bad code. They think that they're writing average code at worst. But we can empirically see that this is false since the overall quality of the code they've been working on is poor.

</p> <p>The reason that most of them write poor code is because coding is a rare profession where you can produce a lot more than you read. It's easy for me to believe that my own code is great quality since I've read more of my own code than anyone else's. But that means I have no basis for judging code quality at all, since I have bias.

</p> <p>The way to write better code is manifold and most of the theory is outside the scope of this post. But really, it boils down to ensuring that your code can be read by other people. One good way that the boss could work towards better code quality is to require code review for large chunks of code. In that way, each employee would gain an understanding for what makes good or bad code.

</p> <p>-----

</p> <p>In each of these circumstances, we've seen a group ostensibly choose not to do something that would benefit them. We've seen that incentivizing the activity fails to motivate people. In both cases, to get the outcome that we want, we have to find the root cause why people fail to do the activity. With Psychology, it's because the book is hard to read and people generally lack the willpower. With code quality, it's because people just don't know they're writing bad code.

</p> <p>Now that we've found the root cause, we can build infrastructure to make people stumble upon the desired result by doing something that they actually care about.

</p> <p>Other applications of this rule:

</p> <p>The customer is always right.

</p> <p>If you find yourself thinking that the customer is wrong, what that really means is that you've presented something to the customer in an incorrect way, and you should fix that.

</p> <p>
</p> <p></p>
<p> </p>
<p> </p>
<p> </p>
<p>
You should follow me on twitter <a href="http://twitter.com/thedayturns">here.</a>
</p>
</div>


<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="thedayturns">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=170533823007150&amp;href&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</div>

<div class="footer">
What's up?

</div>
</div>
</body>
</html>
70 changes: 70 additions & 0 deletions musings4.html
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>

<title>johnfn's blog @ GitHub</title>

<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<h1><a href="index.html" style="text-decoration:none">blog|<span class="flat">musings</span></a>
<span class="small" style="float:right">by johnfn. This is <a href="http://github.com/johnfn/johnfn">a github repository</a>, generated from flat text files. It's pretty neat. And open source. Check it out! </span></h1>
<div class="post">
<div class="title">
Willpower

</div>
<div class="date">
Written October 8, 2011 into October 9th.

</div>
<div class="body">

<p>
</p> <p>Willpower is a finite, exhaustible resource.

</p> <p>Have you ever noticed that you waste a lot more time surfing aimlessly on the internet at night than during the day?

</p> <p>This is a really important topic, since your willpower is the sole most important factor of how productive you are. And yet willpower has a bit of a strange rap about it. People tend to look down on people that admit to having problems with willpower, which is kind of weird (it's not like we look down on people because they are, say, color blind). Further, the way that people think of it is not quite accurate - most people see it as stable and consistent, when in reality your willpower disappears throughout the day (and so is highest immediately in the morning).

</p> <p>The idea is that willpower is like a muscle that you use every time you make a choice, and the muscle can get exhausted and leave you making bad choices. It comes back with sleep, which explains why you seem to waste the most time during the night just before you go to sleep.

</p> <p>Ways to save willpower:

</p> <p>* Remove the choice.

</p> <p>If you find yourself wasting a ton of time on the Internet, you can remove the choice entirely by disconnecting from the Internet. The initial choice to (say) turn off the Internet is hard, but when you keep the Internet off, you will not have to make the choice every 5 minutes to continue working instead of surfing your favorite site.

</p> <p>It's as if turning off the Internet initially takes a lot of willpower, but after that you don't have to expend any, whereas if you keep it on you have to constalty expend willpower to not waste time. After a certain point, you will have saved willpower.

</p> <p>You can really remove the choice by involving someone else ("only let me back on the internet once I finish my essay").

</p> <p>* Make a habit.

</p> <p>This is similar to removing the choice in that once you make a habit out of something, it stops being a choice - you just do it. I used to browse webcomics all the time, but I have since made a habit out of only checking them immediately when I get on the computer the first time of the day. Then I don't waste willpower throughout the day wondering if I should go check xkcd or something.

</p> <p>
</p> <p></p>
<p> </p>
<p> </p>
<p> </p>
<p>
You should follow me on twitter <a href="http://twitter.com/thedayturns">here.</a>
</p>
</div>


<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="thedayturns">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=170533823007150&amp;href&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</div>

<div class="footer">
What's up?

</div>
</div>
</body>
</html>
62 changes: 62 additions & 0 deletions musings5.html
@@ -0,0 +1,62 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>

<title>johnfn's blog @ GitHub</title>

<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<h1><a href="index.html" style="text-decoration:none">blog|<span class="flat">musings</span></a>
<span class="small" style="float:right">by johnfn. This is <a href="http://github.com/johnfn/johnfn">a github repository</a>, generated from flat text files. It's pretty neat. And open source. Check it out! </span></h1>
<div class="post">
<div class="title">
Don't Make me Remember

</div>
<div class="date">
Sunday, 9 October 2011

</div>
<div class="body">

<p>
</p> <p>One of my biggest guiding principles while coding is this:

</p> <p>I hate remembering things.

</p> <p>What that means is that I try to design programs such that I have to remember as little as possible.

</p> <p>Example: Say that you have doSomethingFunction(). You write it, but then you put in the comments: "Don't forget to call cleanupSomethingFunction() when you're done." That seems like enough, right? I mean, you commented it. What more could I want?

</p> <p>No, no, no. This is really bad. See, it's okay right now, and I might even remember it the first and second times that I use doSomethingFunction(), but what if somewhere else I'm editing the code and accidentally remove the cleanup() call, or I use that code as reference to implement some more code and forget the cleanup(), or...

</p> <p>The point is that every line that I write that I will need to remember something about later increases the chance of disaster.

</p> <p>(The right way to solve this problem, by the way, is to pass a function into doSomethingFunction() that does everything that happens in the intermediary before you call cleanupFunction.)

</p> <p>
</p> <p></p>
<p> </p>
<p> </p>
<p> </p>
<p>
You should follow me on twitter <a href="http://twitter.com/thedayturns">here.</a>
</p>
</div>


<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="thedayturns">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=170533823007150&amp;href&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</div>

<div class="footer">
What's up?

</div>
</div>
</body>
</html>
59 changes: 59 additions & 0 deletions musings6.html
@@ -0,0 +1,59 @@
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>

<title>johnfn's blog @ GitHub</title>

<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body>
<div id="container">
<h1><a href="index.html" style="text-decoration:none">blog|<span class="flat">musings</span></a>
<span class="small" style="float:right">by johnfn. This is <a href="http://github.com/johnfn/johnfn">a github repository</a>, generated from flat text files. It's pretty neat. And open source. Check it out! </span></h1>
<div class="post">
<div class="title">
Coding Princples

</div>
<div class="date">
Sunday, 9 October 2011

</div>
<div class="body">

<p>
</p> <p>Well, if I wrote musings5, I may as well write this one too.

</p> <p>0. When given two choices, choose the one that scales better. This is the core axiom from which all other principles can be derived from.

</p> <p>Example: When choosing between putting a check in a setter method of a class to see if the new value is the right type, or putting the check every time you set the variable, the correct choice is clearly the former, which scales at O(1) to adding new calls to set, where the second one scales at O(n).

</p> <p>1. Don't repeat yourself. This one has lots of rammifications. Don't copy and paste code, obviously. But also, don't copy logic, which is a more subtle thing.

</p> <p>2. Choose explicit over implicit.

</p> <p>3. Don't make me remember things.

</p> <p></p>
<p> </p>
<p> </p>
<p> </p>
<p>
You should follow me on twitter <a href="http://twitter.com/thedayturns">here.</a>
</p>
</div>


<a href="http://twitter.com/share" class="twitter-share-button" data-count="vertical" data-via="thedayturns">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
<iframe src="http://www.facebook.com/plugins/like.php?app_id=170533823007150&amp;href&amp;send=false&amp;layout=button_count&amp;width=450&amp;show_faces=true&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:21px;" allowTransparency="true"></iframe>
</div>

<div class="footer">
What's up?

</div>
</div>
</body>
</html>

0 comments on commit 49ac6a2

Please sign in to comment.