<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Geoff Petrie on Medium]]></title>
        <description><![CDATA[Stories by Geoff Petrie on Medium]]></description>
        <link>https://medium.com/@geopet?source=rss-c2f10f70ac92------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*VDndcE445xm49xks0S40gA.png</url>
            <title>Stories by Geoff Petrie on Medium</title>
            <link>https://medium.com/@geopet?source=rss-c2f10f70ac92------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 11:48:36 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@geopet/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Analysis of Ottinger’s Rules for Variable and Class Naming]]></title>
            <link>https://medium.com/@geopet/analysis-of-ottingers-rules-for-variable-and-class-naming-429f5b50a444?source=rss-c2f10f70ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/429f5b50a444</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Geoff Petrie]]></dc:creator>
            <pubDate>Fri, 15 Aug 2014 00:00:00 GMT</pubDate>
            <atom:updated>2017-03-02T16:02:02.094Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER:</em></strong><em> I am migrating where I publish my written work to Medium. This is a post that I have chosen to republish. It was originally written in </em><strong><em>2014</em></strong><em>. These older posts I have left relatively unchanged. Some (or most) of the specific details may be out of date now, but I believed the underlying message of these articles outweighed whatever datedness these posts had.</em></p><p>Sections in Ottinger’s <em>Rules for Variable and Class Naming</em>:</p><ul><li>Use Intention-Revealing Names</li><li>Avoid Disinformation</li><li>Make Meaningful Distinctions</li><li>Use Pronounceable Names</li><li>Use Searchable Names</li><li>Avoid Encodings</li><li>Avoid Mental Mapping</li><li>Use Noun and Verb Phrases</li><li>Don’t Be Cute</li><li>Pick One Word Per Concept</li><li>Don’t Pun</li><li>Use Rich Name Sources</li><li>Make Context Meaningful</li></ul><p>Naming is one of those things in programming that is always there. Tim Ottinger wrote <a href="http://www.objectmentor.com/resources/articles/Naming.pdf"><em>Rules for Variable and Class Naming</em></a> for Object Mentor in 1997. This is still considered one of the seminal articles on the topic of naming and programming. I thought it might be fun to give it a read an add my thoughts.</p><p>Let’s get started.</p><p>Ottinger starts his paper with:</p><blockquote><em>An expressive name for a software object must be clear, precise, and small. This is a guide to better clarity, precision, and terseness in naming.</em></blockquote><p>This focus on “terseness” immediately worries me. With autocompletion and IDEs, the size of the variable or class name is the last thing I’m going to worry about. But let’s see where this heads.</p><h3>Use Intention-Revealing Names</h3><blockquote><em>The problem isn’t the simplicity of the code but the implicity of the code: the degree to which the context is not explicit in the code itself.</em></blockquote><p>This is Ottinger’s conclusion after looking at what appears to be a relatively simple Python sample. Ottinger’s meaning is here is: <em>Even the simplest code needs to be clear in its intent.</em></p><p>In Ottinger’s example he takes the unexpressive names of the sample and modifies them to show the intent of the code. He takes his refactoring even further than name changing to introduce a new class using a name he had introduced in the previous refactoring. This new class adds an additional level of elegance and explicitness to the sample.</p><p>Something that started out as being difficult to understand, after some small changes, is significantly more clear.</p><h3>Avoid Disinformation</h3><blockquote><em>A software author must avoid leaving false clues which obscure the meaning of code.</em></blockquote><p>Some words mean different things to different people. Ottinger uses the word “list” as an example of something that could mean various things to various people.</p><p>He argues that instead of AccountList perhaps use AccountGroup or even BunchOfAccounts.</p><p>Also, be careful using variables or classes whose names are both long and are only slightly different. For example, XYZControllerForEfficientHandlingOfStrings and XYZControllerForEfficientStorageOfStrings.</p><p>Amusingly, Ottinger warns us of using lowercase L’s and uppercase o’s in our naming as they can easily be misinterpreted as ones and zeros. Raise your hand if you’ve been bitten by this one before.</p><h3>Make Meaningful Distinctions</h3><blockquote><em>If names must be different, then they should also mean something different.</em></blockquote><p>This quote has a lot of meaning behind it. Consider the single responsibility principle. If you can’t come up with a unique name for something, perhaps that is an indication that the code written with the name that you want to use could <em>also</em> be used for your current problem.</p><p>Ottinger warns us against adding noise words and number series in our naming simply to satisfy compilers. Creating variables like string, string1, string2 add nothing to meaning. The same thing can be said about adding noise words like Info or Data to produce new classes like ProductInfo or ProductData.</p><p>“Noise words” are tricky for me to understand, though. I can see cases where ProductInfo and ProductData could be useful. But I feel that Ottinger’s intent here is to warn off the use of these words if something more <em>explicit</em> can’t be used.</p><p>Furthermore, if you are creating a class called ProductInfo, perhaps it would be better to have an info method on the Product class. Then you could simply call Product.info.</p><h3>Use Pronounceable Names</h3><p>This is a fairly self-explanatory section. Use variables and classes that you can say over the phone or in an in-person conversation.</p><h3>Use Searchable Names</h3><p>Two outstanding quotes from this section:</p><blockquote><em>… longer names trump shorter names, and any searchable name trumps a constant in code.</em></blockquote><p>and</p><blockquote><em>My personal preference is that single-letter names can ONLY be used as </em><strong><em>local</em></strong><em> variables inside </em><strong><em>short</em></strong><em> methods.</em></blockquote><p>I love these clear rules of thumb. Although I do worry over the use of single-letter variables in <em>any</em> place. I also have some challenges reconciling the idea that “longer names trump shorter names” but from before we saw that we should be “terse” in our naming.</p><p>Ultimately, for me, if a name is descriptive that should be the most important thing. If that name is short and descriptive, then that is fine. If it is long and descriptive then that, too, is just fine.</p><h3>Avoid Encodings</h3><p>Ottinger brings this section to a close with this quote:</p><blockquote><em>Modern languages don’t need type encoding.</em></blockquote><p>It’s certainly worth reading this section and learning more about Hungarian Notation, but I won’t spend any more time on this here.</p><h3>Avoid Mental Mapping</h3><p>Don’t force the reader of your code to translate what the variable means.</p><p>And how awesome is this quote?</p><blockquote><em>Smart is overrated. Clarity is king. The very smart must use their talent to write code that others are less likely to misunderstand.</em></blockquote><h3>Use Noun and Verb Phrases</h3><p>Create variables that allow for you to write code that reads like a sentence.</p><p>Ottinger recommends that if this sounds unimportant or difficult to grasp then you should see how difficult it is for you or your colleagues to use your class’s API or how challenging it is to read the unit tests for your class.</p><p>Another interesting element to this section is the idea of creating methods or functions to make your class read better instead of having a list of overloaded class constructor parameters that wouldn’t make sense if you saw the class being instantiated.</p><p>So instead of Interest.new(30) you could have something like Interest.thirty_year_mortgage.</p><h3>Don’t Be Cute</h3><p>I once named a major function to a class parsenator. Don’t do this.</p><p>Seriously, even if the developers who read your code are fans of <em>Phineas and Ferb</em>, no one wants to see that when they’re trying to debug something that woke them up in the middle of the night.</p><h3>Pick One Word Per Concept</h3><p>Frankly, this section wasn’t completely clear to me. What I’m taking from this is the idea that you should pick a name and then stick with it. Be consistent with your interface.</p><p>While this may be tedious, the people who use your API will thank you.</p><h3>Don’t Pun</h3><p>Do not use the same name for different ideas.</p><p>Ottinger uses the term “add” as an example. If you use the name “add” in one class to be the summing of numbers and then use “add” in another class to concatenate a list, you are essentially muddying the clarity of what that term means in your system.</p><p>Use different names for different actions or things.</p><h3>Use Rich Name Sources</h3><p>Use names that identify the patterns, algorithms or math terms you are using if you are working at a low level in the code. I.e., use <em>solution domain names</em>. It is better to be clear what the intent of your code is to the developer who will be maintaining it rather than the customer you have written the code for.</p><p>At a higher level, though, use <em>problem domain names</em>. Using the problem or business domain names makes the intent clear when you are interacting on that level. Is it easier to understand Game.target.find(23) or Game.enemy_hit_in_quadant?(23)?</p><h3>Make Context Meaningful</h3><p>There are two items to walk away with from this section.</p><p>First, most names are not meaningful unto themselves. Use classes, methods and namespaces to help your readers better understand what your intent is.</p><p>Second, do not go around prefixing all of your classes with the problem domain abbreviations.</p><p>If all your classes start with BAZ, not only does that not add anything to the clarity of your intent, it also works against autocompletion of your editors and IDEs.</p><h3>Conclusion</h3><p>Ottinger’s paper is exceptional. While I have enjoyed writing this analysis, I am certain that I am missing nuance that is there.</p><p>I encourage you to sit down and read through the paper for yourself. At best it’ll take you just a short time longer to read it than it did to read this article here.</p><p>I’m writing this analysis as a learning tool. Please reach out to me if you find anything you want to discuss in greater depth or you have found something incorrect here.</p><p><em>Originally published at </em><a href="http://geopet.github.io/blog/2014/08/15/analysis-of-ottingers-rules-for-variable-and-class-naming"><em>geopet.github.io</em></a><em> on August 15, 2014.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=429f5b50a444" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Some Thoughts on Ego]]></title>
            <link>https://medium.com/@geopet/some-thoughts-on-ego-4b2c296310a3?source=rss-c2f10f70ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/4b2c296310a3</guid>
            <category><![CDATA[engineering-culture]]></category>
            <category><![CDATA[life-lessons]]></category>
            <category><![CDATA[self-improvement]]></category>
            <category><![CDATA[engineering]]></category>
            <dc:creator><![CDATA[Geoff Petrie]]></dc:creator>
            <pubDate>Fri, 18 Jan 2013 00:00:00 GMT</pubDate>
            <atom:updated>2017-02-28T16:02:00.680Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER:</em></strong><em> I am migrating where I publish my writing to Medium. This is a post that I have chosen to republish here. It was originally written in </em><strong><em>2013</em></strong><em>. These older posts I have left relatively unchanged. Some (or most) of the specific details may be out of date now, but I believed the underlying message of these articles outweighed whatever datedness these posts had.</em></p><p>To categorically define <em>Ego</em> is out of the scope of this writing. In order to make things easier on myself, and hopefully you, I will attempt to elucidate my meaning through example. But so that we’re all starting on the same foot, when I say ego I am referring to the informal and negative connotation of the word.</p><p>Why am I talking about ego?</p><p>For months now I have been trying to write about my journey as a newbie in the Ruby programming language. I have more than half a dozen starts to what should be a simple short piece of writing. For some reason every time I attempted to write this article it came out feeling wrong. I’m going to try a different take on this subject now.</p><p>Several months ago I decided that I needed to broaden my professional horizons. I had been singularly focused on a few programming languages for far too long. I knew I needed to break out of that sedentary place and that there was a fundamental element I was missing. The problem: I didn’t know what that element was.</p><p>Now I say that several months ago I decided to do something, but the reality is that I have known for years that I could be doing more. <em>This</em> is where ego comes into play.</p><p>Ego may be the <em>single biggest impediment to improvement</em>.</p><p>Ego prevents us from asking questions. It prevents us from seeking out help. It stops us from acting in an empathetic way. Ego encourages us to be know-it-alls.</p><p>The astounding thing about ego is how difficult it is to counteract it. If you call someone out on their ego, what is driving that? There is likely a healthy dose of ego fueling the accusation that someone is filled with hubris. “This person is interfering with my greatness, I need to tell them to drop their ego!” At least that’s what I’ve tended to hear when someone has talked about another’s ego with me.</p><p>But for me, I believe ego has significantly impaired my ability to level up or move forward. I never wanted to accept that I was the least informed, or educated, person in the room. Often times I was being paid to be the most knowledgeable person only to realize that I was maybe just slightly more experienced in the subject. Sometimes I was either on even footing or worse! In these situations it wasn’t unusual if I found personal security in grabbing my ego tight and running with it. An opportunity for learning? I think not! I would have been more comfortable either attempting to look contemplative, while really just being confused, or, even worse, I would have attempted to derail conversations to a place where I was more familiar.</p><p>Was this always the case for me? No. Of course not. But in hindsight it happen more than it should have.</p><p>So why am I writing about this?</p><p>Ultimately breaking the ego chain was what I needed to write about when I have been trying to talk about starting fresh with Ruby. Yes, embracing newbiness requires a dismissal of ego. But the direction doesn’t go newbie to ego. It is the other way around! <em>Ego must go before</em> you can consider being a newbie of anything.</p><p>I wish I could say that dumping your ego was easy and that it felt good. Sometimes it does. It certainly depends on the people around you. Having a supportive group does make things simpler.</p><p>As a programmer it is tough to dismiss the ego outright. We pride ourselves on reviewing someone’s code and finding a bug, or figuring out a more elegant way to write the same method or class. Our ego is what drives us to solve problems! If I didn’t think I couldn’t do something I hadn’t done before I would never have made it in this profession at all. This is a time that ego is a benefit. Ego that pushes us, that drives us to become more than we are, that’s something we can embrace. Looking at it in this sense, it isn’t incorrect to say that ego is what is driving me to dismiss my ego now. How odd!</p><p>So in an effort to move past my typical embarrassment of asking questions that clearly show I don’t understand a subject with any sort of depth, or to try something, with varying degrees of success, just so that I can work on that particular skill, I am making a concerted effort to dismiss my ego.</p><p>I want to continue to live a fulfilling life. In order for me to do that I need to know that I won’t allow something like my ego get in the way of asking a question that could lead to a path of new experiences.</p><p>At the end of the day this is all about being a happier person.</p><p>Thanks for reading.</p><p><em>Originally published at </em><a href="http://geopet.github.io/blog/2013/01/18/thoughts-on-ego"><em>geopet.github.io</em></a><em> on January 18, 2013.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4b2c296310a3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Vim — Precision Editing Video]]></title>
            <link>https://medium.com/@geopet/vim-precision-editing-video-30342207985d?source=rss-c2f10f70ac92------2</link>
            <guid isPermaLink="false">https://medium.com/p/30342207985d</guid>
            <category><![CDATA[vim]]></category>
            <category><![CDATA[tips]]></category>
            <category><![CDATA[engineering]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[Geoff Petrie]]></dc:creator>
            <pubDate>Wed, 14 Nov 2012 00:00:00 GMT</pubDate>
            <atom:updated>2017-03-07T16:02:01.016Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>DISCLAIMER:</em></strong><em> I am migrating where I publish my writing to Medium. This is a post that I have chosen to republish here. It was originally written in </em><strong><em>2012</em></strong><em>. These older posts I have left relatively unchanged. Some (or most) of the specific details may be out of date now, but I believed the underlying message of these articles outweighed whatever datedness these posts had.</em></p><p><a href="http://www.vim.org/">Vim</a> is my text editor of choice. Drew Neil is an amazing Vim evangelist. If you haven’t, you should go check out <a href="http://vimcasts.org/">VimCasts</a>. He also <a href="http://pragprog.com/book/dnvim/practical-vim">has a book</a> that I haven’t had a chance to dive into yet, but I will be shortly.</p><p>If you haven’t yet, you should check out Drew Neil’s presentation on Vim.</p><p>The first chunk, if you’re good with Vim, isn’t anything you don’t already know. It is mainly Drew trying to convince people that modality in a text editor is great. I agree. It is.</p><p>But about midway through, Drew busts out some of great power moves. Some of them I’ve not seen before, but I have immediately introduced to muscle memory workout.</p><p>The three that I picked up from this were:</p><ol><li>dt. - delete until the dot.</li><li>vi[ - visually highlight everything between the square bracket.</li><li>gf - go to the file under the cursor.</li></ol><p>Honestly, I don’t know how I never picked up gf before, but I promise it is one that I won’t forget. The other two I’m in love with. I used dt. while writing this post!</p><p>Anyway, here’s the presentation. Give it a look:</p><p><a href="https://vimeo.com/53144573">https://vimeo.com/53144573</a></p><p><em>Originally published at </em><a href="http://geopet.github.io/blog/2012/11/14/vim-precision-editing-video"><em>geopet.github.io</em></a><em> on November 14, 2012.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=30342207985d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>