LINQPad sponsors STL ALT.NET

LINQPadI remember when LINQ was the new hotness. When developers realized that they could stop writing `for` and `foreach` loops to farm data from collections. It was a magical time, full of unicorns and rainbows and such. In this midst of this bliss Joseph Albahari, author of the excellent C# in a Nutshell, released a small program called LINQPad that functioned as both a pseudo-C# LINQ REPL and a light-weight frontend to SQL Server (via LINQ2SQL). Using LINQPad was (and still is) a great way to explore the LINQ API without breaking actual production code. Since those early days, LINQPad has grown to support all of the major LINQ technologies and other data providers, including:

  • Entity Framework
  • LINQ to XML
  • Parallel LINQ
  • OData
  • WCF Data Services
  • SQL Azure
  • and many more!

In addition, LINQPad can also serve as an F# REPL, for those of the functional persuasion who would like more flexibility than FSI provides. LINQPad is also extensible. When I worked with Josh Buedel, he created a plugin for LINQPad that queried an XML web service exposed by an online billing provider that we were using at the time. Using LINQPad, we could write LINQ queries against the service endpoints as if they were object collections, which made debugging service issues and generating ad hoc reports a breeze. While LINQPad has always been free, users who wanted auto-completion, Reflector integration, smart tags, code snippets, etc. paid a premium fee for the Pro version of LINQPad. Mr. Albahari has generously donated two Pro licenses to STL ALT .NET, which will be raffled to members in the coming months. Two lucky winners will walk away with great software that no .NET developer should be without!

Historical JavaScript Objects

For the last several weeks I have been trying to “think like JavaScript”. If JavaScript were a movie, Tim Burton would direct and his token boy Johnny Depp would be the lead, most likely wearing an outlandish costume and twirling mammoth daisies or something. At least, this is how I see it in my mind. JavaScript objects are… flexible. Contortionist flexible. Its actually a little scary. So I decided that, if I were truly going to be productive with this language, I would need abuse the hell out of them to find out where exactly their limits lie. I am going to warn you now: my latest experiment is exactly that. If you find it interesting, enticing, or perhaps seductive, you bear all the risks of its use! I will have none of your complaints!

“For this I had deprived myself of rest and health. I had desired it with an ardour that far exceeded moderation; but now that I had finished, the beauty of the dream vanished, and breathless horror and disgust filled my heart.” -- Doctor Frankenstein, shortly after he finished his JavaScript example

