Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Sergio Pereira

There are no half-solutions because there isn't half a problem

July 2008 - Posts

  • Software I can't work without

    I'm about to configure a new development machine this week. It's going to be my 3rd install from scratch in the last 12 months, which I know is not all that much, but certainly more than I wish I had to.

    Besides the common software development tools, like Visual Studio, SQL Server, Ruby, Office, Firefox, SVN, etc, over the years I've collected a number of small tools that I make sure are installed before I start doing anything else.

    The list is volatile but some utilities have been there for years. Here's my current list in no particular order:

    • Taskbar Shuffle - I'm sort of a neat freak and this little wonder does only one thing. It lets you rearrange the application buttons in the taskbar. I don't understand how this is still not enabled in Windows out of the box.
    • Slickrun - I need a command/app launcher and I've settled on Slickrun for some time now. I don't need much from it but I definitely need it. On my mac, as you can imagine, I use Quicksilver.
    • EditPlus - Every serious developer has his favorite text editor. Mine is EditPlus, at least on Windows. It's simple, extensible, has most of the features you'd expect from a text artisan's toolbox. Again, on the mac I'm more obvious and use TextMate, which is quickly becoming my new favorite if I can work on the mac.
    • Truecrypt - In case you aren't familiar with it, Truecrypt is a data encryption software that creates encrypted file systems that that you can mount in Windows, Mac OS X, and Linux. Truecrypt makes encryption a piece of cake and I have been using it since when it's non-Windows support was laughable.
    • Timesnapper - This tool has a very simple premise, it takes screenshots of your desktop on a regular interval. You can later relive your day just like a movie. This application is like my backup memory when I'm preparing my timesheets. It works great with Truecrypt in case you are concerned with having your whereabouts "caught on camera."
    • Lutz Red Gate's .NET Reflector - There's no .NET development without Reflector, I should not even need to mention that I use it. Let's start a campaign to have Reflector bundled with Visual Studio.
      Update: Reflector was acquired by Red Gate shortly after I wrote this post. I guess they moved quicker than Microsoft and our campaing to have that tool be part of the SDK or Visual Studio is severely at risk.
    • Daemon Tools - Mount ISO images as CD/DVD ROM drives.
      Update: Apparently I was using a much older version of Daemon Tools and that tool now install spyware even if opt out of installing the stupid toolbar. I'm starting to use Virtual Clone Drive now and it has been alright.
    • Hamachi - VPN made easy as pie. 'Nuff said.
    • Foxit Reader - I can't stand Adobe Acrobloat. Foxit isn't the greatest thing on earth but is good enough and very lightweight.
    • Filezilla - Sooner or later I'll need a FTP client. Filezilla has been good to me.
    • Firebug for Firefox - If there's no .NET development without Reflector, then Firebug is like Reflector for Web development. But I'm sure you already know that.
    • YSlow for Firebug - This nice add-on helps me by suggesting possible ways to improve page loading performance. While you're at it take a look at these other Firebug extensions.
    • 7-zip - Because we all need a shell-integrated compression tool.
    • Tabbed Console - I'm not exactly a command line ninja, but I find myself at the black screen very often. Often enough that it's not rare that I have more than one of those open. The tabbed Console utility allows me to have all my command prompt sessions in the same window. And more than that, I can have flavored command windows tabs, like one for the regular cmd.exe, one for IRb (the Ruby console), one for PowerShell, one for Cygwin, VS Command Prompt, and on, and on.
    • Sysinternals stuff - Sometimes you need to bring the big guns.

    What about you? Do you have tools that you feel naked without?

  • It's obvious, use TimeSpans to measure time

    I know, this is probably not news to anyone. TimeSpan is the native .NET type to represent time intervals. But answer quickly, SqlCommand.CommandTimeout represents the interval in milliseconds, seconds, or minutes? What about System.Timers.Timer.Interval ?

    To circumvent this situation we see all sorts of API design contortions, like trying to standardize all time units to the same unit, which sometimes is not viable, or using unnatural affixes when naming the class members, for example.

    class CalendarEvent
    {
    	public string Name { get; set; }
    	public int DurationMinutes { get; set; }
    }
    //or..
    class EquipmentError
    {
    	public int ErrorCode { get; set; }
    	public double MillisecondsTotal { get; set; }
    }
    //or...
    class ProjectPhase
    {
    	public int ProjectID { get; set; }
    	public string PhaseName { get; set; }
    	public int PhaseWeeksDuration { get; set; }
    }

    I think this stinks. Why do we constantly ignore the TimeSpan structure? I know it's kind of the bastard child of the System namespace. It lacks for example string formats. It's larger than a simple Int32. But the complete annihilation of any doubt as to what time unit we are using is worth all that.

    The previous examples could be made clearer with TimeSpans.

    class CalendarEvent
    {
    	public string Name { get; set; }
    	public TimeSpan Duration { get; set; }
    }
    //or..
    class EquipmentError
    {
    	public int ErrorCode { get; set; }
    	public TimeSpan TotalTime { get; set; }
    }
    //or...
    class ProjectPhase
    {
    	public int ProjectID { get; set; }
    	public string PhaseName { get; set; }
    	public TimeSpan PhaseDuration { get; set; }
    }

    But let's not stop there. We can simplify our lives by, for example, creating some extension methods to deal with time interval tasks. I don't show below, but we could very well write an extension method to fix the lack of a TimeSpan.ToString(string format) method.

    using System;
    namespace Utils.Extensions.Time
    {
    	public static class TimespanExt
    	{
    		public static TimeSpan Minutes(this int interval)
    		{
    			return Minutes((double)interval);
    		}
    		
    		public static TimeSpan Minutes(this double interval)
    		{
    			return TimeSpan.FromMinutes(interval);
    		}
    
    		public static TimeSpan Seconds(this int interval)
    		{
    			return Seconds((double)interval);
    		}
    
    		public static TimeSpan Seconds(this double interval)
    		{
    			return TimeSpan.FromSeconds(interval);
    		}
    
    		//.. a metric ton more utility methods like these...
    	}
    }

    With these extension methods, we get some handy syntax to ease the creation of TimeSpans.

    TimeSpan interval = 5.Seconds();
    TimeSpan elapsedTime = 0.7.Minutes();

    And don't forget to use the Nulalble<TimeSpan>, a.k.a. TimeSpan? when the interval is optional. I think the nullable is clearer than using TimeSpan.Zero (or TimeSpan.MinValue — argh!!!) to represent unknown or missing values.

  • Design Patterns in Ruby - book review

    I have a friend that is very much into Design Patterns and wanted to learn Ruby with a more applied perspective of the language.

    I went the exact opposite direction. I know a little bit of Ruby already and I wanted to improve my limited patterns knowledge.

    What we had in common is that we both picked up Design Patterns in Ruby by Russ Olsen. The title can be a little deceiving in that you might think it assumes Ruby knowledge, but no, it actually covers the Ruby language at a level that doesn't bore the reader with programming basics. The book assumes you know how to program already but you're new to Ruby.

    After an introductory chapter about Ruby basics, the book delves into Design Patterns, their formal definitions, how they look like in Ruby, how to leverage Ruby features to tweak the patterns, and examples of the pattern being used in examples extracted from the Ruby class library or popular components (gems). As the examples and tweaks are being presented, any new Rubyism being applied is explained.

    I found this book to be a great way to learn more about the Design Patterns and the proper way to implement them in Ruby. I also learned a little more Ruby and some language features that I did not know how to use yet.

  • The new crop of .NET Screencasts

    I finally carved up some time and watched the first episode of Steve Bohlen's Summer of NHibernate. These are sessions that Steve recorded for his team's Dine and Discuss events and he was kind enough to share with the entire community.

    Steve undoubtfully knows his stuff and how to explain the topic with the right amount of details and sprinkled with lots of insightful comments. I'm looking forward to watching the other sessions soon.

    It takes a lot of effort to put a screencast like that together and I admire the people that create and make them available to us. I think screencasts are quickly becoming the best way to learn a new technology or tool. Imagine the number of hours I would have to spend reading a NHibernate book, 20 or 30 hours for a slow reader like myself? The amount of information you can get from videos, especially screencasts where you feel like you're in a coding session with the author, just can't be matched by a book.

    Screencasts aren't without problems either. They're expensive to host, stream, and download. They're typically not searchable. You need a computer so you can't just have them on your side table (no, I'm not gonna watch them on an iPod, sorry.) They don't substitute reference material, which is not really a problem, just not the role of this medium. I can't watch them during my commute because I'm a responsible driver.

    I'm happy to see a lot of new sources of .Net screencasts and I wish I had time to watch them all. Here's a list of screencast series that I watch/watched/will watch.

    .NET Screencasts

    Non-.NET

    • Railscasts: Great way to get familiar with Ruby on Rails development.
    • Peepcode: Commercial, inexpensive videos. At $9.00, they're a steal.
    • Pragmatic Programmer's screencasts: Since I'm big fan of these guys, I'm sure I'll buy at least a few of these very soon.
  • Doing a 180 in a matter of months

    by: Darrell Mozingo

    This post was originally submitted to The Great Devlicio.us Giveaway.

    December 2006 was a low point. The company had lost some good developers, projects were stalling, morale was low, and the outlook simply wasn't good. It was the usual story, probably heard thousands of times before and still lived by thousands more: cowboy coding in continuous crunch mode. Page behind line counts were climbing into the mid four digits and the simplest changes had huge rippling effects across not only the current project, but other systems that were so tightly coupled together they were all fused at the hip. I was in the process of flirting with a few other companies at the time too, but after realizing I didn't want an almost hour drive each way every day, I decided to stay and try to help turn things around.

    Coincidentally, something also changed in management around this time – perhaps they saw the sharp morale decline in recent months, or read an article that got them thinking, or who knows – and they too decided things had to change. So, the first step was talking them into getting us some quality training, and not just the ‘ol Advanced ASP.NET training, but some more basic and helpful training, like Object-Oriented Design & Analysis. They agreed, and everyone was thrilled afterwards. We saw all of our current pain points laid out with corresponding ways to counter them using solid OO designs and techniques over the week long course. Sure we all had our OO classes in college, but we'd never really seen how to properly apply them to business applications. First thing after the training, both management and all the developers sat down to lay some new ground work for our future course.

    Books were ordered to rebuild our then defunct library, including plenty of juicy OOD books and some old McConnell classics. Online articles started getting sent around between developers for more reading. We started pushing back on clients (who were, in a way, internal clients) to give us time for development. Management loosened the budget for new hardware and software. Things started looking great, and it all happened in only a few months time. It was amazing. Sure, there were still things that needed to change, but we were definitely heading in the right direction.

    Before "the transformation" had even began, several of our internal clients had been wanting complete new systems (some were still running classic ASP, some had completely changed their business model, etc), but they weren't quite ready yet. So we kept chewing on existing work that needed done. For almost a year afterwards we tried the various techniques we learned, along with some new ones, on existing projects and several smaller new ones. OR/M's, small scale unit testing, decoupling, CI, and more were all being tried and accepted within the teams. With these large, green field, development projects looming ever closer, though, we were still hitting pain points using these new techniques. Clients weren't completely happy, and there was still something just not sitting right with us developers.

    One of the newer developers – not junior, just new- had been looking into adopting RUP at his old company. IBM agreed to come in for a quick one day assessment of our current lifecycle process, where they'd sit down and talk with our clients too, and give us suggestions for improvement (sales pitch, anyone?). When they gave their review, though, it hit me like a ton of bricks. We were using good development techniques, sure, but inside an almost pure waterfall structure. We all knew waterfall wasn't the way to go, but we were totally wearing blinders to the fact that we were even doing it. Whoops! Oddly enough, IBM pushed a very agile form of RUP on us afterwards, so we took a look.

    Since then, some teams have adopted a more formal RUP framework, while others, like mine, have gone with styles leaning heavily towards agile. I'd done tons of reading for quite awhile, and a bit of playing in my off time, with test driven development, so I pitched it along with the new ASP.NET MVC framework, and they took it. The team I'm on is small, with only two other developers working on a large, green field payroll application, so acceptance is usually easier to get.

    We're now on iteration 3, developing in a completely test-driven way (though we still catch ourselves doing some test-after-development, but we're working on it!), delivering functioning software to the users a little bit at a time using as "many practices" from the ALT.NET community as we can. We're not completely agile – we're not really doing user stories and planning as, say, an XP team would, but I'm sure we'll fall into that eventually. One piece at a time we're converting over. We're also very interested in BDD and DDD, too, and are looking into it while adopting some of those practice's lower hanging fruit.

    So far our users are thrilled with the software, we're very happy with the design and testing being built around it, and I'm absolutely loving my job again. We've come a long way in a relatively short amount of time, and things continue to get better every day. To think, I almost quit.

  • Chicago ALT.NET Meeting on July 9th

    Chicago ALT.NET meets this Wednesday, July 9th again at ThoughtWorks. You can register and get more information about the event at the link below.

    Mock Objects In Practice

    6:00 pm
    Pizza and networking time

    6:30 pm
    This month's topic is Mock Objects, or simply "mocking". The agenda to guide the discussion is not set yet, but below is a list of items we'd like to cover. Feel free to add more to this list by making your suggestions in the mailing list.

    • We want to see code, not just talk
    • What and how hard or easy to use mocks are?
    • Are they just for testing?
    • Aren't they just noise?
    • Tools
    • How to do mocking well
    • Does the habit of using mocks lead to good design? Or the reverse?
    • Is TypeMock evil?

More Posts

Our Sponsors

Red-Gate!

Proudly Partnered With