<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:gd="http://schemas.google.com/g/2005" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;CEEHQXs8eCp7ImA9WxFbEkk.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502</id><updated>2010-07-04T07:23:50.570-04:00</updated><title>Colin's Devlog</title><subtitle type="html">Thoughts on software development, technology, etc.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://blog.cgdecker.com/" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>5</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/cgdecker" /><feedburner:info uri="cgdecker" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;AkUFR3k-eip7ImA9WxFVGE4.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502.post-4940860598913688780</id><published>2010-06-18T01:09:00.001-04:00</published><updated>2010-06-18T01:16:56.752-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-06-18T01:16:56.752-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="guava" /><title>Property interfaces and Guava functional programming</title><content type="html">Something that I’ve been thinking about lately is how I can make it easier to use &lt;a href="http://code.google.com/p/guava-libraries/"&gt;Guava&lt;/a&gt;’s methods that operate on &lt;a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/base/Function.html"&gt;Function&lt;/a&gt;s, &lt;a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicate.html"&gt;Predicate&lt;/a&gt;s, etc.

&lt;p&gt;
One simple use for &lt;code&gt;Function&lt;/code&gt;s is to get properties of objects, allowing you to (among other things) create a transformed view of a collection containing a certain property from each element. For example, transforming a list of &lt;code&gt;Person&lt;/code&gt; objects to a &lt;code&gt;String&lt;/code&gt; collection of names. Any time you want to do something with a collection of objects based on a certain property of those objects, this is useful.

&lt;p&gt;
However, it's rather ugly and awkward to have to create an anonymous inner class inline when calling a method that uses a &lt;code&gt;Function&lt;/code&gt;. While you can create &lt;code&gt;static final&lt;/code&gt; instances of such functions and methods that return instances of functions, with many classes you could end up with many such instances and methods. One good way to reduce the number of &lt;code&gt;Function&lt;/code&gt; objects you need to create and make it easy to work with certain common properties (such as IDs, names, etc.) on many objects is to create interfaces that each expose a single such property:

&lt;pre class="brush: java"&gt;
interface HasId {
   Long getId();
}
&lt;/pre&gt;

Not only does this help add consistency to your classes, it allows you to collect behavior that can work on any type of object that has the property the interface exposes. I'd probably name such classes as the plural of the property name ("Ids" and "Names", for example).

&lt;pre class="brush: java"&gt;
class Ids {
  private Ids() {}

  public static final Function&amp;lt;HasId, Long&amp;gt; GET = 
    new Function&amp;lt;HasId, Long&amp;gt;() {
      public Long apply(HasId hasId) {
        return hasId.getId();
      }
  };

  public static Iterable&amp;lt;Long&amp;gt; of(
      Iterable&amp;lt;? extends HasId&amp;gt; items) {
    return Iterables.transform(items, GET);
  }
}
&lt;/pre&gt;

This makes working with the IDs of a list of things with IDs as easy as possible:

&lt;pre class="brush: java"&gt;
List&amp;lt;Person&amp;gt; people = ...
for(Long id : Ids.of(people)) { ... }
&lt;/pre&gt;

The &lt;code&gt;GET&lt;/code&gt; function is exposed to allow its use for anything you might want a function for, not just &lt;code&gt;tranform&lt;/code&gt;. For example, with a &lt;code&gt;HasName&lt;/code&gt; interface and &lt;code&gt;Names&lt;/code&gt; class similar to the code for IDs, I could do something like this:

&lt;pre class="brush: java"&gt;
List&amp;lt;Person&amp;gt; people = ...
Iterable&amp;lt;Person&amp;gt; bobs = filter(people, compose(equalTo("Bob"),
  Names.GET));
&lt;/pre&gt;

This would of course filter a list of people to an iterable that only includes people with the name Bob. It uses static imports (because they make this stuff read a lot nicer), and the methods are:

&lt;ul&gt;
&lt;li&gt;&lt;a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/collect/Iterables.html#filter%28java.lang.Iterable,%20com.google.common.base.Predicate%29"&gt;Iterables.filter(Iterable,Predicate)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicates.html#compose%28com.google.common.base.Predicate,%20com.google.common.base.Function%29"&gt;Predicates.compose(Predicate,Function)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://guava-libraries.googlecode.com/svn/trunk/javadoc/com/google/common/base/Predicates.html#equalTo%28T%29"&gt;Predicates.equalTo(T)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