This is a story of inheritance. In JavaScript, all objects have a .prototype property, which points to some object instance. When an object literal (or hash) is created, the .prototype property defaults to `Object.prototype`, a default object instance with very few members (think of this as the “Object” object in C#). [javascript] var instance = {}; var what = Object.getPrototypeOf(instance) === Object.prototype; //true [/javascript] _[EDIT: As @stranger pointed out in the comments at the end, object literals do not have a .prototype property. Most browsers provide a non-standard .\_\_proto\_\_ convenience property, which can be used to access the prototype object for both literals and function objects.]_ Another way to create object instances in JavaScript is to use constructor functions with the `new` keyword. These functions also have a .prototype property which can be set to an instance of an object literal. This is typically done before any instance objects are created from the function constructor. All instances created from the function constructor will share the prototype instance, and it will be accessible via the prototype chain when instance members are invoked. In this way, constructor function instances “inherit” the members of their prototype object. [javascript] function Hipster () { this.shout = function () { return “I WROTE JAVASCRIPT BEFORE IT WAS COOL!”; }; } Hipster.prototype = { speak: function () { return ‘My rainbow scarf complements my skinny jeans.’; } }; var hipster = new Hipster(); alert(hipster.shout()); alert(hipster.speak()); [/javascript] The prototype chain is superficially similar to our understanding of inheritance in languages like C#. We are pretty familiar with this mode of thinking. The tricky thing is remembering that the prototype property is set on a constructor function, not on an instance object. In JavaScript, the prototype chain can extend quite a ways. When you access a member on an object, JavaScript will look “up” the prototype chain until it either finds a member with a matching name, or it bottoms out at `Object.prototype`, the instance to which all objects are ultimately tied. If an instance object and its prototype have members of the same name, the instance member is used because it satisfies the prototype chain query first. So this is all nice, but what does it have to do with the abomination I’m about to bring to life? Simple. It dawned on me while I was mowing the lawn yesterday that a JavaScript prototype chain kind of resembles a stack. When you add an item to the prototype chain, you are pushing an object onto the stack; when you remove the last object in the prototype chain, you are popping an object off the stack. And since objects in the prototype chain can have members with the same names, this simple stack can effectively be used to “version” an object’s state and behavior over time. I like to imagine the public behavior (API) of objects that I create before I start actually coding, so I started with some bogus code that represents how I imagine someone might use this amazing technological breakthrough: [javascript] var p = person(‘Walter’) .setName(‘Walter Williams’) .setName(‘Walter T. Williams’) .setName(‘Walt’); alert(p.getName()); //Walt p = p.revert(); alert(p.getName()); //Walter T. Williams p = p.revert(2); alert(p.getName()); //Walter [/javascript] The example is simple. Every time .setName() is called, the object is revised, but the prototype chain is used, behind the scenes, to keep track of previous versions of the object, which we can then access at a later point in time by calling .revert(). How does this magical goodness happen? To wit: [javascript highlight=”3,15,26,29”] var historicalObject = (function () { var _pushProto = function (obj) { function EmptyObject () {} EmptyObject.prototype = obj || Object.prototype; var other = new EmptyObject(); if (other.__version !== undefined) { other.__version++; } else { other.__version = 1; } return other; }; var _popProto = function (obj) { var proto = Object.getPrototypeOf(obj); if (proto === Object.prototype) { return obj; } return proto; }; return { create: function (base) { var obj = _pushProto(base); obj.revise = function () { return _pushProto(this); }; obj.revert = function (howFar) { if (typeof howFar !== ‘number’) { howFar = 1; } var other = _popProto(this); howFar–; if (howFar === 0) { return other; } return other.revert(howFar); }; return obj; } }; })(); [/javascript] `historicalObject` is an instance with a single method: .create(). This method accepts an object literal and invokes the \_pushProto() method (line 3) that 1) creates a dummy constructor function, 2) sets the object literal as its prototype, and 3) creates an instance of the dummy constructor. (I also assign a \_\_version property which is mostly just for debugging purposes, so the “version number” of the object can be queried.) In the .create() function, this new instance (obj) is then given two public methods: `revise()` and `revert()`. `revise()` is straight forward – it takes its current value of `this` and passes it to \_pushProto(), which will then create a new object with `this` as its prototype. So we would end up with something like this: [javascript] var o1 = historicalObject.create({ /*some properties*/ }); var o2 = o1.revise(); Object.getPrototypeOf(o2) === o1; //true var o3 = o2.revise(); Object.getPrototypeOf(o3) === o2; //true //etc. [/javascript] The `revert()` method, in contrast, returns an object a given number of steps “up” the prototype hierarchy. (By default, this is 1.) [javascript] //assume the above code… var _o2 = o3.revert(); _o2 === o2; //true var _o1 = _o2.revert(); _o1 === o1; //true [/javascript] I decided to create an implementation of `person` that would take advantage of this “prototype-as-stack” concept and roughly match my imagined usage example from earlier. Here is the implementation: [javascript highlight=”5,6,7,8,19,20,21,22,23”] var person = function (name, permissions) { return historicalObject.create({ setName: function (name) { var other = this.revise(); other.getName = function () { return name; }; return other; }, getName: function () { return name; }, elevate: function () { if (!permissions.indexOf(‘admin’) < 0) { return; } var _this = this; var other = this.revise(); other.isAdmin = true; other.toString = function () { return “(admin) “ + _this.toString(); }; return other; }, toString: function toString () { var str = “[“ + this.__version + “]::” + this.getName(); var proto = Object.getPrototypeOf(this); if (proto.hasOwnProperty(‘__version’)) { str += ‘ -> ‘ + proto.toString(); } return str; } }); }; var p = person(‘Walter’, [‘admin’]) .setName(‘Walter Williams’) .setName(‘Walter T. Williams’) .setName(‘Walt’); console.log(p.getName()); //Walt p = p.revert(); console.log(p.getName()); //Walter T. Williams p = p.elevate(); console.log(p.toString()); //(admin) … p = p.revert(); console.log(p.toString()); //no admin [/javascript] When `person()` is invoked, it returns an instance created by `historicalObject` with some initial data passed as function parameters (name, permissions). The instance has several public methods: `setName()`, `getName()`, `elevate()`, and `toString()`. The name mutators are fairly straightforward, except for the fact that I’m not tracking name as an instance variable anywhere. Notice on line 5 that I am adding to the prototype chain by calling `this.revise()`, and then on lines 5-8 I am replacing the `getName()` method altogether using the closure to access the current value for `name`. Since the old object (which will be the new prototype object) still has a copy of the last `getName()` method, when we revert the object, the old name value will be accessible again. Since the prototype chain notices that the new object has its own `getName()` method, however, it will invoke it on the new instance, `other`. The `elevate()` method is also interesting, in that it adds entirely new behavior to the newest member of the prototype chain. On line 19, you can see where I am creating `other` and making its prototype the current instance, `this`. I then add an `isAdmin` property and create a new `toString()` method that prepends the string “(admin)” to the value of `_this.toString()`. (I could have used Object.getPrototypeOf(this).toString() because the old object which is being versioned would be the value of the prototype on the new object; I decided to use the closure instead for clarity.) These new members seem trivial here, but I could easily imagine some security-related behavior being added to the new instance at this point – behavior that will vanish once `revert()` is called. `elevate()` acts as a kind of `sudo` (in the Linux world). [javascript] function someImportantTask (user) { var elevated = user.elevate(); if (elevated.isAdmin) { elevated.launchAllNukes(); } } [/javascript] `toString()` is relatively unimpressive; it just walks the prototype chain and concats the values of all `toString()` methods it encounters. I used this primarily to visualize the prototype chain, and to see the version numbers associated with each object. [javascript] p.toString(); //“[4]::Walt -> [3]::Walter T. Williams -> [2]::Walter Williams -> [1]::Walter” [/javascript] Something else you probably noticed is that the only time a new object is returned from a method is when the method “mutates” object state (e.g., `setName()` and `elevate()` in this example). This is really because objects only need be versioned when their data or behavior change. Since we aren’t actually changing the data inside of these objects, each instance is pretty much immutable. This also creates a pseudo-fluent API, but only for certain methods. Even though this is the most awesome thing you’ve ever seen (you know it is), I can immediately see some issues that might arise if one were to actually use this monstrosity. First, since object mutations are really generating new objects, you have to be careful about holding onto references or else there will be memory leaks. Second, if you are passing around references, you want to make sure that they are really assigned to the objects you think they are assigned to. It would do no good for you to elevate a user, then revert the object, but continue using the reference to the elevated object! This could end badly. I’m sure there are other problems here – this is merely an exploratory effort with no real vetting effort put into it. I found it entertaining, educational, and a bit twisted, and my only hopes are that you do as well. If it breaks your shit its your own damn fault; you have been WARNED. (full code example here)

TechSmith sponsors STL ALT.NET

Creating technical tutorial videos is no trivial task. It involves a great deal of preparation, recording time, editing time, and uploading time. While recording, a given portion of a presentation may be recorded multiple times (or dozens, on particularly bad days) because of verbal gaffs, background noise, inaccuracies, technical problems, etc. So like most things in life, if there is a tool that can can help make the processes easier, it is usually well worth the investment. Camtasia Studio (by TechSmith) is widely recognized as a premium screen capture, presentation, and video editing product. TechSmith has graciously donated a license of Camtasia Studio to STL ALT.NET for presentation purposes, and in return I’d like to talk about some of the really helpful features that I use to record screencasts that are hosted on the group Vimeo site. Camtasia Studio, by TechSmith When I record a presentation I like to try and divide it up into logical chucks that will be recorded separately. Dividing a presentation in this manner has a few advantages. First, committing to a five- or ten-minute segment is much easier for busy schedules, mental state, and vocal chords than trying to plow through a one- or two-hour presentation in a single recording session. Second, any blunders made during a short presentation segment are easy to correct (just re-record the segment), and require much less editing after recording is complete. Finally, if the presentation segments can stand on their own, they may be re-arranged during the editing period, if reordering them makes the presentation more meaningful. Camtasia makes this very simple, as all screen captures that get recorded become part of a project’s media library. Each clip can then be placed on Camtasia’s project timeline in whatever order makes sense while editing. Camtasia clip library Actually recording a presentation in Camtasia is a snap. When “Record the screen” is selected from the studio interface, a small option bar appears with all the options that can be configured prior to recording. Like most presentation software, Camtasia lets you record the entire screen or a custom region. It also has the ability to integrate with any attached webcams, or additional recording devices (like a professional microphone) and lets you tweak settings for each hardware device. Recording PowerPoint presentations is such a common task that Camtasia allows users to run and capture a presentation from within PowerPoint itself, eliminating the need to fire up the Camtasia interface at all. Since I’ve used PowerPoint in some manner for most of my STL ALT.NET presentations, this feature was quite handy when it came time to record them. When I am actually recording, it is often helpful to call out particular portions of the screen to draw the viewer’s attention to specific content. There are several tools in Camtasia that help facilitate this, but the one I found most helpful was the outline tool. With a simple keystroke I was able to turn my cursor into a drawing tool and outline a particular part of the presentation with a nice lime green box, indicating the relative importance of the content I was talking about. Camtasia screen highlight After the recording phase, Camtasia also attempts to analyze the clips in your library for special “keyframes” – points in the video where the movement of the cursor or position of windows might indicate that particular content is more important – and it will attempt to “zoom in” on those regions of the screen to make viewing easier. When clips are placed on the timeline, these keyframes are visible as blue diamonds above each clip. While Camtasia attempts to add these automatically, it is often necessary to add keyframes manually as well. At first I thought Camtasia was overly aggressive about adding keyframes to my clips, but then I realized that I was overly aggressive about moving my mouse around the screen, as if my mouse pointer replaced “hand gestures” during my presentation, and Camtasia interpreted this movement as an indication that I wanted the program to zoom to where my mouse pointer was flailing about. Camtasia keyframes Camtasia zoom Another thing that I was particularly happy about is that Camtasia makes it painless to include other video content as part of a project. In the STL ALT.NET videos, I use small intro and outro sequences that were rendered on another video editing product, and I wanted to make sure I could reuse those clips in future presentations. By adding the clip to Camtasia’s library (drag-and-drop, or using the import feature), I was able to add it to the timeline like any other clip recorded by Camtasia. There are a number of built-in clip transitions, such as fade, slide, flip, etc. that make it easier to place dissimilar clips side-by-side, and in this case I was able to use fade to great effect. STL ALT.NET intro After I finished editing my presentation, Camtasia game me several options for generating the final video output. Camtasia can render to pretty much all devices sizes, in all major media codecs, for all normal viewing purposes (YouTube video, HD video, iPad or iPhone video, etc.). Since the STL ALT.NET Vimeo account uses HD video I went ahead and chose HD settings and let Camtasia render the final presentation. It compressed a presentation that was 1.5 hours long, at a 1280x720 HD resolution, into just shy of 200MB, which is pretty damn impressive. Of all the great things that Camtasia does, the one thing that matters most to me is: it makes my life easier. Recording technical presentations is a way that I can contribute to the development community in St. Louis, and using a product that makes that processes fluid and seamless helps me, and in turn, helps everyone who benefits from these presentations. Camtasia is a solid product, and TechSmith a generous company for donating a copy to STL ALT.NET!

Using Rake to Make Your Builds Majestic

Rake is a software task management tool, written in ruby for managing ruby projects. By leveraging gems like albacore, rake can be used to automate tasks such as builds, configuration, assembly versioning, database deployments, unit testing, etc. for .NET projects as well. Nicholas Cloud talks about some of these features, and how you can use rake in your .NET environment with minimal friction and maximum synergy! Be sure to bring your hard hats folks.

So you want to be a .NET dev...

A friend of mine (we’ll call him Bernard) introduced me, via email, to a friend of his (we’ll call him Walt) who is a recent computer science graduate. Walt is examining his career options right now, and is curious about .NET development, so Bernard asked if I would give him an overview of technologies and maybe a little career advice, as someone who has been in the field for a while. Here is my response (edited for fat-finger blunders). If anyone has additional insight they would like to share with Walt, please leave a comment and I will pass it along!


Hi Walt, nice to meet you! The first thing I would say is that if you are thinking about .NET development (or business development in general), its going to be a bit different than the programming you do in a comp-sci course, or academic programming in general. There tends to be a lot fewer algorithms and data structures, and a lot more “big data”, system integration, and system scaling that happens in business. So if you really enjoy the math, science, and “number crunching” aspects of programming, you might want to consider the financial and/or scientific sector(s), with languages like C, C++, Lisp, Clojure, Scheme, etc. Or maybe even embedded systems or hardware programming. .NET (and Java) tend to be the big “enterprise” platforms, meaning that they are used to run big line-of-business applications. If this is interesting to you (or you don’t really care), then you can’t go wrong with either of these two platforms. I started doing web development in PHP on Linux, but through a series of unfortunate, er, I mean, unforeseen events, became a .NET developer. I’ve been doing .NET for about 5 years now. One thing I can say is to steer clear of VB.NET, and focus on C#. The syntax in C# will feel much more familiar if you are already accustomed to C/C++/Java. And it gets the most love from Microsoft and .NET devs, has the most language features, and is generally respectable.

1. Technology

If you want to do web development on the Microsoft stack, ASP.NET MVC is Microsoft’s hottest web technology. I use it every day. Their legacy web technology, WebForms (commonly referred to as ASP.NET, though both WebForms and MVC are built on ASP.NET technology), is still widely used in businesses (and Microsoft still actively releases updates for it), but it is falling out of favor with developers, and most new projects embrace MVC as the future of MS web dev. I will tell you right now: MVC is much easier to learn than WebForms. WebForms is a beast from hell. It is fugly, bloated, hard to test, and easy to swear at, but still worth knowing if you are serious about being a .NET developer. So if you want to do web stuff, read up on both of these technologies but focus mostly on MVC. Also, you will need to have a strong grasp of HTML, CSS, JavaScript, and jQuery (a JavaScript abstraction library) to be successful in web as well. If you want to do desktop development, WPF is where its at. Microsoft’s legacy technology, WinForms, is still supported though many new projects are WPF-based. The differences in these technologies revolve mostly around how the user interfaces are constructed, and what capabilities they have. It can’t hurt to learn either, or both – but if you have to make one a priority, make it WPF. I will mention Silverlight here briefly, just to say that it is kind of the red-headed step-child of Microsoft technology right now. It was supposed to bring desktop-like programming to the browser (this goal, incidentally, always meets with failure, e.g. Java Applets and Flash), but Microsoft has quietly sidelined much of its development in favor of standards-based web technologies like HTML5. The good news is that Silverlight skills are similar to WPF skills, so even if you were on a project where you had to develop in Silverlight, the experience isn’t a loss. Microsoft has several service-oriented technologies: ASMX which relies on ASP.NET and must be hosted in the IIS web server, and WCF which can be hosted in IIS or in a separate process running on the machine. WCF is the hotness and ASMX is out-of-favor for new development, though you will still find ASMX in the wild in legacy systems. WCF is a beast – don’t approach this until you are somewhat familiar with the .NET framework as a whole. As far as data access technologies go, Microsoft has three (well, two-and-a-half really) that you should know. ADO.NET is the base data access technology upon which all others are built. Entity Framework is Microsoft’s object/relational mapper (mapping classes to database tables), and Linq2SQL is Entity Framework’s annoying little brother that no actively uses anymore (trivial projects and existing Linq2SQL maintenance are the exceptions). You will definitely need to understand how ADO.NET and EF work to write productive .NET applications. So these are really the application-specific technologies that you will want to learn, but there is also the framework itself and its core libraries. This brings me to my next section:

2. Resources

If you are serious about .NET, I would highly recommend “Pro C# 2010 and the .NET 4 Platform“ by Andrew Troelsen. Do not be frightened by the size of the book – he has chapters that cover most of the .NET framework in a very digestible way (including chapters on ASP.NET MVC/WebForms and WPF/WinForms). He begins with core types like string, int, float, byte, etc., as well as .NET application models, memory management, how the CLR runtime executes .NET code, etc. Its very thorough, and very easy to read. I get an updated copy of this book whenever a new version of .NET is released because I find it that helpful. Another good book is “C# 4.0 in a Nutshell“ by Joseph Albahari. It’s not as thorough as Troelson’s book, but you can get a quicker overview of the framework, if that’s what you’re looking for. Also, I would highly recommend browsing through the videos on TekPub’s website. They have in-depth videos on C#, ASP.NET MVC, and WebForms that are all worth the money. The videos are high quality and very informative. It would also be beneficial for you to get involved in a .NET user group, wherever you happen to be located. There are two in St. Louis: the STL .NET User Group, and the ALT.NET User Group (I run the latter). User groups are a great way to meet people who are already knee-deep in .NET and hear detailed technical presentations. St. Louis also hosts a .NET conference every year called St. Louis Day of .NET, and Kansas City runs a .NET conference called KCDC. Both conferences are reasonably cheap, and you will get a lot of exposure to different .NET technologies. If you’re not in the St. Louis area, check and see if your area has conferences or user groups available. A quick Google search should tell you pretty quickly.

3. The Tools

This is probably going to be the sucky part for you, because while Microsoft tooling is great for .NET, it also costs a small fortune to purchase. Microsoft’s flagship IDE, Visual Studio, can be purchased with an MSDN subscription for about $800 (professional version). Microsoft provides “express” versions of some of its products, and while they are adequate for doing small trivial projects, or just learning C#, they are severely crippled and sometimes even do things differently than their commercial counterparts. (For example, VS Express creates projects a bit differently than VS Pro, which can be confusing if you move from one to the other.) Still, for getting started they are your best option, unless you can get the software through your university, which would be even better. There is an open source implementation of .NET called Mono, and there is even an IDE for it called MonoDevelop, but it does not enjoy wide use and does not support all the framework/language features that VS does. So the Express editions are probably better for learning. There is also an express edition of SQL server, which is actually quite good, and unlike VS Express, it merely lacks advanced features but otherwise performs identically to full-blown SQL server, so it is a great product on which to learn.

4. Getting Work

St. Louis is big contracting town, so there are tons of staffing agencies and headhunters trying to place technical talent at companies in the area. St. Louis is also a huge stronghold for .NET and Java, and right now the .NET market is definitely a developers’ market. Recruiters can typically help “get you in the door” at a company, but most of the ones I have talked to are looking for experienced professionals. This is not to say that there are no entry-level jobs–I just have no knowledge of whether there are or not. I could send you the names of some staffing agencies here in the area, if you would like, and you could start dialogues with them to see what opportunities are available. I would also highly recommend getting involved in .NET open source projects. Github.com hosts a huge number of .NET open source projects, and allows you to create a free basic account so that you can participate in development. This looks really good on a resume (there is even a website called GitHire that shows which developers in a given area are most active on Github), and you can learn a lot from reading other peoples’ code. This will require you to become familiar with Git, an open-source version control system, but I would recommend that anyway because it is quickly becoming the version control system of choice for many .NET shops. Ok, so I know this was a long-winded email, but I think I covered the basics. If you have any questions (on technology or your career), feel free to ask. Godspeed, and good luck.

Accelebrate sponsors STL ALT.NET

I am happy to announce that STL ALT.NET is now sponsored by Accelebrate, an Agile software development training company. They have provided us with a generous quantity of Mike Cohn’s excellent book “Succeeding with Agile: Software Development Using Scrum“ to use as raffle swag during the next several meetups. Accelebrate offers intensive Agile training, as well as courses in .NET, SharePoint, SQL Server, Java, and other technologies. Their training is provided by people who have experience in the field, and occurs on-site to keep training overhead low. If you would like more information, feel free to contact Accelebrate or follow them on Twitter.

Persistence

“He who accepts life for what it is and never allows himself to be overwhelmed by it does not need to seek refuge for his crushed self-confidence in the solace of a ‘saving lie’. If the longed-for success is not forthcoming, if the vicissitudes of fate destroy in the twinkling of an eye what had to be painstakingly built up by years of hard work, then he simply multiplies his exertions. He can look disaster in the eye without despairing.” – Ludwig von Mises, Liberalism

Things on which I am stewing

I have about an hour before the November STL ALT.NET meetup begins, so I thought I would quickly jot down some things on which I have been stewing for the last few months, not because I think you will find them particularly interesting but because writing is therapeutic and often leads to greater clarity of thought.

Who I follow on Twitter, and why

I recently spent some time organizing my twitter feed into lists and browsing Twitter’s “follow” recommendations. Before I follow someone, I browse their current tweets to see if I am interested in what they are saying. I like people who are focused with their content. When I look at a person’s tweets, there is some threshold that I have–some content litmus test that I use–to determine if the bulk of what they write on Twitter is valuable enough for me to follow them. For developers, it boils down to: how much do you tweet about development, or development-related topics? If I glance at a Twitter stream and the bulk of what I see is not related to development, I probably won’t follow the Tweeter. (Is that even a noun?) Another criteria I have is the quality of content people retweet or link to. Twitter can be a tremendous place to find great articles, blog posts, open source projects, etc., but not all content is created equal, and I consider trivial links or retweets to be a form of spam. But again, I have a personal standard for judging what is “trivial” that other people might not agree with. I would be interested to hear from others who also screen potential Twitter follows, and what methods or standards they use.

I’m not learning Rails

I attended two Ruby conferences this year: Ruby Hoedown and Ruby Midwest. I thoroughly enjoyed myself at both conferences, and I learned a lot. I enjoy Ruby as a language. We use Rake at work, and I enjoy writing Ruby code to make my build tasks easier. Rails is a powerful framework for RAD development, and the sheer volume of helpful gems that are available for Rails is quite impressive. The reason I am not going to learn Rails, however, has nothing to do with the quality of the Ruby language or the Rails framework or the Ruby community (which is fantastic). After stewing for quite some time on my dissatisfaction (or rather, disinterest) in Rails development, I came to a point of self-realization. I don’t want to learn Rails because I don’t want to write CRUD applications. And Rails is a framework targeted specifically at CRUD developers. Can you use Rails in a non-CRUD oriented way? Yes–but a significant portion of Rails gems, websites, articles, discussion boards, videos, books, etc. are all CRUD-centric; only a precious few breach convention. And most Rails developers see this strong CRUD emphasis as a feature, and indeed they should, because Rails solves many problems quite elegantly; it is the right tool for many jobs. So, Rails, it’s not you–it’s me.

I really want to become better at domain modeling

My real passion–one that has been developing for several years in the quiet recesses of my frontal lobe–is domain modeling. The technologies and methods to which I find myself attracted (Domain Driven Design, CQRS, etc.) are all concerned primarily with encapsulating domain logic and separating it from implementation details like persistence, the user interface, remote services, etc. This stands in direct contrast to common CRUD methodologies which often wed, for the sake of expediency and conceptual simplicity, “domain classes” and the UI, persistence, and/or service layers. Both models have trade-offs. But I have been programming in a (more-or-less) CRUD-oriented way for years now, and I want to grow beyond that. The distinction between these two modes of development became very clear to me at Ruby Midwest, where I watched Uncle Bob give a presentation on this very topic. I realized that (from what I have seen) this discipline is fairly neglected in general business development. Maybe it is just assumed that developers have this knowledge already. I suspect, however, that the familiar nature of CRUD, and the quick gains it achieves in the short-term are the real justifications reasons why most projects start–and remain–CRUD-centric. As I work through this gradual shift in my development paradigm over the next few years, I will write more about the things I discover. As always, I’m interested in feedback. Give me your opinions. Really, I can take it (with scotch, on the rocks).

Naming interfaces

Interfaces in .NET have a specific naming convention. They begin with a capital “I”, followed by some text that indicates what the interface represents. IEnumerable is a classic example; it means the implementing object can be enumerated. This naming convention, however, is pretty unique to .NET. In the Java world, interfaces do not have a special prefix to indicate that they are interfaces. Java, unlike .NET, uses two keywords, “extends” and “implements”, to indicate whether a class is participating in an inheritance hierarchy and/or representing some behavior, respectively. In .NET, we use a simple colon and rely on the ordinal position of the class/interface names that come after to indicate the same. The prefix “I” used for interfaces is seen by many (myself included) as unnecessary. It serves no useful purpose other than to provide a visual cues to developers, allowing them to identify interfaces quickly while coding. Java IDEs typically provide these visual cues so that developers don’t have to rely on a naming convention for this purpose. Eclipse example 1 Eclipse example 2 Visual Studio has visual aids as well, but they are not as obvious, in my opinion. I do think a naming convention for interfaces is still a good idea, but I don’t think the prefix “I” is necessary. Instead, I would like to propose that interfaces be named for the behavior that the represent, starting with a prefix like “Can”, or “Will”, or “Has”, followed by a description of that behavior. For example:

  • IEnumerable becomes CanEnumerate
  • IDisposable becomes CanDispose
  • IQueryable becomes CanQuery

Not only is this naming convention more descriptive and less contrived (sometimes it is difficult to come up with an interface name like IXyzable), it forces developers to really think about the behavior they are trying to implement, and may dissuade them from creating interfaces that have nothing whatsoever to do with behavior. (The sudden explosion of IOC mania has obscured the real purpose of interfaces, but that is another topic for another time.)

If you have thoughts on this topic, I’d be interested to hear them.