# Wednesday, August 19, 2009

I’m really liking Ruby on Rails for numerous reasons, and chief among these reasons is the ability to make a change to Ruby code and then refresh the browser to see the changes.  In other words I really like to avoid paying taxes, and in this case the compilation tax we all pay when using a static language.

For a couple of years now, since I started using MonoRail back in 2007 I’ve always felt that productivity could be improved by writing not only views in a dynamic language, but the controllers too (maybe the entire app). There’s just something refreshing about making a change in server side code and immediately see the changes without waiting 30 seconds for a complete recompile of the entire application.

Yesterday I was heavily doing some TDD on a very low level componenent in our application and wasted about 10 minutes waiting for Visual Studio to recompile the project I was working on… and then every other project that depends on that one. It takes a lot of focus to keep the TDD rhythm going when you’re forced to wait 1 minute between runs.  I just have one word for this, painful.

I can only imagine the benefits of doing TDD with a dynamic language since you have a whole lot more compile and test cycles with TDD than traditional programming techniques. The emergence of TDD over the past few years along with general acceptance of the practice will only further push teams towards dynamic languages. Sure you lose static type safety, but that’s why we have lots of good unit tests; and at the controller level that’s not a bad thing because you’re often dealing with key value pairs (think web form post or json DTOs) and a dynamic language is just a much more natural fit.

I’m not completely sold that unit testing at the controller level always makes sense, it often involves too many collaborators and whole lot of mocking. With automocking this isn’t so bad, but sometimes you have complex Ajax interactions in the middle and testing at a higher level via a web test sometimes makes more sense.

I’m hoping Microsoft seriously starts supporting dynamic languages (the DLR) and makes it a first class citizen rather than pushing it to the side in favor of more C# language sugar. I was very disappointed to see that Visual Studio 2010 has no support what so ever for Python or Ruby (unless I completely missed it somehow). Actually, I was shocked! The future belongs to dynamic languages and Microsoft is almost completely ignoring them. If they would support them officially along with ASP.NET MVC, the .NET world would be a whole lot better off.  Without dynamic languages the ASP.NET MVC 2 gets a B in my grade book (version 1 gets a C). Maybe its time to switch platforms?

.NET | IronPython | MonoRail | RoR
Wednesday, August 19, 2009 3:47:59 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, August 11, 2009

I’ve been futzing around with RoR for the past week on my train rides to and from work and finally feel like I’m making some progress beyond Hello World type of stuff.  Not much progress, yet I think tonight I’ve finally hit the tipping point.

I’ve been waiting for this all week.  Its not much, but I can create and edit not only a simple model, but a model and its component on a single form, think client –> address.  More importantly I’m doing it correctly, using the new RoR 2.3 accepts_nested_attributes_for support.  I looked at the pre 2.3 code to do the same thing, ouch!  Basically 2 lines of code and I still restful controller!

its probably about time I move towards some domain logic and unit testing.  I’m still fuzzy if all RoR model tests touch the database or not, I’m used to mocking my repositories in C#, and as you may know there are no repositories with AR.

RoR
Tuesday, August 11, 2009 1:22:28 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Sunday, August 09, 2009

From a software engineer’s craftsman’s perspective, the term architect is not only negative, its down right skull and bones. Only those who wish to speak up towards management would ever want to be labeled architect. The real demon isn’t necessarily architect in the general sense, its a specific type of architect that we disdain, the kind that adds no value: architecture astronaut, from here on referred to as the non coding architect (NCA).

As Joel Spolsky so eloquently put it, emphasis mine:

When you go too far up, abstraction-wise, you run out of oxygen. Sometimes smart thinkers just don't know when to stop, and they create these absurd, all-encompassing, high-level pictures of the universe that are all good and fine, but don't actually mean anything at all.

That's one sure tip-off to the fact that you're being assaulted by an Architecture Astronaut: the incredible amount of bombast; the heroic, utopian grandiloquence; the boastfulness; the complete lack of reality.

Lets be clear on something right now, PowerPoint presentations with fancy buzz words add no value. Sure management likes them and sometimes they’re even shiny (management loves shiny stuff), but what value has been added to the product?  Again, zero, none, nil.  The NCA could create hundreds, thousands of presentations, but still your burn down chart remains unaffected.

The NCA may do more than create PowerPoint slides.  Sometimes they create UML models, RUP diagrams, and maybe even state flow diagrams. This kind of stuff is cute, but it still falls into the “useless” category. Very rarely will an engineer on an agile team ever need to reference one of these stale documents.

“The real problem with an NCA trying to dictate technology choices is that there is one critical element missing, something that should painfully obvious to anyone using an agile methodology: there is no feedback loop.”

Some NCA’s may even venture as far as trying to dictate to the development team on how they should build the underlying system architecture.  This is a line that should never, ever, ever, ever (just keep repeating that until you get tired) be crossed by an NCA. The real problem with an NCA trying to dictate technology choices is that there is one critical element missing, something that should be painfully obvious to anyone using an agile methodology: there is no feedback loop.