I think this approach can make working with the properties of objects using &lt;code&gt;Function&lt;/code&gt;s a lot easier and cleaner, while also encouraging more consistency between classes in general, which is nice.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7868950962679865502-4940860598913688780?l=blog.cgdecker.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cgdecker/~4/HC_sdCjGqCs" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/4940860598913688780/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cgdecker.com/2010/06/property-interfaces-and-guava.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/4940860598913688780?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/4940860598913688780?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cgdecker/~3/HC_sdCjGqCs/property-interfaces-and-guava.html" title="Property interfaces and Guava functional programming" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03365031584286747233" /></author><thr:total>1</thr:total><feedburner:origLink>http://blog.cgdecker.com/2010/06/property-interfaces-and-guava.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0YMR34ycSp7ImA9WxBaFUs.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502.post-379512074303958130</id><published>2010-03-25T22:06:00.000-04:00</published><updated>2010-03-25T22:06:26.099-04:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-03-25T22:06:26.099-04:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="rant" /><category scheme="http://www.blogger.com/atom/ns#" term="java" /><category scheme="http://www.blogger.com/atom/ns#" term="ui" /><title>Get your UI out of my logic</title><content type="html">&lt;pre class="brush: java"&gt;
public enum Type {
  Select,
  TypeA,
  TypeB,
  TypeC;
}
&lt;/pre&gt;
This used in a domain object.

&lt;p&gt;I've also seen a list of objects retrieved from the database and put into an Object array with "Select" as array[0] and the rest of the objects being actual objects someone might care about. Let's just have everyone remember what type of objects are in this array, and they should also remember that the first element isn't one of those!&lt;/p&gt;

&lt;p&gt;I can't imagine what people find so hard about producing a new list or whatever to base their combo box model on at the time that the combo box is actually created. Furthermore, with something like the &lt;code&gt;enum&lt;/code&gt; above, the enum constants use lowercase letters because it'll look nicer when they're rendered in the UI using the default &lt;code&gt;toString()&lt;/code&gt;. The use of &lt;code&gt;toString()&lt;/code&gt; to produce the text for the UI in general bothers me. I want it to produce text that's helpful to me in error messages... use some other means for rendering it to users.&lt;/p&gt;

&lt;p&gt;I guess what I want to say is: keep user interface concerns where they belong, near the user interface!&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7868950962679865502-379512074303958130?l=blog.cgdecker.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cgdecker/~4/505XnZ_qnmA" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/379512074303958130/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cgdecker.com/2010/03/get-your-ui-out-of-my-logic.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/379512074303958130?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/379512074303958130?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cgdecker/~3/505XnZ_qnmA/get-your-ui-out-of-my-logic.html" title="Get your UI out of my logic" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03365031584286747233" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cgdecker.com/2010/03/get-your-ui-out-of-my-logic.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUIHSHk4fyp7ImA9WxBXEk0.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502.post-4609571649438552491</id><published>2010-01-22T18:38:00.000-05:00</published><updated>2010-01-22T18:38:59.737-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-22T18:38:59.737-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="guice" /><category scheme="http://www.blogger.com/atom/ns#" term="dependency injection" /><title>What's the issue with @Inject?</title><content type="html">&lt;p&gt;Reading Uncle Bob's recent &lt;a href="http://blog.objectmentor.com/articles/2010/01/17/dependency-injection-inversion"&gt;post about dependency injection frameworks&lt;/a&gt;, I noticed that quite a few people seemed to be treating the use of &lt;a href='http://code.google.com/p/google-guice/'&gt;Guice&lt;/a&gt;'s &lt;code&gt;@Inject&lt;/code&gt; annotation in their application code as a reason to prefer other DI frameworks to Guice. For the most part, none of them provided any explanation for why using the annotation in application code was a problem other than "I don't like it". Even ignoring the fact that &lt;a href='http://code.google.com/p/atinject/'&gt;JSR-330&lt;/a&gt; standardizes the only annotations and the one interface from Guice that are used in application code and will be usable with Guice 2.1, I find it difficult to understand these points of view. What's the issue people have with it?&lt;/p&gt;

