How to read a file, the IoC way...

time to read 3 min | 460 words

I mentioned that it can take me quite a bit of code to read a file. After carefully consulting the documentation, I have come to realize that INT21 calls are not necessary in .Net. A bit amazed, I took a look at the code, which grew in leaps and bounds and is now self sustaining, according to my research.

I don’t believe in UML, but I do believe in pretty pictures, so I put together the following picture.

 

 

 

I left out several pieces, like the file parser, to focus on the important issue, which is reading a file. The big fun was to listen to a list of requirements and say “Yes, I can do that”, “Yes, should be easy”, “Already there”, etc. Building the configuration is a bit like playing puzzles, each part of the application is truly separated.  

You get nice configuration bugs this way. I accidently put the mark done action before the parse file action, and couldn’t understand why it wasn’t working. J

This is the first project in a long time where I did not use NHibernate. I now regret this position bitterly, ADO.Net is just a PITA to work with. The amount of repeating code that you need to write is amazing, the amount of strings is also frightening. I’ll probably put NHibernate there anyway, since that would significantly reduce the amount of stuff that I need to do.  I am not sure that this is an overkill or not. Right now I start to get into the data access for the application itself, and it looks like it will be needed anyway.

There is only so much datasets that I can stand.

 

 Anyway, most of those pieces were developed TDD`ed and separately; I had major worries about integration, but it passed rather smoothly. I love Windsor, and in this case, it is the application. The above should be the simplified live object graph, as it was generated by Windsor. Call a single method on the coordinator, and the system starts rolling. Input comes in, and the system responds, often in fairly complex ways.

The only output that I have at the moment is log4net output, which is a great help in general, but thought me quite a bit about what is considered good logging.

“Executing action” is generally not a good log message.

 

By the way, anyone knows of a good way to draw complex object graphs?  The example above is nice, but it is one dimensional and show just a single aspect of the object graph. The case in point, under both the clock and the file watcher, I’ve many sub trees, and it is just not possible to get them all there in the  structure above. You would lose sight of the forest from all the trees. J