Feeds:
Posts
Comments

I have been anxiously awaiting Derek Webb’s new album. Looks like he had released a new single from it today. Wow!

So, I started using SugarSync here at work. It’s a great tool — not only does it sync files I’m working on between my work computer and my MacBook, but it makes those files accessible from my iPhone. So, I’m in a meeting a need to pull up some notes that I didn’t bring with me — it’s right there on my phone.

But, there is danger.

Yesterday, I worked remotely from my MacBook all day. It was great.. zero distractions and I got a ton done. I then came to the office this morning and logged on to my work computer. My document was still open there from when I worked on it at the office 2 days ago. Oh, that’s an old version, I thought.. I’ll just close it. I close it, it asks me to save changes, and I always say “Yes”.

This is where the danger comes in. To the sync application, that is now the latest version of the document because it has a newer time stamp. The sync application will pick up that version and transfer it to my MacBook, overwriting the version that was there which was the newer version I had spend and addition 10 hours working on.

Fortunately, in this case, I could see what was going to happen and I disconnected my MacBook from the network before it could. But, I could have easily lost a day’s work.

Another danger to watch out for is cascading deletes. A lot of syncing tools will, by default, sync deletes. So, if you accidently delete a file from one computer, the tool will see that and delete it from all of the others. Your file that you thought was backed up is now gone.

So, in conclusion, be very careful when using sync tools. I use to use one as my only method of backup until I realized all of the potential dangers. As long as you know what to look for, they are terrific time saving tools. Just be careful!

Update: Since writing this post, I have been told that SugarSync does keep older versions of files, instead of overwriting them, and it moves deleted files to the Trash so they can still be recovered. When I get a minute, I need to test that out and see how it works (with some much less important documents!).

Emma: Year Four

Emma’s fourth birthday is next week. We created this video to be played at her party. The theme is ‘princess’, so Steven Curtis Chapman’s song ‘Cinderella’ seemed to work perfectly.

Note: This is part of my series on Domain Driven Design:

  1. Part 1: Introduction and Entities
  2. Part 2: Value Objects and Services
  3. Part 3: Repositories and Factories
  4. Using Domain Driven Design with a Three Tiered Architecture

One of the questions I received related to the topic of Domain Driven Design was related to how we implement DDD in a three tiered architecture. The key to this is with the Repositories and Factories.

Let’s take for instance a website that consists of a web front end, a middle tier, and a database. The customer comes to the website and saves an order. The web front end will create the Order entity and populate it with the information submitted by the user. It will then call the RepositoryFactory to determine what Repository to use to save the Order. In the config file, it is specified that MiddleTierRepository should be used to implement IOrderRepository. So, the Factory returns the MiddleTierRepository and the web front end calls SaveOrder on it. This Repository calls a web method in the middle tier called SaveOrder.

orderumlwebmethod

The middle tier then receives the Order. It performs an type of validation upon it and decides to save it. It calls the same RepositoryFactory used above, but in its config file it is specified that SqlServerOrderRepository should be used in this instance to save the Order. So, the Factory returns the SqlServerOrderRepository, which also implements IOrderRepository, and calls SaveOrder on it to save it to the database.

orderumlwebservice

We do use an ORM tool in this environment. We use nHibernate. So, in the situation above, we would use NHibernateOrderRepository instead of SqlSeverOrderRepository for the middle tier to save the order to the database.

In a nutshell, that is how we translated these patterns into a three tiered architecture.


I’ve been a fan of Jars of Clay ever since college, but their last few albums have been very exciting. Their latest, ‘The Long Fall Back to Earth’, released today and it is very, very good. You have to check it out. If you want to try only one song from it, I’d recommend Closer (which was released a few months ago on an EP) or The Long Fall. But every song on the album (there are 14 of them!) is awesome.

Updated 4/22/09: So, the more I listen to this the more I’m struck by different songs.  ”Hero” and “Weapons” are both must listens.  ”Headphones” is pretty much the only song I could do without.  It sounds like he wrote “Boys” for his kids, which as a father really strikes me.   Anyway, just wanted to add a couple of the songs I listed above.

In these challenging economic times, everyone is looking for some ways to save money. Well, I have an idea that will save a ton: Fire your cable company!

Here’s the deal. I have not had cable TV for at least 7 or 8 years now, and I don’t miss it at all. I have never missed an episode of Lost or Battlestar Galactica. Yes, I know Battlestar Galactica was on the Sci Fi channel. But I saw every episode without paying the cable company $50+ per month for the privilege of watching their content.

So, how do you fire your cable company and yet still get to watch high quality content for all of your favorite TV shows? There are a number of options.

Online Streaming