&lt;h3&gt;Why it's good&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;@Inject&lt;/code&gt; is just one annotation that, in a typical concrete class, will be used on one constructor and MAYBE a couple setters. It allows dependencies to be injected without any explicit configuration of the Spring XML form while retaining &lt;b&gt;safe&lt;/b&gt; and predictable behavior by ensuring that injections always take place using the exact constructors and methods you want to use. It saves you from ever having to specify anything using strings, making it possible to refactor and rename classes and methods without any risk of breaking your DI configuration... I think this is an extremely important point. It generally doesn't allow anything &lt;b&gt;unexpected&lt;/b&gt; to happen.&lt;p&gt;

&lt;h3&gt;Tied to the framework?&lt;/h3&gt;

&lt;p&gt;I feel like the knee-jerk reaction to using &lt;code&gt;@Inject&lt;/code&gt; in classes is that by doing that, you're somehow tying yourself to Guice. As Uncle Bob put it, 

&lt;blockquote&gt;I don’t want to write a &lt;i&gt;Guice&lt;/i&gt; application. Guice is a framework, and I don’t want framework code smeared all through my application. [...] I don’t want to have &lt;code&gt;@Inject&lt;/code&gt; attributes everywhere [...]&lt;/blockquote&gt;

I understand that when he says this, Uncle Bob is arguing against using DI frameworks in general. Ignoring that argument for now and accepting that DI frameworks are worth using, the fact is that if you're using a DI framework, you are tying yourself to it. It's how your application is configured, unless you're doing all the work to create an alternate way of wiring the application together in which case... why? If you choose to switch to another DI framework or stop using a DI framework entirely (and how likely are either of these, really?) it is going to involve some work to remove the existing configuration and write the new configuration. And removing a bunch of &lt;code&gt;@Inject&lt;/code&gt; annotations would be an absolutely trivial part of that.

&lt;h3&gt;Annotations are not code&lt;/h3&gt;

