Sunday, February 19, 2006

Suggestion: Desktop Search Shell Command Extension

I was looking for a phrase some where on my hard drive - so naturally I used MSN Desktop Search - and I found the file that contains the phrase. A word document with > 5000 words.

So these are the steps that I had to go thru to find the phrase I wanted.
1. Type the search phrase into the msn bar at the bottom of the screen
2. Wait for the result window to open
3. Find the right file from all of the returned files
4. Double click the file to open it.
5. hit ctrl f in Microsoft word
6. Retype the search phrase into Microsoft word
7. Click Find to find the item.

7 Steps to find something from the command line. What if we could smoothen things out so that we could stop the process at 4.

So the process is now only :
1. Type the search phrase into the msn bar at the bottom of the screen
2. Wait for the result window to open
3. Find the right file from all of the returned files
4. Double click the file to open it.

at this point Word would open and immediately search for the search phase and highlight it.

How do I suggest this happening? Like thus.
Applications can define commands to run against their associated document types so for example if you right click on a word document you would have Open,Edit,New,Print etc...

My suggestion - apps would define another command type called "Search". When a user clicks on a document in the windows desktop search window then search will open the app passing the command line defined in the registry key and the name of the document and the search term.

When the app (any app - I was using word as an example) - received the search command it will load the specified file and immediately do a search for the appropriate phrase.

Thursday, February 09, 2006

Suggestion: Built in factories

Factory patterns are very useful - they allow you to switch around the object types you want to create without a user having to have any knowledge on the actual implementation.

The problem with the actual factories are that they are hard to implement and thus are usually not implemented unless you see a clear need in the future for abstraction. The rest of the time you just new up objects and use them.

What happens in the future when you realize that things are not that simple and you are going to require a factory to decide which object to create - then you must replace all of the news all over the place.

My suggestion: repurpose the new keyword to call a static method that will allow the method to choose the object to create. If that method is not implemented (or returns null?) then new will actually create the new object - else it will pass along the object created by the static method.

So for example - if I had a car object that had calls to create a car and it was called like this until now

car c = new car("Camry")
c.AddWheels(4);
c.BuildEngine();

etc..

but eventually we realize that hybrids have a totally separate engine process - so we create a new called Hybrid car and we leave Car as is but we override the hybrids BuildEngine() method to create a hybrid.
Now all that has to be changed is that we add a new static method to the class
(perhaps something like this)
public static Car Car(string CarType)
{
if (CarType="Hybrid")
{return new HybridCar();}
return null;
}

This page is powered by Blogger. Isn't yours?