The NCA can choose technology X, because its super cool, has lots of fancy acronyms in it, or is “the standard,” but unless they have skin in the game they don’t suffer from their bad decisions on a daily basis like the rest of the development team. The rest of us would like to focus on the real problems of getting a quality product shipped.

Where do we find these evil NCA’s? Joel continues with this:

It's very hard to get them to write code or design programs, because they won't stop thinking about Architecture. They're astronauts because they are above the oxygen level, I don't know how they're breathing. They tend to work for really big companies that can afford to have lots of unproductive people with really advanced degrees that don't contribute to the bottom line.

Usually at large corporatized companies, companies with lots of developers, I would imagine a bank.  Banks essentially print money (well, the government prints it and then gives it to banks, then sends me the bill). In other words, companies that have money to waste.  You would never find an architect on a video game title, they’re too busy trying to make a fun game. Maybe you could make an argument for a NCA at a bank, after all there’s a lot of management overhead and someone has to distract them with shiny things.  If you find an NCA and only 5 developers, you’re in a whole heap of trouble, just like them Duke boys.

There is another type of architect, the antithesis of the NCA, the coding architect (CA). Most often the CA is the lead developer on a team, sometimes referred to as the coach on an XP team. The coding architect isn’t focused on shiny things, the CA is focused on the code and how that code fits within the “architecture” of the system. The CA is also focused on the team, providing guidance to junior developers whenever needed. Martin Fowler call this guidance a key to success in his Is Design Dead? essay.

Indeed one of the several games with words that XP makes is that it calls the leading technical figure the "Coach". The meaning is clear: in XP technical leadership is shown by teaching the programmers and helping them make decisions. It's one that requires good people skills as well as good technical skills. Jack Bolles at XP 2000 commented that there is little room now for the lone master. Collaboration and teaching are keys to success.

All this talk of architecture roles brings up a question, what is the “architecture” of a software system. There is no singular answer to this, and depending on the type of system it could be very different things. Ralph Jonhson has one of the better descriptions of software architecture:

…A better definition would be “In most successful software projects, the expert developers working on that project have a shared understanding of the design. This shared understanding is called ‘architecture.’ This understanding includes how the system is divided into components and how the components interact through interfaces. These components are usually composed of smaller components, but the architecture only includes the components and interfaces that are understood by all the developers."

Whether something is part of the architecture is entirely based on whether the developers think it is important. People who build “enterprise applications” tend to think that persistence is crucial. When they start to draw their architecture, they start with three layers. They will mention “and we use Oracle for our database and have our own persistence layer to map objects onto it.” But a medical imaging application might include Oracle without it being considered part of the architecture. That is because most of the complication is in analyzing the images, not in storing them. Fetching and storing images is done by one little part of the application and most of the developers ignore it.

Software is not limited by physics, like buildings are. It is limited by imagination, by design, by organization. In short, it is limited by properties of people, not by properties of the world. “We have met the enemy, and he is us.”

Architecture is the stuff that’s hard to change in a software system, the stuff that’s pervasive everywhere, the building blocks of the application. If architecture is so important, then we want to make sure we put out best people on it and carry the vision forward by coaching the entire development team; there’s no way a NCA could ever hope to do this.

Sunday, August 09, 2009 5:06:12 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [0]  | 
# Tuesday, July 14, 2009
Jeff is right about RegexBuddy. It shows me in realtime how my regex is matching, no need to wonder, do I need to escape this?
Tuesday, July 14, 2009 10:12:51 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, June 26, 2009

I've been using IronPython as of late, not a whole lot, but more and more - and I want to do things the Pythonic way using the built in Python libraries whenever possible rather than .NET BCLs.  I've been using REPL mostly, but I'm starting to do more and more in Python, so I've started using SharpDevelop mainly because it supports IronPython out of the box and is a much smaller download than IronPython Studio.

The problem I had was getting access to the standard Python libraries from SharpDevelop, it appears that SharpDevelop only ships with the IP interpreter and not the Python libraries.  The regular IP install does ship with all the libraries, so how can we get SharpDevelop to use them?  Also, how do we get SharpDevelop to use the latest version of IP that I have installed on my system?

Start an IP project in SharpDevelop.  Remove all references to IronPython from the project (assembly ref).  Add a new reference browsing to your latest installed version, mine is in C:\Program Files\IronPython 2.0.1.  Add a reference to IronPython and IronPython.Modules. In SharpDevelop go to Tools | Options | Tools | Python, and browse to ipy.exe in your IP install directory.

Now that we have a working SharpDevelop IP environment running the latest version, lets go ahead and use some Python libs!  Notice how I explicitly set the Python libs path.

import sys
sys.path.append(r'C:\Program Files\IronPython 2.0.1\Lib')

import os.path

def walkDir(arg, dirname, names):
	print dirname