&lt;p&gt;I think it's important to note that annotations are not code. By themselves, they do nothing. You can use a class even without the annotations on its elements available on the classpath. When writing tests, you can completely ignore them. Guice's annotations will also never be in the &lt;i&gt;body&lt;/i&gt; of your code, meaning you should generally be able to ignore them when reasoning about how a class behaves. One comment I read (from a Spring XML user) stated that the commenter considered annotations "just as bad" as code and likened the &lt;code&gt;@Inject&lt;/code&gt; annotation to providing your classes with the &lt;code&gt;ApplicationContext&lt;/code&gt; (Spring's central container interface). This is, of course, way off base. Providing programmatic access to the central container ties the code itself to the DI framework. The class can then use the framework's code directly to get access to any object it wants, anywhere in its code. Testing the class would require configuring a container and looking through the class to see what needs to be in it. The framework becomes a Service Locator framework. The &lt;code&gt;@Inject&lt;/code&gt; annotation imposes no such thing.&lt;/p&gt; 

&lt;p&gt;In general, I think the benefits provided by Guice and the configuration safety provided by the use of &lt;code&gt;@Inject&lt;/code&gt; &lt;b&gt;far&lt;/b&gt; outweigh the at most minor annoyance of placing an annotation or so per injectable class. In future posts I'd like to talk more about what I like about dependency injection and Guice.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7868950962679865502-4609571649438552491?l=blog.cgdecker.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cgdecker/~4/K983h4bkrTc" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/4609571649438552491/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cgdecker.com/2010/01/whats-issue-with-inject.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/4609571649438552491?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/4609571649438552491?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cgdecker/~3/K983h4bkrTc/whats-issue-with-inject.html" title="What's the issue with @Inject?" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03365031584286747233" /></author><thr:total>2</thr:total><feedburner:origLink>http://blog.cgdecker.com/2010/01/whats-issue-with-inject.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUQERH46cCp7ImA9WxBXEEQ.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502.post-5861264689046315385</id><published>2009-07-10T02:06:00.000-04:00</published><updated>2010-01-21T13:08:25.018-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-21T13:08:25.018-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="git" /><title>Git and CVS</title><content type="html">In my &lt;a href="http://blog.cgdecker.com/2009/07/learning-git.html"&gt;last post&lt;/a&gt; I talked a little about my experience starting to learn to use Git. Now I'm going to talk about what I'm doing with it currently in an environment where Git can't be used as the end-to-end version control system (at least not immediately).&lt;br /&gt;
&lt;h4&gt;The Situation&lt;/h4&gt;At work we're using CVS for a legacy project that I'm working on. It's been around a while and the practices with it are pretty set. Branches are used for release versions of the product and that's about it. I tend to have a feature or two I'm working on and I also occasionally do something experimental. The trouble is, getting changes related to separate things mixed together can make it confusing to know what needs to be committed and what doesn't when it comes time to commit something (committing early and often would help with this, but it's not quite how things are done). Especially problematic would be if changes related to different things affected the same file.&lt;br /&gt;
&lt;br /&gt;
To deal with this, I'd sometimes check out a separate copy of the project into another directory and work on something specific there, but this wasn't very efficient. I'm programming in Java using Eclipse, and in addition to the issue of keeping track of multiple complete copies of the project, I'd have to switch workspaces or open up another copy of Eclipse to work with those copies. This wasn't very efficient.&lt;br /&gt;
&lt;h4&gt;The Solution&lt;/h4&gt;When I started looking into Git and experimenting with it, I realized that I could probably use it locally with a totally different VCS acting as the central repository. Git stores all its data in a single folder in the root of the working directory, which means that its files aren't mixed into your entire directory structure the way they are with CVS and its CVS subdirectories in every directory.&lt;br /&gt;
&lt;br /&gt;
Here's the process I used to get this project set up for work with Git:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Check out a clean copy of the project into a new directory to use.&lt;/li&gt;
&lt;li&gt;Get the environment all set up for normal use in Eclipse.&lt;/li&gt;
&lt;li&gt;Do &lt;code&gt;git init&lt;/code&gt; to create the Git repository at the root of the project.&lt;/li&gt;
&lt;li&gt;Create and set the .gitignore file, having it ignore compiled code output folders, among other things. &lt;strong&gt;(Note: It should also ignore all CVS folders.)&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;git add .&lt;/code&gt; everything that isn't ignored, making sure you aren't getting anything you don't want to.&lt;/li&gt;
&lt;li&gt;Do the initial &lt;code&gt;git commit&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;From there, use Git normally... create a development branch, and branches off that for features, experiments, etc.&lt;/li&gt;
&lt;li&gt;When you're ready to commit something to CVS, merge the changes all the way down to the master branch and commit in CVS.&lt;/li&gt;
&lt;/ul&gt;When I switch branches, I just refresh the project in Eclipse and it immediately reflects the branch I'm now on. Since the files that exist may differ between branches, I also like to use tasks in Mylyn. I have tasks that are specific to whatever I'm doing on a specific branch, and I activate them while working on them. I'd done a little of that before, but it's even more useful in this situation. If I'm working on some files and need to switch to another branch that doesn't have them, I just deactivate the task and the editor tabs go away. I switch branches, do whatever I need, and then when I switch back and activate the task. Despite the fact that the files ceased to exist on the files system for a while, when the task is reactivated the files are right back there like before!&lt;br /&gt;
&lt;br /&gt;
This approach has made it far easier and more fun to work on multiple separate things at once, and it's easy to do even though the central repository is the ancient CVS! Thanks for being awesome, Git!&lt;br /&gt;
&lt;br /&gt;
&lt;strong&gt;Update:&lt;/strong&gt;&lt;br /&gt;
&lt;br /&gt;
How you interact with CVS when doing this is important. First, the .gitignore file should be set to ignore all CVS folders! You don't want changes to the files in the CVS folders to have to be committed to your Git repository. You want to ignore the fact that you're also using CVS as much as possible. Given that, you should also only ever update from CVS or commit to CVS from your master branch! Things can get really weird if you update or commit in a branch you've created.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7868950962679865502-5861264689046315385?l=blog.cgdecker.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cgdecker/~4/g8YzK8Xs7J0" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/5861264689046315385/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cgdecker.com/2009/07/git-and-cvs.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/5861264689046315385?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/5861264689046315385?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cgdecker/~3/g8YzK8Xs7J0/git-and-cvs.html" title="Git and CVS" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03365031584286747233" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cgdecker.com/2009/07/git-and-cvs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0YGR3s7eip7ImA9WxBXEEk.&quot;"><id>tag:blogger.com,1999:blog-7868950962679865502.post-6206667188805739708</id><published>2009-07-08T04:04:00.001-04:00</published><updated>2010-01-20T21:32:06.502-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-20T21:32:06.502-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="tools" /><category scheme="http://www.blogger.com/atom/ns#" term="git" /><title>Learning Git</title><content type="html">One thing that I've been realizing more and more recently is the importance of keeping up with advancements in developer tools. I'm a strong believer that if you aren't using the best tools available for the job you're doing, you aren't being as effective as you could be, regardless of how much effort you put in to it. Plus, as a &lt;a href="http://blogoscoped.com/archive/2005-08-24-n14.html" target="_blank"&gt;lazy programmer&lt;/a&gt; I certainly don't want to put more effort in to something when a better tool could save me from that.&lt;br /&gt;
&lt;br /&gt;
Up until recently, I'd only used CVS and Subversion for source control... CVS at work and a little in college, and Subversion at home because I knew it was more recent than CVS. As I started to pay more attention to what I was seeing around the web on blogs and &lt;a href="http://news.ycombinator.com/" target="_blank"&gt;Hacker News&lt;/a&gt;, I began to notice a lot of positive references to &lt;a href="http://git-scm.com/" target="_blank"&gt;Git&lt;/a&gt;. It seemed a little intimidating to me, at first... largely command line based, with no full-featured shell integration like Tortoise for Windows? I didn't know about that... I like just right-clicking on files for diffs, commits, etc.&lt;br /&gt;
&lt;br /&gt;
Tales of the wonders of branching in Git were probably what brought me around to finally try it out this weekend... well, that and &lt;a href="https://github.com/" target="_blank"&gt;GitHub&lt;/a&gt;, which is awesome. Anyway, on sitting down and starting to learn it I discovered that it really wasn't hard at all to pick up. A quick &lt;code&gt;git init&lt;/code&gt;, &lt;code&gt;git add .&lt;/code&gt; and &lt;code&gt;git commit&lt;/code&gt; and I had a small existing project that I hadn't put in version control yet committed to a Git repository. And from there, pushing it to a repo on GitHub was incredibly easy as well. I then spent some time experimenting with branching and merging and all that fun stuff. I'll admit that I certainly still don't know all the intricacies of it, but the basic process was as easy and wonderful and rainbows as advertised.&lt;br /&gt;
&lt;br /&gt;
One of the things I &lt;em&gt;really love&lt;/em&gt; about Git is the fact that it uses a local repository in addition to a remote one (and that only if you want/need it to). Branches are such a great way of keeping logically separate units of work... well, separate, and that includes experimental changes. It's nice to be able to have experimental branches without them needing to be stored in the central repository that everyone on a project uses. Also great is the concept of the working directory, and how easily and quickly the files in it change as you change branches. Having one directory you can work from with all the different branches of your project has many advantages. I think I'll get in to that and some details of how I'm starting to make use of Git at work in my next post, which will probably be related to using Git locally with a central CVS repository.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7868950962679865502-6206667188805739708?l=blog.cgdecker.com' alt='' /&gt;&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/cgdecker/~4/8v4PnzbU8xU" height="1" width="1"/&gt;</content><link rel="replies" type="application/atom+xml" href="http://blog.cgdecker.com/feeds/6206667188805739708/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://blog.cgdecker.com/2009/07/learning-git.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/6206667188805739708?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/7868950962679865502/posts/default/6206667188805739708?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/cgdecker/~3/8v4PnzbU8xU/learning-git.html" title="Learning Git" /><author><name>Colin</name><uri>http://www.blogger.com/profile/15553994884731312441</uri><email>noreply@blogger.com</email><gd:extendedProperty name="OpenSocialUserId" value="03365031584286747233" /></author><thr:total>0</thr:total><feedburner:origLink>http://blog.cgdecker.com/2009/07/learning-git.html</feedburner:origLink></entry></feed>
