Introducing Secretary.Net

written by Scott Muc on Tuesday, August 11 2009

Like most OSS (Open Source Software), the creation for Secretary.Net was the result of the major pain I was having with my current work. The CBC Radio 3 website is very file and context heavy. The idea of a path to an image is meaningless without context. Is it the image for an Arist? How about a Concert? Or perhaps a BlogPost by a certain Artist? What about an audio file for an Artist? Over time I started seeing a pattern. For almost every path to a file I needed to know what type of file it is, and the owning Entity of that file.

Here are some example paths:

A picture for the artist with an Id of 4302: 

C:\resources\artists\4\4302\images\bandpic.jpg

An mp3 for an artist with an Id of 4302:

C:\resources\audio\artists\4\4302\Track1.mp3

Or maybe it's like this:

C:\resources\artists\4\4302\tracks\Track1.mp3

Nothing is simply prepending a base path to a file name. Base paths can be different based on the file type context. I don't want to restrict all files for a specific artist to a certain branch in the folder tree.

Let's say that you have 10 different entities how do you manage the retrieval of files? I personally feel that Entities should not need to know where files exist. Entities just need to know file names, and that's it.

What I have begun is a project that can facilitate your file locating needs. There's lots of potential in this project to even abstract file location boundaries. The next phase I want to perform is the creation of HTTP locations for files so I can construct URLs in the same way I construct file system paths. Or better yet, instead of just references to locations, I can perform actions upon these references where I can copy a file system resource to an FTP resource without any extra API. The up front configuration is all that is needed.

So far my first prototype allows for the following:

FileLocator.Find(FileType.Audio).Named("Test.mp3").For(testArtist)

which returns the string C:\test\music\1\Test.mp3

I would like to thank Daniel Cazzulino for making his inspiring screencast series on the development of Funq.

How Is This Done?

Stay tuned for more posts describing my use of the Secretary metaphor and how to setup an application to use Secretary.Net.

Similar Posts

  1. Unit Testing Domain Persistence With NDbUnit, NHibernate and SQLite
  2. My Developer Resolutions For 2010
  3. Top 5 Things I Can't Compromise In Web Development

Comments

  • Ted Jardine on on 8.13.2009 at 8:20 AM

    Ted Jardine avatar

    Wouldn't the PC name be PersonalAssistant.NET? ;-)

    I don't know if I'd come across a use case where I'd use this, but looks pretty cool and would be great for when it would be needed.

  • Scott Muc on on 8.13.2009 at 11:08 AM

    Scott Muc avatar

    Hehe, Or how about Generic File Location Assistant?

    I'm actually attempting to integrate it into the Radio 3 project so we'll see how well it actually works out.

Post a comment

Options:

Size

Colors