Next big thing
I have something of a prediction. If not a prediction then a wish. A wish for a feature that should become part of IDEs everywhere, in much the same way that IntelliSense-esque tools and refactoring tools have.
To explain the feature, first let me explain the problem it solves. Supposing I have a number of similar lines of code:
Item1.Text = GetData("Item1") Item2.Text = GetData("Item2") Item3.Text = GetData("Item3") Item4.Text = GetData("Item4") Item5.Text = GetData("Item5")
… and I want to make a similar change to each of these lines, such as:
Item1.Value = Convert(GetData("Item1"), String) Item2.Value = Convert(GetData("Item2"), String) Item3.Value = Convert(GetData("Item3"), String) Item4.Value = Convert(GetData("Item4"), String) Item5.Value = Convert(GetData("Item5"), String)
Currently, I can use tools such as Find and Replace to replace e.g. “.Text = GetData(” with “.Value = Convert(GetData(“, but replacing “)” with “), String)” is a bit more tricky. For that I would probably copy and paste “, String)” onto the end of each line. Either way, this is a very repetitive task. And if there’s one thing that we know, it’s that computers are excellent at automating repetitive tasks. I would love a tool that, after I’ve changed a couple lines, spots the repetition and intelligently asks if I want to apply the same modification to subsequent similar lines – ideally with a preview to check accuracy.
Another example. Supposing I have a list of blank <select> options that I’ve quickly copied and pasted ready for population:
<option value=""></option> <option value=""></option> <option value=""></option> <option value=""></option> <option value=""></option>
… and I fill the lines in like so:
<option value="Item1">Item1</option> <option value="Item2">Item2</option> <option value="Item3">Item3</option> <option value="Item4">Item4</option> <option value="Item5">Item5</option>
Again, I would fill in the first couple of lines, but this one would work a bit differently. The tool would realise that the value and text of each item is the same, and automatically fill out one based on what I type in the other. I.e. I’d type “Item3″ into the value field of the third option, and it would automatically put “Item3″ as the inner HTML. Taking it a step further, in this particular example, it could also pick up the sequential numbering of items, and suggest to fill out the remaining items automatically. A step further again, and you could get it to work with e.g. form elements or project datasource columns, to automatically produce entire forms and classes based on a bit of initial prompting – i.e. write out some code that mentions the first and second columns of a given datasource, and it suggests lines of code similar to the lines entered, but with the other column names.
Of course this tool is completely hypothetical – at least as far as I’m aware… But in theory would not be too drastically hard to create, and would save developers everywhere a lot of time; I’m allowed to dream, aren’t I? If it became a reality, it would be a huge feature – the next big thing perhaps?
This entry was posted on Wednesday, July 7th, 2010 at 1:32 pm and is filed under Code. You can follow any responses to this entry through the RSS 2.0 feed. You can skip to the end and leave a response. Pinging is currently not allowed.