Sunday, 21 December 2008

Project description

One of my first big projects I worked on was a system to detect problems on a play-out network. During this project I learned a lot about software design (I forced myself to use Domain Driven Design) and object oriented programming. But after some time, when the system was already in use, I thought that the design could be better and easier. In this post I want to describe the system, its current design and how I see the new design.
I will use the new design in other posts to describe different aspects of software development and techniques.


The system

When working on this project I worked for a radio broadcaster that uses different transmission site to broadcast their radio programs. On these transmission sites the organisation has a computer network, which are used to automatically play the radio programs. Those little networks are connected to each other and to some distribution sites. The distribution sites take care of sending the radio programs to the right station a few days prior to the scheduled broadcast.

Because the organization doesn't have employers on the transmission sites, there was a need for a system that monitors the state of the network and whether the radio programs are playing or not.

The current design

In the current design I made a separation between "clients" and "servers". The clients were the applications on the transmission site and the servers were the applications on the distribution sites. Both client and server show the state of the network, the client from the transmission site, the server from all transmission sites. The client does the monitoring of the network and devices and send status/change messages via TCP/IP to the servers.

Internally I made a little domain model. I have a Site, a SiteRepository interface to search for a specific site or device. Each site has several CommonDevices. A device has a Name, an Address and an Online status.
There are some devices that need more information, for example the Computer. The computer is derived from the CommonDevice and has a PlayQueue and a PlayStatus.

Checking the status of devices is done in two different ways. Active, the application is running one or more threads that actively check the state of a particular device. Passive, the application get status messages via a TCP message/command server.

The problem of this whole design is that it is not really expendable, for every new device that should be checked, a new class should be created. So I think of a completely different design.

The new design

There is a very easy few for the whole system. Basically there are devices and services. Devices can have multiple services and a service contains the information that should be shown (for example the play queue which lists radio programs that are queue for play-out). This makes the model a lot easier. I now have a Device which has a status (Online, offline or unreachable) and its Name and Address. Devices are connected to each other, so every device need to know its Parent as well. (or its children, or both, I am not sure about that yet.) This way it is possible to tell that a Device is unreachable, because another device between the unreachable device and the device that is checking the status is offline. I will write more about this structure in another post.
So now we have Devices, but we still lack functionality, what about the play-out status and the play-queue? This can be solved by adding Services to the devices. A Service has a Name, a Status and Data. The Status indicates whether the service is running correctly or not. The data contains information about a specific service, for example the queue items in the play-queue.

By using this model it is possible to add a lot of other devices and services. The only problem I still see is how does the application determine the status of the Device or Service? A possibility is to add a Command class that contains the information about how to check the status. The question is whether this Command class belongs in the domain or not.

Disclaimer

It is possible that someone is reading this and thinks "This sounds familiar...". That could be possible. The same concept (except for the object oriented way of working) is already realized by
Nagios. Nagios is a network monitoring system created by Nagios Enterprises.  It is released as Open Source Software under the GNU General Public License, but is only running on a Linux host. Since the organization I worked for is using Windows on it's computers, it was not an option to use it.
My project is started as learning project for object oriented programming and other development techniques. Since Nagios is not object oriented (but written in C) I think it will not hurt anybody when I use the concepts of Nagios. This project is started for personal use, and I might decide to release it under an open source license.


Thursday, 18 December 2008

Introducing myself

Hello, my name is David Perfors. since summer 2007 I am a graduated programmer.

For one year I have worked for a Christian radio broadcaster as a programmer. We were using Delphi and I developed a system to monitor the state of the play-out system. The play-out system is a network of computers that play radio programs on a specific time. Beside computers there were other devices as well that needed to be monitored.

Currently I am working for a software firm using C# .NET and Java. As a personal training project I wanted to rewrite the monitoring system using different techniques I am learning now.

Some techniques are:

  • Domain Driven Design (I was already using this, but I did not make use of all the possibilities)

  • Test Driven Development

  • NHibernate

  • .NET / Mono

Well, the last two are not really techniques but frameworks, but I need to learn how to use them ;)

One of the reasons I start blogging is to write down my findings and experiences. But I will probably not blog only about programming/development, but also about other things I like to do. I am a great fan of Linux and Unix and I like to investigate applications and projects that run on it (like Asterix, mutt and Nagios). Photography is a hobby that I started this year, and I just want to share some of the pictures I took.