Archive for June, 2008

Consolidating – Subversion virtual machine moved

As I mentioned before, I’m trying to consolidate the number of websites that I have to maintain. My young-technologies.com domain was badly out of date, and didn’t really have any useful information. I decided to redirect all of it’s pages to this site.

Moving Boxes

The only page that was getting real traffic on that site was the Subversion virtual machine appliance, which I created a long time ago. I decided to move that page to this domain. That means that I have only one page to manage instead of an entire domain.

If you haven’t seen that virtual appliance, it’s worth checking out. It’s basically a fully functional Subversion install on Ubuntu linux, with WebSVN installed to view it in a web browser. It’s been downloaded over a thousand times, and it’s now being hosted using Amazon’s S3 service.

While the appliance has found a new home, I’m not sure if an when it’s going to be updated. If there are any future announcements about it, they’ll be made on this blog.

Using "var" to simplify code and avoid redundancy

You’ve probably already heard of the new "var" keyword that you can use to declare variables in your .NET code. I wanted to clear up some quick myths and give a quick overview of when it’s most valuable.

If you haven’t heard of it, you can now use this syntax:

var c = new Cat();

Instead of this:

Cat c = new Cat();

As Jeff Atwood mentioned, it’s a great way to avoid redundancy. It’s obvious that you’re creating a "Cat" object, why do you have to say it twice?

The most important thing to realize, is that it’s NOT a var like in JavaScript or other languages (DIM in VB). It really is 100% a "Cat" object, complete with intellisense. The generated IL would be no different than specifying the type when you declare it. It’s simply a compiler trick.

Another important thing to remember is that you the assignment must be combined with the declaration. If that wasn’t the case, readability would be very poor.

var myName = "Jason"; //Allowed
var yourName; //Not allowed
yourName = "Bob"; //Glad you can't do this

What are some really good examples of when it ideally should be used:

List<Dictionary<int, string>> customers = new List<Dictionary<int, string>>(); //Yuck!
var customers = new List<Dictionary<int, string>>(); //Yay!

OrderRepository orderRepo = (OrderRepository)ctx.GetObject("orderRepository"); //Yuck!
var orderRepo = (OrderRepository)ctx.GetObject("orderRepository"); //Yay!

string name = "Jason Young"; //Kinda yucky
var name = "Jason Young"; //Kinda better

As you can see, those examples have obvious redundancy. Using the "var" keyword increases readability, and makes it easier to change if needed.

There are certainly times when its use is questionable. In the following example, I’m calling a function that returns some data. Since I’m not explicitly defining the type that is being returned from that function, I have to do some digging to figure out the type being returned. In this case, you’ll have to define the correct way to handle it in your coding standards.

var data = GetData();

Another potential readability issue comes up in the following case. You might not want to use the "Circle" specific methods (Circle inherits from Shape).

Shape s = GetCircle(); //I see what you're doing
var s = GetCircle(); //Do you want a shape, or a circle?

Aside from a couple of decisions that need to be made in your organization, I think this is a great addition, and should make our lives as developers a little bit easier. It’s just another tool for our toolbelt. With great power comes great responsibility

Using an army and luck to reach critical mass

This post is going to explain the importance of your product reaching critical mass. When I say “product”, I mean an actual product you’re selling, or simply a website or blog. When I’m talking about critical mass, I’m describing the point at which your product becomes viral, sometimes known as the network effect. This should be a lesson to anyone thinking of creating their own product or service.

image

Above, you’ll see the typical technology adoption bell curve. What you need to realize is that you’re starting on the left, and you’re trying to get up the hill. Do you think it’s easy? Well, judging by Youtube, twitter, milliondollarhomepage, Digg, or myspace, it must be easy!

The truth is, you should have a path to success. Here are just a couple of paths that have worked for other products:

  • Create a product that is leaps and bounds better than anything your potential customers have ever seen – An example is Google, which was originally created by students in college. The brilliance of the algorithm and its implementation were the start of a massive company.
  • Have an army of followers that listen to your advice – A great example is Steve Jobs. Before he even makes a new product announcement, people line up at Apple stores. People trust that he’ll make cool stuff, so they listen to whatever he says. You can bet that if Steve Jobs mentioned your product, you would people lining up at your door to buy it.
  • Get lucky – It happens time and time again. Multiple products are released at the same time, all with similar features and price. Sometimes one of them gets lucky, and the others die. An example is the VHS vs Betamax format war. VHS was considered the inferior product, yet it went on to become the de facto standard.
  • Create a product that is viral by nature – Twitter and Myspace come to mind. Once one person joins, they’re begging their friends to use if. If they don’t, the service is useless. The result is that you get an army of free advertisers talk to your key demographic.
  • Spend a ridiculous amount of cash to bombard users with advertising – infomercial’s and those annoying “we’ll double the offer” commercials come to mind.

Hopefully I’m making the situation look difficult. I couldn’t find any concrete numbers, but you can be sure that more than half of online businesses fail within the first couple of years. That includes well-funded businesses. If you expect to start the next Fog Creek Software while working part time in the evenings, you need to have a plan.

