<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Code and comments</title>
	<atom:link href="http://wilsonericn.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wilsonericn.wordpress.com</link>
	<description>Practical and theoretical aspects of software development</description>
	<lastBuildDate>Mon, 29 Apr 2013 09:29:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='wilsonericn.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Code and comments</title>
		<link>http://wilsonericn.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://wilsonericn.wordpress.com/osd.xml" title="Code and comments" />
	<atom:link rel='hub' href='http://wilsonericn.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Mastermind in Clojure and Java</title>
		<link>http://wilsonericn.wordpress.com/2012/12/11/mastermind-in-clojure-and-java/</link>
		<comments>http://wilsonericn.wordpress.com/2012/12/11/mastermind-in-clojure-and-java/#comments</comments>
		<pubDate>Tue, 11 Dec 2012 17:58:08 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[languages]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=759</guid>
		<description><![CDATA[Have you heard of mastermind? It&#8217;s a logic game in which one player repeatedly tries determine the secret code that another player set at the beginning. With each guess, the player is given information on how many correct pegs his guess contains, and how many are in the correct position. For more details on the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=759&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-full wp-image-760" alt="200px-Mastermind" src="http://wilsonericn.files.wordpress.com/2012/12/200px-mastermind.jpg?w=700"   /></p>
<p>Have you heard of mastermind? It&#8217;s a logic game in which one player repeatedly tries determine the secret code that another player set at the beginning. With each guess, the player is given information on how many correct pegs his guess contains, and how many are in the correct position. For more details on the rules, check the <a title="Wikipedia Mastermind" href="http://en.wikipedia.org/wiki/Mastermind_(board_game)" target="_blank">wikipedia</a> article.</p>
<p>I built a Clojure implementation of Mastermind as a learning project. (Code and details of functionality at <a href="https://github.com/ewilson/mastermind" target="_blank">github</a>.) My primary goals were to gain familiarity with the language, and to see what the functional programming paradigm feels like when working on a project that is larger than one big function. After I finished, I re-implemented (almost) all of the features in Java for a comparison. (Code also available at <a href="https://github.com/ewilson/mastermind-java" target="_blank">github</a>.) Interested in the results? read on.</p>
<p><span id="more-759"></span></p>
<h3>Some numbers</h3>
<p>Lines of code: Clojure 140, Java 450<br />
Source code files: Clojure 5, Java 11</p>
<p>But it&#8217;s really worse than that. I didn&#8217;t implement a few features in Java, which code have amounted to another hundred lines. And about 10% of the lines in Clojure were comments, but I didn&#8217;t add any comments to the Java code.  So I don&#8217;t think that it&#8217;s unreasonable to expect four times as many lines of code in Java compared to Clojure.</p>
<h3>Semantics</h3>
<p>Suppose you need to compare two lists, and count the number of pegs that are the same, and in the same place. This is necessary to determine the number of colored pegs given in response to a guess in Mastermind. Here&#8217;s how you do it in Java:</p>
<pre>
private static int exactMatches(List&lt;Pre&gt; guess, List&lt;Pre&gt; actual) {
    int matches = 0;
    for (int idx = 0; idx &lt; actual.size(); idx++) {
        if (actual.get(idx) ==  guess.get(idx)) {
            matches++;
        }
    }
    return matches;
}

</pre>
<p>Not too bad, right? Just a loop, with a conditional that increments a counter. But notice that since we are comparing two lists, it is necessary to use the indices. That doesn&#8217;t seem like a big deal, because it is common, but understand that this question being asked has nothing to do with indices. Let&#8217;s compare this with the Clojure implementation.</p>
<pre>
(defn exact-matches [guess actual]
  (count (filter true? (map = guess actual))))

</pre>
<p>In my mind at least, this function is not only more succinct, but far closer to my mental model of what is happening. There is no counter, only a <code>count</code> function. There is no loop containing a conditional, rather a <code>filter</code> function that takes a function and a sequence. For the comparison, <code>map</code> applies the equals function successively to each of the items in the two sequences, producing a <code>boolean</code> sequence. Feel free to browse the code for more <a href="https://github.com/ewilson/mastermind-java" target="_blank">Java</a>/<a href="https://github.com/ewilson/mastermind" target="_blank">Clojure</a> comparisons.</p>
<h3>Performance</h3>
<p>Unfortunately, Java clearly won regarding performance. I&#8217;m not going to include any numbers here, because benchmarking should be done with simpler algorithms, where it is more obviously a fair comparison. Nevertheless, I won&#8217;t be recommending Clojure for any performance intensive applications soon.</p>
<h3>Conclusion</h3>
<p>For algorithmic problems, the flexibility and functional semantics are a huge win for Clojure. The performance is a negative. I didn&#8217;t miss Java&#8217;s static typing either, but that&#8217;s unfair, given how small this project was. As for objects, I haven&#8217;t missed them so far, and I&#8217;m loving the ease of use of Clojure collections. Time for another Clojure project, this time something that makes use of Clojure&#8217;s concurrency language features.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/759/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/759/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=759&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/12/11/mastermind-in-clojure-and-java/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>

		<media:content url="http://wilsonericn.files.wordpress.com/2012/12/200px-mastermind.jpg" medium="image">
			<media:title type="html">200px-Mastermind</media:title>
		</media:content>
	</item>
		<item>
		<title>Don&#8217;t miss your exit</title>
		<link>http://wilsonericn.wordpress.com/2012/11/26/dont-miss-your-exit/</link>
		<comments>http://wilsonericn.wordpress.com/2012/11/26/dont-miss-your-exit/#comments</comments>
		<pubDate>Mon, 26 Nov 2012 17:42:36 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[books]]></category>
		<category><![CDATA[education]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=757</guid>
		<description><![CDATA[When I was an undergraduate, it bothered me that I never finished reading any of my math textbooks. But in graduate school, I noticed that I had learned much of the content of some of those unfinished chapters, and the content that was still mysterious seemed far less central to the subject than it had [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=757&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>When I was an undergraduate, it bothered me that I never finished reading any of my math textbooks. But in graduate school, I noticed that I had learned much of the content of some of those unfinished chapters, and the content that was still mysterious seemed far less central to the subject than it had previously.</p>
<p>Using a textbook or a technical book is like using a highway: To get where you want to go, you need to find the right exit. The end isn&#8217;t a real goal, and it likely isn&#8217;t that interesting, anyway.</p>
<p>How do you know when to exit? Know where you want to go. If your goals are very specific, this is trivial, and you can use the book as a reference, rather than reading. But if you are learning completely new technologies or concepts, it is sometimes hard to know where exactly you hope to go, but I find the following techniques useful:</p>
<ul>
<li>Read from a combination of sources: one or two books, along with tutorials and blog posts.</li>
<li>Combine the book learning with a toy project.</li>
<li>Pay attention to your progress &#8212; finding the material too difficult <em>could</em> be an indication that this isn&#8217;t what you most need to learn right now, or that it is poorly written.</li>
<li>Talk (you know, face-to-face) with others that have similar goals</li>
</ul>
<p>If you start with a goal, and continue to adjust your course appropriately, you make much progress with books, they will often take you within miles of your destination. But if you confuse the books with the goal, you can go the entire length of I-95 without seeing anything more interesting than some roadside attractions.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/757/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/757/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=757&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/11/26/dont-miss-your-exit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>Professional Networking for the Future Programmer</title>
		<link>http://wilsonericn.wordpress.com/2012/11/16/professional-networking-for-the-future-programmer/</link>
		<comments>http://wilsonericn.wordpress.com/2012/11/16/professional-networking-for-the-future-programmer/#comments</comments>
		<pubDate>Fri, 16 Nov 2012 17:59:43 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=751</guid>
		<description><![CDATA[So you&#8217;ve been studying computer science or a related field, and you are hoping to get a job as a programmer when you graduate. You do your best to keep a good GPA, and you are planning on applying to some internships. Maybe you have some hobby projects that you are working on to augment [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=751&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>So you&#8217;ve been studying computer science or a related field, and you are hoping to get a job as a programmer when you graduate. You do your best to keep a good GPA, and you are planning on applying to some internships. Maybe you have some hobby projects that you are working on to augment your resume.</p>
<p>But there&#8217;s another important part of the job-seeking process. The career services all tell you that networking is important, that you should &#8220;network&#8221; with professionals in your field, and develop those all-important contacts that lead to interviews and jobs. I&#8217;d guess that 90% of aspiring programmers make no effort to build a professional network before graduation, and that 90% of those that do try are completely ineffective. After all, if you enjoyed talking to strangers and building relationships, you wouldn&#8217;t be a computer science major, right?</p>
<p>Building a professional networking is actually not that difficult, it just looks very different from your imagination. <span id="more-751"></span></p>
<h3>Why networking is actually fun</h3>
<p>Professional networking amounts to building relationships with people that share your geeky interests. This isn&#8217;t AmWay here, this is talking about programming, software, languages, frameworks, and platforms! But how to begin?</p>
<h3>Start with the people you already know</h3>
<p>Do you know anyone that hires software developers and system engineers? Great! But most of you don&#8217;t. But you might know someone that knows such a person. And if you don&#8217;t, you surely know someone that knows someone that knows a hiring manager. So work through your network. Do your parents have friends in technology? Do your friends have parents in technology? Any relatives, or acquaintances from church that could help?</p>
<p>Don&#8217;t be too picky. Don&#8217;t imagine that you need to be connected to a engineer or a manager. Maybe your mom&#8217;s cousin works as a receptionist at tech company. Or maybe your neighbor is the maintenance man for an office building that houses several start-ups.</p>
<h3>Start meeting people in the industry</h3>
<p>Contact your mom&#8217;s cousin, and tell her what you are doing. Ask her for the name of an engineer that might be willing to meet with you. Make it clear that you are not asking for a job, just a chance to talk about what sort of work he does, what the company and industry are like, and what sort of things they look for in students coming out of college.</p>
<h3>Participate in user groups and conferences</h3>
<p>Find out what technology user groups are in your area, and pick one or two to attend regularly. Make sure to spend time every month working with the technologies, so that you have questions to ask. Bring your laptop, and be ready to open it up and ask questions about your code. Volunteering to help with the work of the group, whether giving a five minute talk or manning a registration table, can help to establish you as part of the community.</p>
<h3>Don&#8217;t be boring</h3>
<p>When you get an opportunity to talk with a programmer, keep the conversation on things he is interested in. Hopefully, he is interested in programming, technologies, software development, etc, so focus on these things. Ask him what he does specifically, and then keep asking him to dumb it down until you are learning something. If you don&#8217;t get to the point of understanding something of what he actually does, this will be rightly perceived as a lack of interest.</p>
<p>Remember that most people find themselves far more interesting than they find you, so don&#8217;t talk about yourself any more than necessary. If you want to ask questions about your future path, express them in terms of his experience: &#8220;What do you wish you knew when you were a sophomore in college?&#8221; If you want to talk about projects you have done, ask for his insight on how they can be improved.</p>
<h3>Avoid asking for a job.</h3>
<p>At some point, you will need to ask for a job, but put that off for as long as possible. Asking too early will establish you as a job-seeker in their mind. No one wants to hire the guy that wants to be given a job, we are looking for the guy that wants to do a job. So make sure your eagerness to do work is understood before you talk about positions or resumes.</p>
<h3>Think long term</h3>
<p>This is not a project to begin your senior year. And it doesn&#8217;t end when you get your first job. You should start building your network when you decide on your future profession, and you should work to maintain it until you retire. If you have waited to long, start now, but think towards your second job, don&#8217;t let your fear of unemployment stunt the growth of your network.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/751/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/751/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=751&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/11/16/professional-networking-for-the-future-programmer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>Surviving the technical interview</title>
		<link>http://wilsonericn.wordpress.com/2012/10/29/surviving-the-technical-interview/</link>
		<comments>http://wilsonericn.wordpress.com/2012/10/29/surviving-the-technical-interview/#comments</comments>
		<pubDate>Mon, 29 Oct 2012 16:25:49 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[career]]></category>
		<category><![CDATA[interview]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=742</guid>
		<description><![CDATA[As a programmer at a fast growing start-up, I&#8217;ve been able to gain a bit of experience on the other side of the table. I&#8217;m not a hiring manager or a recruiter, I don&#8217;t choose which resumes to call or negotiate salary and benefits. My part is the technical screening. Some technical interviews obvious successes, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=742&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>As a programmer at a fast growing start-up, I&#8217;ve been able to gain a bit of experience on the other side of the table. I&#8217;m not a hiring manager or a recruiter, I don&#8217;t choose which resumes to call or negotiate salary and benefits. My part is the technical screening.</p>
<p>Some technical interviews obvious successes, and many others are obvious failures. But there are many that are muddled and hard to interpret, often in ways that were preventable. Read on for my thoughts on how you can make the best of the technical interview.</p>
<h3><span id="more-742"></span>Know what is on your resume</h3>
<p>As you prepare for the interview, look at the most prominent items on your resume, and brush up on the details. You can&#8217;t be prepared for every question, but you can study like you would for a test. Not sure what to study? Start by pretending you are an interviewer, and coming up with a list of questions that would fit with your resume. Search for interview questions, and make sure you understand the answers. Ask your professional contacts and colleagues to interview you and to give an honest evaluation of your answers.</p>
<h3>Be prepared to code</h3>
<p>There is no shortage of programming problems on the internet. Start practicing. Can you implement merge-sort in every language on your resume? Why not? We will want to see that solving problems with code is something that is natural for you. Looking up a few things is okay, but I should be convinced that you work in this language, and are comfortable with it.</p>
<p>Do you like to code in Eclipse or Visual Studio? Maybe you should practice coding in more primitive environments. Write Java in Notepad++. Or on paper. When it comes time for a coding exercise in the interview, you should be eager to show that you can code, and that you don&#8217;t care whether it is on the whiteboard, or in nano, or with a magnetized needle.</p>
<h3>Expect far less than perfection</h3>
<p>If you draw a blank on the first three questions on your math final, things are very unlikely to end well. Interviews are very different. Sometimes the first five questions accomplish nothing more than establishing what types of questions I should be asking you. Similarly, while I have had students get perfect scores on exams that I have given, I hope to never finish a technical interview without asking a decent number of questions that the candidate cannot answer. I won&#8217;t understand the limits of your knowledge otherwise.</p>
<p>So don&#8217;t get rattled when you miss a question. Don&#8217;t be offended if you feel the question was unreasonable, and you don&#8217;t really need to remind me that you know how to use Google. A simple &#8220;I don&#8217;t know&#8221; is often the least painful way to move on to the next question.</p>
<h3>Don&#8217;t bluff</h3>
<p>One of the worst interview strategies is guessing. I don&#8217;t expect you to know everything, but I expect you to know what you know. I can&#8217;t expect you to solve problems effectively if you aren&#8217;t sure what you actually know, and what you only suspect. So answer confidently when you know. If you don&#8217;t know, it can be helpful to talk out what you suspect and to give a reason. But don&#8217;t bluff. It will make you appear both incompetent and dishonest.</p>
<h3>Make the most of what you know</h3>
<p>When I ask about something you know well, show me. Answer the question confidently and completely, and volunteer important related information. Tell me about what can go wrong with a lack of understanding of this issue. Show me the enthusiasm that I expect when I ask a colleague for help in his area of expertise &#8230; and the discernment that knows when you&#8217;ve said enough.</p>
<p>You will be most remembered for your best moments and your worst moments of the interview. A really good answer to one question can make up for quite a few blank spots. Did we fail to ask about your specialty? Feel free to volunteer information.</p>
<h3>Be useful</h3>
<p>Interviewing tips are just the finishing touches. Your career will depend on how consistently you are able to do useful work. So focus on improving your skills and understanding how your skills bring value to your business. If you do this, then it will be easy and enjoyable to show what you have to offer in an interview.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/742/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/742/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=742&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/10/29/surviving-the-technical-interview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>Hoping to leave class-oriented programming</title>
		<link>http://wilsonericn.wordpress.com/2012/10/18/hoping-to-leave-class-oriented-programming/</link>
		<comments>http://wilsonericn.wordpress.com/2012/10/18/hoping-to-leave-class-oriented-programming/#comments</comments>
		<pubDate>Thu, 18 Oct 2012 09:13:54 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[clojure]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jvm]]></category>
		<category><![CDATA[scala]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=735</guid>
		<description><![CDATA[Sometimes you need to pass around a function. In Java, since &#8220;Everything Is An Object&#8221;, you make a class, and define the function as a method in that class. Of course, you need a separate source files for this, since you want this class to be public. Before long, you find that in a different [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=735&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="alignright size-medium wp-image-740" title="Java" alt="" src="http://wilsonericn.files.wordpress.com/2012/10/java_logo-svg1.png?w=163&#038;h=300" height="300" width="163" />Sometimes you need to pass around a function. In Java, since &#8220;Everything Is An Object&#8221;, you make a class, and define the function as a method in that class. Of course, you need a separate source files for this, since you want this class to be public.</p>
<p>Before long, you find that in a different situation, you want to pass a different function, so you make an interface, another class, and make both classes extend the interface. Now the two functions that would have logically fit in some already existing file have generated three source files.</p>
<p>Does it have to be this way? It&#8217;s a lesser known fact that in Python, everything is an object. A function is an object, a class is an object, a <em>module</em> is an object. But somehow, a commitment to everything being an object didn&#8217;t lead Guido to conclude that everything should have it&#8217;s own class file. Somehow &#8220;Everything Is An Object&#8221; doesn&#8217;t imply (in Python or Ruby) that functions must be defined in classes.</p>
<p>I&#8217;ve been using Spring with Java, and that is certainly preferable to me than Java without Spring, for medium or large projects. But it strikes me that much of what Spring helps me manage is the simple fact that I need many functions available in situations where I don&#8217;t want to instantiate an object first. When I use Spring to inject a singleton object, often what I really want is a handful of related, stateless functions. I would guess that about well over half of the classes in my projects are essentially one of two things: glorified namespaces or data types without behavior.</p>
<p>More to the point, as I build complex applications, I fear that building them in Java significantly adds to the complexity. I fear that I&#8217;m building in a way that requires some acclimation to a handful of patterns and a framework that ultimately shift the complexity of the problem to a different sort of complexity. It seems that this is the best that the Java world allows: familiar patterns of complexity.</p>
<p>So what&#8217;s a Java developer to do? Where to go from here? <span id="more-735"></span>It&#8217;s time to learn another JVM language. Despite the abundance of JVM languages (Groovy, JRuby, Jython), only Scala and Clojure offer hope of reasonable performance. I was close to investing in Scala. It&#8217;s very flexible, far less verbose less verbose than Java, and it&#8217;s fast.  It has a much more sophisticated type system than Java, and has great support for concurrency. But I balked at Scala&#8217;s complexity. It&#8217;s type system is a bit much for the real world, and I worry about the multi-paradigm approach, allowing for object-oriented, proceedural, and functional programming.</p>
<p>If not Scala, then what? The only other option that looks like a potential path forward is Clojure. I&#8217;ve toyed with Scheme in the past long enough to get the hang of writing functions that end with a bunch of right-parens, but never long enough to understand what a substantial program would look like. I&#8217;m ready to give Clojure a real shot. I plan on spending at least a year with the language, trying to get to a real understanding of Clojure, Lisp, and the functional paradigm.</p>
<p>I&#8217;ve resisted the functional programming crowd for a few years. I haven&#8217;t been convinced that it is practical in the real world. I spent some time learning Haskell, and it reinforced that notion. I found it extremely enjoyable to write mathematical functions, solving a number of Project Euler problems in Haskell. But when your language requires the concept of a monad in order to do simple IO, then you have taken a wrong turn.</p>
<p>I&#8217;m hoping that I&#8217;ll find Clojure more pragmatic. In the end, I may find the kingdom of verbs is no better for building large complex systems. But even if I settle on Scala, Groovy, or another mult-paradigm approach in the long term, I expect that I need to immerse myself in the functional world first.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/735/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/735/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=735&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/10/18/hoping-to-leave-class-oriented-programming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>

		<media:content url="http://wilsonericn.files.wordpress.com/2012/10/java_logo-svg1.png?w=163" medium="image">
			<media:title type="html">Java</media:title>
		</media:content>
	</item>
		<item>
		<title>Using a Naive Bayes classifier for user submitted content</title>
		<link>http://wilsonericn.wordpress.com/2012/10/01/using-a-naive-bayes-classifier-for-user-submitted-content/</link>
		<comments>http://wilsonericn.wordpress.com/2012/10/01/using-a-naive-bayes-classifier-for-user-submitted-content/#comments</comments>
		<pubDate>Mon, 01 Oct 2012 17:21:46 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=729</guid>
		<description><![CDATA[I&#8217;ve enjoyed building a Naive Bayes classifier to classify user submitted content at Manta. I wrote a post about how one might implement this on Manta&#8217;s engineering blog. I&#8217;m giving a colloquium on this at Wittenberg University today, and the slides to that talk are available after the jump. &#160; If you are interested in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=729&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve enjoyed building a Naive Bayes classifier to classify user submitted content at <a title="Manta" href="http://manta.com" target="_blank">Manta</a>. I wrote a <a href="http://engineering.manta.com/2012/10/01/using-naive-bayes-to-classify-user-content/" target="_blank">post</a> about how one might implement this on <a href="http://engineering.manta.com/" target="_blank">Manta&#8217;s engineering blog</a>. I&#8217;m giving a colloquium on this at Wittenberg University today, and the slides to that talk are available after the jump.<span id="more-729"></span></p>
<iframe src='http://www.slideshare.net/slideshow/embed_code/14542404' width='700' height='574'></iframe>
<p>&nbsp;</p>
<p>If you are interested in machine learning at all, I think that a Naive Bayes classifier is a really good place to start, especially if you have half a semester&#8217;s understanding of probability.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/729/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/729/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=729&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/10/01/using-a-naive-bayes-classifier-for-user-submitted-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>The simplest thing that could possibly work left me wanting more</title>
		<link>http://wilsonericn.wordpress.com/2012/09/11/the-simplest-thing-that-could-possibly-work-left-me-wanting-more/</link>
		<comments>http://wilsonericn.wordpress.com/2012/09/11/the-simplest-thing-that-could-possibly-work-left-me-wanting-more/#comments</comments>
		<pubDate>Tue, 11 Sep 2012 09:37:07 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[deployment]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=293</guid>
		<description><![CDATA[One of the mantras of the Agile community is that you do &#8220;the simplest thing that could possibly work.&#8221; As I tried to follow this maxim when launching two personal projects (a batch job that sends tweets, and a web application for home use) I found myself wishing that I had done more. Such as: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=293&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>One of the mantras of the Agile community is that you do &#8220;the simplest thing that could possibly work.&#8221; As I tried to follow this maxim when launching two personal projects (a batch job that sends tweets, and a web application for home use) I found myself wishing that I had done more. Such as:</p>
<p><span id="more-293"></span></p>
<h3>Set up my router to allow remote ssh access.</h3>
<p>This didn&#8217;t seem so important in development. But on the day that I realized while driving to work that I needed to manually run the batch job (due to an error I introduced in crontab), remote access seemed more important. And the day that I discovered a potential error as I was trying to leave town with my family for the weekend, I realized that remote access was completely essential, for any application in production.</p>
<h3>Set up good logging:</h3>
<p>For the batch job, it was obvious that logging was essential. But for the web app, I left it out. After all, when things didn&#8217;t work, I could always look at the console output. But as I considered advertising my modest web application to others that might find it useful, I realized that I would really like to know how frequently my application was being used, and by how many people.</p>
<h3>Prepare to recover from errors:</h3>
<p>During one of the first runs of my batch script an error occurred that left my application in an intermediate state. Fixing the error in the code and re-running the job wasn&#8217;t sufficient, since the database had changed. I needed to write an ad-hoc re-run script to finish the job correctly. Of course, since it is my production database that has this problem, I found myself testing that re-run script in production.</p>
<h3>The common theme:</h3>
<p>There are some other little things, but you get the point. So what went wrong? Is &#8220;Do The Simplest Thing That Could Possibly Work&#8221; bad advice? Or am I just really bad at determining what can work?</p>
<p>I think that it&#8217;s easy for developers to grab that mantra and do the simplest thing that could possibly work &#8212; <em>in development</em>. Some simple things that can work in development, simply can&#8217;t work in production. It&#8217;s an easy trap, because developers live in (where else?) development, where certain types of production issues never arise.</p>
<p>I still plan to do the simplest thing that could possibly work. First in development, and then in production &#8230; and both <em>before</em> initial deployment. And as I gain experience, I&#8217;m sure that my view of what &#8220;can work&#8221; will grow to the point where such mantras are in fact useful, and not merely a seductive trap.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/293/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/293/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=293&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/09/11/the-simplest-thing-that-could-possibly-work-left-me-wanting-more/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>Don&#8217;t forget Erlang</title>
		<link>http://wilsonericn.wordpress.com/2012/09/05/dont-forget-erlang/</link>
		<comments>http://wilsonericn.wordpress.com/2012/09/05/dont-forget-erlang/#comments</comments>
		<pubDate>Wed, 05 Sep 2012 10:25:55 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[erlang]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[lisp]]></category>
		<category><![CDATA[recursion]]></category>
		<category><![CDATA[scheme]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=706</guid>
		<description><![CDATA[Everyone should learn to think functionally and recursively. But how? With which language? I think that one of the best options for functional programming is largely overlooked &#8230; Lisp At some point in your computer science education you were probably exposed to Lisp. Perhaps you worked through part of the SICP book, or maybe The [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=706&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><img class="alignright  wp-image-710" title="erlang" src="http://wilsonericn.files.wordpress.com/2012/09/erlang.jpg?w=140&#038;h=125" alt="" width="140" height="125" />Everyone should learn to think functionally and recursively. But how? With which language? I think that one of the best options for functional programming is largely overlooked &#8230;<span id="more-706"></span></p>
<h2>Lisp</h2>
<p>At some point in your computer science education you were probably exposed to Lisp. Perhaps you worked through part of the <a href="http://mitpress.mit.edu/sicp/" target="_blank">SICP book</a>, or maybe <a href="http://www.amazon.com/The-Little-Schemer-4th-Edition/dp/0262560992" target="_blank">The Little Schemer</a>. If not, I <a href="http://wilsonericn.wordpress.com/2012/01/02/book-review-the-little-schemer-by-daniel-friedman/" target="_blank">highly recommend the latter</a>.</p>
<p>But most of us get tired of Lisp. Even though it has been used very effectively in cases, it feels like a trick, an academic ploy to unsettle our previous convictions about programming languages.</p>
<h2>Haskell</h2>
<p>If you are still interested in functional languages, you are likely to try Haskell next. (Probably starting with <a href="http://learnyouahaskell.com/" target="_blank">Learn You A Haskell</a>.) Haskell has enough syntax to feel like a real language, and if (like me) you have a background in mathematics, it is loads of fun. I spent some time working <a href="http://projecteuler.net/" target="_blank">Project Euler</a> problems in Haskell (<a href="https://github.com/ewilson/haskell-euler" target="_blank">here</a>), and it felt like cheating. Once a problem is solved mathematically, it isn&#8217;t much trouble to translate it to Haskell.</p>
<p>Haskell isn&#8217;t just for mathematics, of course. It is a great place to learn to think functionally, and to gain comfort with recursion and functional concepts like map, filter, and fold.</p>
<p>But Haskell wore me out in the end. The quest for functional purity has lead Haskell to an impractical place, which was never more clear to me than the day that I spent several hours studying monads so that I could read from a text file. It was that day that I was convinced that Haskell would never be relevant in industry.</p>
<h2>Erlang</h2>
<p>Recently I started learning Erlang on a whim, using <a href="http://learnyousomeerlang.com/" target="_blank">Learn You Some Erlang</a>. It&#8217;s my favorite so far. It&#8217;s not painful to read, like Lisp. And I don&#8217;t have to worry about types and monads, like in Haskell. You are required to think functionally, as you cannot change the state of a variable &#8230; but Erlang doesn&#8217;t worry about purity, which is refreshing.</p>
<p>Erlang is clearly not my first functional language, but I think that it would be an excellent choice as such. It lacks the most intimidating aspects of Lisp and Haskell, but without allowing for procedural code. And as a bonus, Erlang has some sort of super-awesome concurrency model that is extremely parallelizable. I don&#8217;t know anything about this yet, but I&#8217;m looking forward to learning about it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/706/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/706/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=706&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/09/05/dont-forget-erlang/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>

		<media:content url="http://wilsonericn.files.wordpress.com/2012/09/erlang.jpg?w=300" medium="image">
			<media:title type="html">erlang</media:title>
		</media:content>
	</item>
		<item>
		<title>Maintenance is no fun</title>
		<link>http://wilsonericn.wordpress.com/2012/05/28/maintenance-is-no-fun/</link>
		<comments>http://wilsonericn.wordpress.com/2012/05/28/maintenance-is-no-fun/#comments</comments>
		<pubDate>Mon, 28 May 2012 15:38:28 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[projects]]></category>
		<category><![CDATA[maintenance]]></category>
		<category><![CDATA[py3k_update]]></category>
		<category><![CDATA[python3]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=701</guid>
		<description><![CDATA[I had fun creating @py3k_update, a twitter account that would send tweets announcing new libraries that are python 3 compatible. More here: http://wilsonericn.wordpress.com/2011/09/06/python-3-library-updates-via-twitter/ But when the page that I was scraping changed format, there was no joy in figuring out what to change to get the updates working accurately. I&#8217;ve got other fun and worthwhile [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=701&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I had fun creating @py3k_update, a twitter account that would send tweets announcing new libraries that are python 3 compatible. More here: <a href="http://wilsonericn.wordpress.com/2011/09/06/python-3-library-updates-via-twitter/" rel="nofollow">http://wilsonericn.wordpress.com/2011/09/06/python-3-library-updates-via-twitter/</a></p>
<p>But when the page that I was scraping changed format, there was no joy in figuring out what to change to get the updates working accurately. I&#8217;ve got other fun and worthwhile things to do, both in programming, and in real life.</p>
<p>So thanks much to the 200+ folks that found @py3k_update worth following, I hope that you appreciated what it did provide, and aren&#8217;t too disappointed to see its demise.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/701/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/701/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=701&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/05/28/maintenance-is-no-fun/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
		<item>
		<title>Code before Calculus</title>
		<link>http://wilsonericn.wordpress.com/2012/05/15/code-before-calculus/</link>
		<comments>http://wilsonericn.wordpress.com/2012/05/15/code-before-calculus/#comments</comments>
		<pubDate>Tue, 15 May 2012 16:55:55 +0000</pubDate>
		<dc:creator>Eric Wilson</dc:creator>
				<category><![CDATA[commentary]]></category>
		<category><![CDATA[computer-science]]></category>
		<category><![CDATA[education]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://wilsonericn.wordpress.com/?p=693</guid>
		<description><![CDATA[Jeff Atwood posted a thought provoking post that I very much wanted to disagree with. He argues that most people will not benefit from learning to code, and that coding is not at all similar to those fundamental skills (reading, writing, mathematics) that everyone should know. He&#8217;s certainly correct. Most of my friends and relatives [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=693&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Jeff Atwood posted a <a href="http://www.codinghorror.com/blog/2012/05/please-dont-learn-to-code.html" target="_blank">thought provoking post</a> that I very much wanted to disagree with. He argues that most people will not benefit from learning to code, and that coding is not at all similar to those fundamental skills (reading, writing, mathematics) that everyone should know. He&#8217;s certainly correct. Most of my friends and relatives do not know how to program anything, and they don&#8217;t suffer for that ignorance.</p>
<p>But the post bothered me. I don&#8217;t just enjoy programming, I enjoy teaching young people to program, and I have often told technically minded young men that it is essential that they learn programming skills. I also enjoy advanced mathematics, and I have very much enjoyed teaching calculus, linear algebra, probability, abstract algebra, and topology. Math is more fun for me than programming, but somehow &#8230;<span id="more-693"></span>I don&#8217;t encourage bright young men to pursue mathematics. Moreover, since leaving academia, I haven&#8217;t looked for any opportunities to teach mathematics outside of my family. I do look for opportunities to teach programming, as I think it is an extremely useful skill, both for the professional opportunities, and for use in other technical vocations.</p>
<p>So Jeff is correct in that the notion that everyone should code is absurd. But let&#8217;s forget about &#8220;everyone&#8221; and ask ourselves what we should teach those bright young men that want to solve technical problems. Currently we teach them Algebra, Geometry, Trigonometry, Calculus, Biology, Chemistry, and Physics. For those of you that solve technical problems for a living, which is more valuable: coding skills or derivatives and integrals?</p>
<p>I don&#8217;t think I need to look up the numbers to convince you that far more men pay their bills with programming skills than with mathematics expertise. From my personal experience, as I was changing vocations from academia to software development, there was never a time that someone suggested that my calculus skills would be useful for a particular type of job. Moreover, I don&#8217;t know of anyone that regularly uses higher mathematics in work outside of academia without also using programming skills.</p>
<p>Programming isn&#8217;t for everyone. But is far more practically useful than Calculus, while still providing the benefits of exercising logical thinking skills. As one that loves mathematics more than code, but cares even more about training our young men effectively, it is time for programming to have a real place in the high school and college math/science curriculum.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wilsonericn.wordpress.com/693/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wilsonericn.wordpress.com/693/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wilsonericn.wordpress.com&#038;blog=25747652&#038;post=693&#038;subd=wilsonericn&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://wilsonericn.wordpress.com/2012/05/15/code-before-calculus/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/d7f82cba9dbc95e901b4280ab315bbf1?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">wilsonericn</media:title>
		</media:content>
	</item>
	</channel>
</rss>