os.path.walk(r'C:\', walkDir, '')
Thursday, June 25, 2009 11:57:17 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Friday, April 24, 2009

Without recessions we wouldn’t have prosperity. Everything in this world is relative, remember?  Everything!  There is no good without bad, no bad without good.  How would you compare and contrast without both?  You can’t!  Apples to apples are only just apples.  How ordinary!

Its recessions that allow me hire the most kick ass SDET ever born to walk this face of wanna be enterprise software ever to be born out of some half ass naked enterprisey architect fool!  Yes, recessions shake this world up, let the dead weight die, and make the good truly shine in all their glorious golden hue.  Code is no different.

I love bad, nay, horrible code.  Without the most clown-a-rific code ever (yes Kent, Clown-a-rific) my code would be so boring and ordinary.  It’s this clown code that makes my code standout and really shine like the terd that it is, er, gem that it is.  My code basks in the glow in the terdious cloud of awful code, so thank you for awful code for your wonderous glowing shine.

My point is we can’t just have good.  If we only have good, we would only have boring.  With boring we have nothing.  Thank you Jeebus that we have good and bad.  Thank you terdious code base for letting me shine! ASP.NET MVC wouldn’t look so good if we didn’t have Ruby.  So thank you Jeebus for some Ruby.  And circa 2005, go die ASP.NET webforms!  Ruby is the flashlight upon ASP.NET webforms.  We all knew around 2005 the problems, but Rails just put the spotlight upon ASP.NET webforms and made them naked for what they were.

Sure, webforms were glamorous, at least they were back in 2001 when I was evaluating ASP+ beta2 (yeah, ASP+, not ASP.NET).  Yes, yes they were quite remarkable.  Compared to classic ASP, ASP.NET webforms was the shiznit, as they say in my hometown.  I’m glad we have ASP.  I’m glad we have ASP.NET webforms.  I’m glad we have ASP.NET MVC.  One without the other is so ordinary and boring, so middle America.  Could we have rich without the poor?  Nay, we would all be so middle.  Again, I remind you dear reader that middle is boring!

So, let me be first to say that ASP.NET MVC sucks!  Sure, right now it’s pretty damn good. It copied MonoRail fairly well (which itself was a copy), but in a couple of years we’ll all be wishing for something else. They all say, too much static typing!  Give me controllers that are dynamic that don’t require a re-compile! It’s so slow! Views?  Views?! JavaScript XXX handles views and has its own templating engine!  I can’t believe we ever generated views on the server!  That’s what they’ll say, they will.

We just need some good old fashioned data services from our web server. Client server shall live again!  Trends always repeat themselves.  Don’t believe me?  Glam rock will rock again in 2012.  History is bound to repeat itself because of cycles.  OK, I’m getting a bit out there.  I agree, but damnit glam rock shall live again!  Guitar Hero Metallica is pretty damn fun!

Without cycles we would have only good which would yawn us all to death.  It’s the bad which makes the good, actually good.  It’s all relative, isn’t it Einstein?

Friday, April 24, 2009 4:03:45 AM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [3]  | 
# Friday, April 17, 2009

I finally downloaded Simian today to give it a test drive, and already I think I'm going to love this tool. If you don't know what Simian is, its a tool to automatically locate duplicate lines of code and any good programmer should love to delete duplicated code, which where I work is pretty important. 

Simian being a console application is pretty useful, but being able to click a button from Visual Studio, see the output in the output window, and then being able to navigate to the duplicated lines by double clicking is what I really wanted.  So that's what I did, I created a Simian output formatter that transforms the output to MSBuild formatted output that is clickable!  Cool, how do we use it?

Download and copy the formatting tool somewhere, I put it in my Simian bin directory.  Create a batch file in this same directory, the batch file is used to pipe the Simian results to the formatter because Visual Studio doesn't let you from the external tools menu.  My batch file looks like this:

@ECHO OFF
REM Run simian redirecting output to the MSBuild formatter
C:\"Program Files (x86)"\Simian\bin\simian-2.2.24.exe %1 | C:\"Program Files (x86)"\Simian\bin\SimianMsBuildFormatter.exe

With that out of the way we need to setup Simian as an external tool within Visual Studio.  In this example I will setup Simian for the current file:

Now Simian - Current File will show up in the Visual Studio Tools menu.  With a file open in the editor we just need to click our new menu item to run Simian and get our output. Here's an example output run.

The interesting and useful part is that the source files listed in the output are now clickable, just like from the csc compiler.  Happy dupe finding!

Friday, April 17, 2009 10:24:13 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [3]  | 

First off let me say that I'm probably the last person to figure this out, but Google Reader allows you to share web pages via a simple toolbar shortcut. Just open Google Reader and drag the "Note In Reader" box to your browser toolbar.

It works exactly as I had wanted, without any browser plugins, the toolbar shortcut is just some Javascript that runs to share the current web page you are viewing, genius!

Friday, April 17, 2009 6:12:10 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [1]  | 
# Monday, March 23, 2009

My employer Daptiv is currently looking for a couple of talented Software Engineers to join our scrum team. Daptiv is a software as a service (Saas) company committed to providing our customers with the best work management software on the market.

We need someone who is committed to producing quality software and is passionate about continuous improvement of themselves, the team, and the process. We want someone who's smart and isn't afraid to share their opinion.

Although we are primarily a C# and ASP.NET shop, we have a lot of rich client code written in JavaScript and JQuery.

Monday, March 23, 2009 4:42:46 PM (GMT Standard Time, UTC+00:00)  #    Disclaimer  |  Comments [2]  |