The best advice I can give you is to do whatever it takes to get your product into the hands of as many people as possible. It might mean making partnerships with someone of influence, or it might mean creating a viral marketing campaign. It might also mean that you’ll have to give your product away for free, build up your army of followers, and then invent another great product. If you already have a product with a good user base, you’re probably already in good shape. If you are just starting out, don’t think that people will magically find you, unless you’re counting on the “lucky” path I described.

DreamHost disallows use as a backup service

I just received this email from DreamHost:

Dear Jason,

Our system has noticed what seems to be a large amount of "backup/non-web" content on your account (#xxxx), mostly on user "xxxx" on the web server "xxxx".

Some of that content specifically is in /home/superjason/Backup (although there may be more in other locations as well.)

Unfortunately, our terms of service (http://www.dreamhost.com/tos.html) state:

The customer agrees to make use of DreamHost Web Hosting servers primarily for the purpose of hosting a website, and associated email functions. Data uploaded must be primarily for this purpose; DreamHost Web Hosting servers are not intended as a data backup or archiving service. DreamHost Web Hosting reserves the right to negotiate additional charges with the Customer and/or the discontinuation of the backups/archives at their discretion.

At this point, we must ask you to do one of three things:

* You can delete all backup/non-web files on your account.
* You can close your account from our panel at: https://panel.dreamhost.com/?tree=billing.accounts (We are willing to refund to you any pre-paid amount you have  remaining, even if you’re past the 97 days. Just reply to this email after closing your account from the panel.

OR!

* You may now enable your account for backup/non-web use!

If you’d like to enable your account to be used for non-web files, please visit the link below. You will be given the option to be charged $0.20 a month per GB of usage (the monthly average, with daily readings) across your whole account.

We don’t think there exists another online storage service that has anything near the same features, flexibility, and redundancy for less than this, so we sincerely hope you take us up on this offer!

In the future, we plan to allow the creation of a single "storage" user on your account which will have no web sites (or email). For now though, if you choose to enable your account for backups, nothing will change (apart from the charges).

If you want to enable backup/non-web use on this account, please go here:

https://panel.dreamhost.com/backups.cgi?g=xxxx

If you choose not to enable this, you must delete all your non-web files by 2008-06-29 or your account will be suspended.

If you have any questions about this or anything at all, please don’t hesitate to contact us by replying to this email.

Thank you very much for your understanding,
The Happy DreamHost Backup/Non-Web Use Team

image

Admittedly, the primary reason I chose them was because they’re a great backup solution. I didn’t realize that it was against their terms of service, in fact, there is a ton of information out there about using rsync to backup your files to them. I’ve been doing it for well over a year now, and I’ve been recommending the service to others.

I had heard many bad things about DreamHost, but they were working great for backups. Now you can’t use them for that, what do they have going for them? I can’t imagine many users have 400GB+ websites that their hosting. If they are, I have a hard time believing they’re using cheap shared hosting!

Now I’m looking into other backup solutions, and it’s looking pretty grim. Since my server and laptop both run Windows 2008, there aren’t many solutions available. For example, Mozy requires you to use their business version, which is ridiculously expensive.

Another option is JungleDisk, which uses Amazon’s S3 service. I would be looking at paying $30/month to backup around 200GB.

Does anyone have other ideas? The solution has to be automatic, so that I don’t have to count on remembering to do it. It also has to be off-site, because I don’t want to lose all of our photos of our house burns down.

Agile patterns & practices and the developer divide

In what little free time I have, I’ve been slowly working my way through the book "Agile Principles, Patterns, and Practices in C#" by Robert C. Martin. This is a GREAT book, and a real eye opener.

image

This book has shaped some of the fundamental ways that I look at software. Whenever I look at a problem now, I think about how I’m going to create the building blocks to solve that problem. As an example, MSDN magazine just had a great article about the opened-closed principle which actually discusses this book.

Sure, I used to have excellent test coverage and modularity, but this book has given me insight to take it to the next level. For example, following the single responsibility pattern is a concrete way of making your code more adaptable to change, and makes your code easier to maintain and understand.

The book even offers information about studies that have shown a correlation between how often working software is delivered, and the quality of the final product. When points are made, evidence is often provided to back it up. It’s difficult to argue with real numbers.

The book covers these areas:

  • Agile principles, and the fourteen practices of Extreme Programming
  • Spiking, splitting, velocity, and planning iterations and releases
  • Test-driven development, test-first design, and acceptance testing
  • Refactoring with unit testing
  • Pair programming
  • Agile design and design smells
  • The five types of UML diagrams and how to use them effectively
  • Object-oriented package design and design patterns
  • How to put all of it together for a real-world project

If you haven’t read this book, I highly recommend it. I think just about everyone could get something out of it. Even if you’re not practicing or learning agile, the techniques themselves are still valuable.

On a personal note, I feel like I’m entering a completely new level of software development. I don’t know if I’ve just been unlucky, but I’ve never worked with a team that really understood and/or practiced these patterns and practices. They certainly didn’t teach this stuff in school.

I became curious as to the adoption rates of agile, and the rate of success that people are seeing. There is plenty of information that shows that the agile process is being used, and has been working well for lots of teams.