Online Streaming is going to be your cheapest option. If you have a computer and have broadband internet, you can stream almost every television show for free. Hulu is the best place to find content, but all networks are not represented there, so you can go direction to the network’s website as well. Normally shows are posted online the day after they air, but sometimes you have to wait a week (as in the case of the final couple of Battlestar Galactica episodes). ABC’s streaming player is particularly good, for all of my fellow Lost fans out there. You do have to wait through commercials with this option, but there are normally one 3 or 4 and they are very short.

iTunes

If you can’t find a show available for online streaming, you don’t want to wait, or you want to be able to watch the show disconnected from the internet, iTunes is a good option. Using iTunes, you can download standard definition episodes for $1.99 and HD for $2.99. You can also buy season passes for shows that will save you some money. This is a great solution if you want to watch while on an airplane, on an iPhone, or other portable device. There are no commercials to watch if you use this solution.

HTPC

The above solutions all have you watching television shows on your computer. But, you can also watch this content on your TV. That’s where a Home Theater PC, or HTPC, comes in to play. I wrote a post a while ago about my HTPC. I took an old Dell laptop and plugged it into my HD TV. This is great for most content, but sometimes I run into problems with that older PC not having enough horsepower for rendering the video. I’m hoping to upgrade this soon with a new Mac Mini or Dell Studio Hybrid. If you use a system like this you have the freedom of watching online streaming content on your TV. Adding a TV tuner to the computer will give you a DVR that you don’t have to pay a monthly fee for.

NetFlix or Blockbuster.com

TV show come out on DVD normally a couple of months at the conclusion of a season. You can buy the DVDs, but normally I don’t watch a given season of a show enough to justify buying it. Using a service like Netflix or Blockbuster.com is a great solution. Jenny and I have watched several seasons this way and it worked great. Each disc normally has 4 episodes on it, so we’d watch a disc over the course of a week. When we were done, we’d put it in the mail and get the next one a day or 2 later. We could watch an entire season of a show in 6 weeks this way. We watched all 7 seasons of Gilmore Girls in the course of a summer a couple years ago doing this.

HD Antenna

None of the solutions I have outlined above will work for sporting events, local news and weather, or my daughter’s morning cartoons. When we moved into our new house I installed an HD antenna in the attic. I took the output from this antenna and tied it into the coax running throughout the house by finding where the cable company’s line comes in, unplugging it, and attaching the cable from the antenna. I now have HD content coming to the entire house without having to pay a cable company for it. This is only going to be local broadcast stations, but that’s more than we normally watch. Plug this into the TV tuner built into your HTPC (above) and you have an HD DVR.

Conclusion

So, as you can tell, there are a lot of alternatives to play a ton of money to a cable company to receive television content. I use all of the options above from time to time with great success. I never miss a show that I want to watch and I don’t have to play a huge monthly fee for it.

Note: This is part of my series on Domain Driven Design:

  1. Part 1: Introduction and Entities
  2. Part 2: Value Objects and Services
  3. Part 3: Repositories and Factories
  4. Using Domain Driven Design with a Three Tiered Architecture

Today I conclude my series on Domain Driven Design. In the first part we looked at a brief introduction and the concept of Entities. In the second part we covered Value Objects and Services. Today we’ll look at Repositories and Factories.

Repositories and Factories

Eventually, when defining your Domain language, you are going to have to interact with the data stores and/or back end systems. This is where Repositories come into the picture. A Repository is meant to translate the data from the user identifiable Domain Language into the format needed for the data store, and then to perform the operations needed to send it there.

I will create an interface for each Entity that needs to be stored using a repositories. So, we have a Reservation Entity, I’ll have an interface called the IReservationRepository. It will define all of the CRUD operations. Then, for each datastore, I’ll create a repository class that implements one or more of these interfaces. We may have the SqlServerRepository that implements IReservationRepository, ILocationRepository, etc. The piece that ties this together is the Factory.

I’ll create a factory called the RepositoryFactory that has a method called GetReservationRepository that returns an IReservationRepository. It looks in a configuration file to get the correct class (the SqlServerRepository) that needs to be created and returned to be used as the IReservaitonRepository.

So, what does all of this buy us? Let’s say that today you are storing your reservations in a database, but tomorrow you need to store them in some other type of back end system. You create a new repository implementing the interface and modify your configuration file and you are up and running with the now data store. Or, if you want to write unit tests using a mock repository that doesn’t hit an actual database that is easy to do as well.

Conclusion

So, this has been a brief overview of Domain Driven Design. I have found this to be a very useful tool when designing systems as it fits in cleanly with the rest of our user-centric methodology and gives you a concise framework that can be used to architect anything from the most simple application to the very complex.

There are two books that I would recommend for those that want to dig deeper into the subject. Those books are:

Notes on Anathem

So, I finished Neil Stephenson’s book Anathem several weeks ago and have been wanting to write something about it, but I’ve struggled over where to begin. This is a very large book, and can be difficult to get through at times, but in the end I found it to be a very satisfying journey.

First I’ll talk about the world. The vastness of the world he has created and the detail he goes into to describe it rivals that of Tolkien. It takes place in a world that is almost, but not quite, ours. While reading the book you are educated on much of this world’s history to understand how it got to the state it which we find the characters.

The protagonist is a man named Erasmas who lives in the concent of Saunt Edhar. This is much like a monastery but where the god who is studies and worshiped is math and science. Stephenson has created an entire new dictionary that he uses when telling this story. But learning the terminology is not too hard of a challenge as each new chapter begins with a new definition. I’m sure the print version of the book has a glossary, but since I was listening to the audio version, I did not have this tool. I became so familiar with the terms as I was reading the book that I began to think of my iPhone as a “Jeejah”.

Much of this book reads like a metaphysical lecture. The characters must dive into the depths of mathematics, astronomy, and philosophy to solve the mystery of an seeming alien ship that has presented itself. And the journey is fascinating.

I don’t want to go any farther for fear of spoiling the book. But, if you are a fan of hard science fiction, and the size and depth of the book does not scare you away, I highly recommend reading this.

Note: This is part of my series on Domain Driven Design:

  1. Part 1: Introduction and Entities
  2. Part 2: Value Objects and Services
  3. Part 3: Repositories and Factories
  4. Using Domain Driven Design with a Three Tiered Architecture

Today’s post is a continuation of my series on Domain Driven Design. One of my favorite parts of Domain Driven Design is how it narrows your focus down to a handful of design patters that will work for just about any application you are building. I discussed the first of these design patters in the last post, the Entity. This is the most important pattern for building out your ubiquitous domain language. The next pattern to discuss is the Value Object.

Value Objects

Just like Entities, Value Objects have attributes. The difference between them comes in the way that you identify them. An Entity has a unique ID and is identified by the ID. For example, an employee has an Employee ID number. A Reservation, as we discussed in the last post, has a Reservation Number. Entities can always be identified by a unique ID.

Value Objects, on the other hand, contain a collection of attributes, and it is those attributes that define the object. Value Objects are immutable, that is they cannot be modified after they are created.

Examples of Value Objects in the car rental application would be the pickup date / time. This date / time object would have a month, day, year, hour and minute associated with it. There is no separate unique ID to identify it as it is defined by the the collection of its attributes. If you modify one of those attributes, it is a completely separate date / time object. On the other hand, if you modify one of the attributes of a Reservation (for example, the Car), you have modified the Reservation but the reservation itself is the same.

So, the easiest way to think of the separation between Entities and Value Objects is to determine if it has a unique ID or if it’s identity is fully defined by the sum of it’s attributes.

An interesting thing to consider is the Rate object that I discussed in the last post. A Rate has a price, a location, and a vehicle. Is this an Entity or a Value Object? Normally I would probably say that it is a Value Object, because if you change one of those attributes, you have changed the quoted Rate. However, having worked at a rental car company, I know that they assign IDs to quoted rates and store every quoted rate in the database. So it is persisted indefinitely and is referred to by the unique ID. So, I believe a case could be made for it either way.

Services

So far we have talked about methods that are applied directly to Entities or Value Objects. But, what if you have a method that does not naturally fit there? An example would be a GetRates that takes the pickup location, pickup date and return date, and returns a list of available rates. Where does this method go? This is where a Service comes in. You would create a RatesService that contains this method.

An important characteristic of services is that they are stateless. That is, the RatesService takes some values as input, performs an operation, returns a result, and then goes away. This would be a good candidate for static methods in most languages.

In Domain Driven Design these services are treated as first class citizens along side the Entities as you are mapping out your domain language. Users can clearly think of a RatesService that you throw information into and gives you meaningful results.

In the next post I will discuss the last two design patterns used in Domain Driven Design: Repositories and Factories.

Rue Royale

Back in September of 2007, I had a post talking about a new band that I had found named Rue Royale. They are a husband and wife duo that features beautiful smooth melodies, acoustic guitars, and artistic lyrics. A couple of weeks ago my iPod came across them again while I was listening to a random playlist, and was started wondering what they were now up to. Not only did I discover that they had a full length album out now, but it has been out for over a year!

The self-titled album includes 10 songs, three of which are from the EP – Parachutes and Lifeboats, Even in the Darkness, and U.F.O. You really ought to check out their MySpace page and, if you like the music, pick up the album. This quickly replaced the new U2 album at the top of my playlist.

Older Posts »